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
1
Merge Requests
1
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
nexedi
gitlab-ce
Commits
75b21ebd
Commit
75b21ebd
authored
Mar 08, 2016
by
Phil Hughes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Can create new label from dropdown
parent
5cdac761
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
62 additions
and
6 deletions
+62
-6
app/assets/javascripts/api.js.coffee
app/assets/javascripts/api.js.coffee
+14
-0
app/assets/javascripts/gl_dropdown.js.coffee
app/assets/javascripts/gl_dropdown.js.coffee
+3
-3
app/assets/javascripts/labels_select.js.coffee
app/assets/javascripts/labels_select.js.coffee
+26
-0
app/assets/stylesheets/framework/dropdowns.scss
app/assets/stylesheets/framework/dropdowns.scss
+1
-0
app/assets/stylesheets/pages/labels.scss
app/assets/stylesheets/pages/labels.scss
+12
-1
app/views/shared/issuable/_filter.html.haml
app/views/shared/issuable/_filter.html.haml
+6
-2
No files found.
app/assets/javascripts/api.js.coffee
View file @
75b21ebd
...
...
@@ -75,6 +75,20 @@
).
done
(
labels
)
->
callback
(
labels
)
newLabel
:
(
project_id
,
data
,
callback
)
->
url
=
Api
.
buildUrl
(
Api
.
labels_path
)
url
=
url
.
replace
(
':id'
,
project_id
)
data
.
private_token
=
gon
.
api_token
$
.
ajax
(
url
:
url
type
:
"POST"
data
:
data
dataType
:
"json"
).
done
(
label
)
->
callback
(
label
)
milestones
:
(
project_id
,
callback
)
->
url
=
Api
.
buildUrl
(
Api
.
milestones_path
)
url
=
url
.
replace
(
':id'
,
project_id
)
...
...
app/assets/javascripts/gl_dropdown.js.coffee
View file @
75b21ebd
...
...
@@ -2,7 +2,7 @@ class GitLabDropdownFilter
BLUR_KEYCODES
=
[
27
,
40
]
constructor
:
(
@
dropdown
,
@
remote
,
@
query
,
@
data
,
@
callback
)
->
@
input
=
@
dropdown
.
find
(
".dropdown-input-field"
)
@
input
=
@
dropdown
.
find
(
".dropdown-input
.dropdown-input
-field"
)
# Key events
timeout
=
""
...
...
@@ -108,10 +108,10 @@ class GitLabDropdown
@
togglePage
()
if
@
options
.
selectable
selector
=
"a"
selector
=
"
.dropdown-content
a"
if
@
dropdown
.
find
(
".dropdown-toggle-page"
).
length
selector
=
".dropdown-page-one a"
selector
=
".dropdown-page-one
.dropdown-content
a"
@
dropdown
.
on
"click"
,
selector
,
(
e
)
->
self
.
rowClicked
$
(
@
)
...
...
app/assets/javascripts/labels_select.js.coffee
View file @
75b21ebd
...
...
@@ -3,6 +3,32 @@ class @LabelsSelect
$
(
'.js-label-select'
).
each
(
i
,
dropdown
)
->
projectId
=
$
(
dropdown
).
data
(
'project-id'
)
selectedLabel
=
$
(
dropdown
).
data
(
'selected'
)
newLabelField
=
$
(
'#new_label_name'
)
newColorField
=
$
(
'#new_label_color'
)
if
newLabelField
.
length
$
(
'.suggest-colors-dropdown a'
).
on
"click"
,
(
e
)
->
e
.
preventDefault
()
e
.
stopPropagation
()
newColorField
.
val
$
(
this
).
data
(
"color"
)
$
(
'.js-dropdown-label-color-preview'
)
.
css
'background-color'
,
$
(
this
).
data
(
"color"
)
.
addClass
'is-active'
$
(
'.js-new-label-btn'
).
on
"click"
,
(
e
)
->
e
.
preventDefault
()
e
.
stopPropagation
()
if
newLabelField
.
val
()
isnt
""
&&
newColorField
.
val
()
isnt
""
$
(
'.js-new-label-btn'
).
disable
()
# Create new label with API
Api
.
newLabel
projectId
,
{
name
:
newLabelField
.
val
()
color
:
newColorField
.
val
()
},
(
label
)
->
$
(
'.js-new-label-btn'
).
enable
()
$
(
'.dropdown-menu-back'
,
$
(
dropdown
).
parent
()).
trigger
"click"
$
(
dropdown
).
glDropdown
(
data
:
(
term
,
callback
)
->
...
...
app/assets/stylesheets/framework/dropdowns.scss
View file @
75b21ebd
...
...
@@ -238,6 +238,7 @@
font-size
:
14px
;
border
:
0
;
background
:
none
;
outline
:
0
;
&
:hover
{
color
:
darken
(
$dropdown-title-btn-color
,
15%
);
...
...
app/assets/stylesheets/pages/labels.scss
View file @
75b21ebd
...
...
@@ -10,7 +10,7 @@
&
.suggest-colors-dropdown
{
margin-bottom
:
5px
;
a
{
@include
border-radius
(
0
);
width
:
36
.7px
;
...
...
@@ -20,6 +20,17 @@
}
}
.dropdown-label-color-preview
{
display
:
none
;
margin-top
:
5px
;
width
:
100%
;
height
:
25px
;
&
.is-active
{
display
:
block
;
}
}
.label-row
{
.label
{
padding
:
9px
;
...
...
app/views/shared/issuable/_filter.html.haml
View file @
75b21ebd
...
...
@@ -73,13 +73,17 @@
=
icon
(
'arrow-left'
)
%span
Create new label
%button
.dropdown-title-button.dropdown-menu-close
{
type:
"button"
,
aria:
{
label:
"close"
}}
=
icon
(
'times'
)
.dropdown-content
=
text_field_tag
:label_name
,
nil
,
class:
"dropdown-input-field"
,
placeholder:
"Name new label"
=
hidden_field_tag
:new_label_color
,
nil
=
text_field_tag
:new_label_name
,
nil
,
class:
"dropdown-input-field"
,
placeholder:
"Name new label"
.dropdown-label-color-preview.js-dropdown-label-color-preview
.suggest-colors.suggest-colors-dropdown
-
suggested_colors
.
each
do
|
color
|
=
link_to
'#'
,
style:
"background-color:
#{
color
}
"
,
data:
{
color:
color
}
do
&
nbsp
%button
.btn.btn-primary
{
type:
"button"
}
%button
.btn.btn-primary
.js-new-label-btn
{
type:
"button"
}
Create
.dropdown-loading
=
icon
(
'spinner spin'
)
...
...
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