Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Boxiang Sun
gitlab-ce
Commits
5d121892
Commit
5d121892
authored
Jun 16, 2016
by
Alfredo Sumaran
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add GitLab CI Yml dropdown selector
parent
620d014a
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
42 additions
and
2 deletions
+42
-2
app/assets/javascripts/api.js.coffee
app/assets/javascripts/api.js.coffee
+7
-0
app/assets/javascripts/blob/blob_ci_yaml.js.coffee
app/assets/javascripts/blob/blob_ci_yaml.js.coffee
+23
-0
app/assets/javascripts/blob/edit_blob.js.coffee
app/assets/javascripts/blob/edit_blob.js.coffee
+1
-0
app/assets/stylesheets/pages/editor.scss
app/assets/stylesheets/pages/editor.scss
+9
-2
app/views/projects/blob/_editor.html.haml
app/views/projects/blob/_editor.html.haml
+2
-0
No files found.
app/assets/javascripts/api.js.coffee
View file @
5d121892
...
...
@@ -7,6 +7,7 @@
labelsPath
:
"/api/:version/projects/:id/labels"
licensePath
:
"/api/:version/licenses/:key"
gitignorePath
:
"/api/:version/gitignores/:key"
gitlabCIYmlPath
:
"/api/:version/gitlab_ci_ymls/:key"
group
:
(
group_id
,
callback
)
->
url
=
Api
.
buildUrl
(
Api
.
groupPath
)
...
...
@@ -110,6 +111,12 @@
$
.
get
url
,
(
gitignore
)
->
callback
(
gitignore
)
gitlabCIYml
:
(
key
,
callback
)
->
url
=
Api
.
buildUrl
(
Api
.
gitlabCIYmlPath
).
replace
(
':key'
,
key
)
$
.
get
url
,
(
file
)
->
callback
(
file
)
buildUrl
:
(
url
)
->
url
=
gon
.
relative_url_root
+
url
if
gon
.
relative_url_root
?
return
url
.
replace
(
':version'
,
gon
.
api_version
)
app/assets/javascripts/blob/blob_ci_yaml.js.coffee
0 → 100644
View file @
5d121892
#= require blob/template_selector
class
@
BlobCiYamlSelector
extends
TemplateSelector
requestFile
:
(
query
)
->
Api
.
gitlabCIYml
query
.
name
,
@
requestFileSuccess
.
bind
(
@
)
class
@
BlobCiYamlSelectors
constructor
:
(
opts
)
->
{
@
$dropdowns
=
$
(
'.js-gitlab-ci-yml-selector'
)
@
editor
}
=
opts
@
$dropdowns
.
each
(
i
,
dropdown
)
=>
$dropdown
=
$
(
dropdown
)
new
BlobCiYamlSelector
(
pattern
:
/(.gitlab-ci.yml)/
,
data
:
$dropdown
.
data
(
'data'
),
wrapper
:
$dropdown
.
closest
(
'.js-gitlab-ci-yml-selector-wrap'
),
dropdown
:
$dropdown
,
editor
:
@
editor
)
app/assets/javascripts/blob/edit_blob.js.coffee
View file @
5d121892
...
...
@@ -15,6 +15,7 @@ class @EditBlob
new
BlobLicenseSelectors
{
@
editor
}
new
BlobGitignoreSelectors
{
@
editor
}
new
BlobCiYamlSelectors
{
@
editor
}
initModePanesAndLinks
:
->
@
$editModePanes
=
$
(
".js-edit-mode-pane"
)
...
...
app/assets/stylesheets/pages/editor.scss
View file @
5d121892
...
...
@@ -60,13 +60,14 @@
.encoding-selector
,
.license-selector
,
.gitignore-selector
{
.gitignore-selector
,
.gitlab-ci-yml-selector
{
display
:
inline-block
;
vertical-align
:
top
;
font-family
:
$regular_font
;
}
.gitignore-selector
,
.license-selector
{
.gitignore-selector
,
.license-selector
,
.gitlab-ci-yml-selector
{
.dropdown
{
line-height
:
21px
;
}
...
...
@@ -76,4 +77,10 @@
width
:
220px
;
}
}
.gitlab-ci-yml-selector
{
.dropdown-menu-toggle
{
width
:
250px
;
}
}
}
app/views/projects/blob/_editor.html.haml
View file @
5d121892
...
...
@@ -17,6 +17,8 @@
=
dropdown_tag
(
"Choose a License template"
,
options:
{
toggle_class:
'js-license-selector'
,
title:
"Choose a license"
,
filter:
true
,
placeholder:
"Filter"
,
data:
{
data:
licenses_for_select
,
project:
@project
.
name
,
fullname:
@project
.
namespace
.
human_name
}
}
)
.gitignore-selector.js-gitignore-selector-wrap.hidden
=
dropdown_tag
(
"Choose a .gitignore template"
,
options:
{
toggle_class:
'js-gitignore-selector'
,
title:
"Choose a template"
,
filter:
true
,
placeholder:
"Filter"
,
data:
{
data:
gitignore_names
}
}
)
.gitlab-ci-yml-selector.js-gitlab-ci-yml-selector-wrap.hidden
=
dropdown_tag
(
"Choose a GitLab CI Yaml template"
,
options:
{
toggle_class:
'js-gitlab-ci-yml-selector'
,
title:
"Choose a template"
,
filter:
true
,
placeholder:
"Filter"
,
data:
{
data:
gitlab_ci_ymls
}
}
)
.encoding-selector
=
select_tag
:encoding
,
options_for_select
([
"base64"
,
"text"
],
"text"
),
class:
'select2'
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment