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
Léo-Paul Géneau
gitlab-ce
Commits
0a986081
Commit
0a986081
authored
Jul 16, 2016
by
Phil Hughes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
GL dropdown default toggle color
parent
82ef4f1e
Changes
8
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
29 additions
and
9 deletions
+29
-9
app/assets/javascripts/gl_dropdown.js.coffee
app/assets/javascripts/gl_dropdown.js.coffee
+8
-1
app/assets/javascripts/labels_select.js.coffee
app/assets/javascripts/labels_select.js.coffee
+5
-0
app/assets/javascripts/milestone_select.js.coffee
app/assets/javascripts/milestone_select.js.coffee
+3
-2
app/assets/javascripts/users_select.js.coffee
app/assets/javascripts/users_select.js.coffee
+3
-3
app/assets/stylesheets/framework/dropdowns.scss
app/assets/stylesheets/framework/dropdowns.scss
+6
-0
app/helpers/dropdowns_helper.rb
app/helpers/dropdowns_helper.rb
+2
-1
app/views/shared/issuable/_label_dropdown.html.haml
app/views/shared/issuable/_label_dropdown.html.haml
+1
-1
app/views/shared/issuable/_milestone_dropdown.html.haml
app/views/shared/issuable/_milestone_dropdown.html.haml
+1
-1
No files found.
app/assets/javascripts/gl_dropdown.js.coffee
View file @
0a986081
...
...
@@ -617,7 +617,14 @@ class GitLabDropdown
$dropdownContent
.
scrollTop
(
listItemTop
-
dropdownContentTop
)
updateLabel
:
(
selected
=
null
,
el
=
null
,
instance
=
null
,
added
=
false
)
=>
$
(
@
el
).
find
(
".dropdown-toggle-text"
).
text
@
options
.
toggleLabel
(
selected
,
el
,
instance
,
added
)
$toggleText
=
$
(
@
el
).
find
(
".dropdown-toggle-text"
)
$toggleText
.
text
@
options
.
toggleLabel
(
selected
,
el
,
instance
,
added
)
if
@
options
.
defaultLabel
if
$toggleText
.
text
().
trim
()
is
@
options
.
defaultLabel
$toggleText
.
addClass
(
'is-default'
)
else
$toggleText
.
removeClass
(
'is-default'
)
$
.
fn
.
glDropdown
=
(
opts
)
->
return
@
.
each
->
...
...
app/assets/javascripts/labels_select.js.coffee
View file @
0a986081
...
...
@@ -4,6 +4,7 @@ class @LabelsSelect
$
(
'.js-label-select'
).
each
(
i
,
dropdown
)
->
$dropdown
=
$
(
dropdown
)
$toggleText
=
$dropdown
.
find
(
'.dropdown-toggle-text'
)
projectId
=
$dropdown
.
data
(
'project-id'
)
labelUrl
=
$dropdown
.
data
(
'labels'
)
issueUpdateURL
=
$dropdown
.
data
(
'issueUpdate'
)
...
...
@@ -280,12 +281,16 @@ class @LabelsSelect
index
=
selectedLabels
.
indexOf
selected
.
title
selectedLabels
.
splice
index
,
1
if
selected
.
id
?
and
selected
.
id
is
0
selectedLabels
=
[]
if
selectedLabels
.
length
>
1
"
#{
selectedLabels
[
0
]
}
+
#{
selectedLabels
.
length
-
1
}
more"
else
if
selectedLabels
.
length
is
1
selectedLabels
[
0
]
else
defaultLabel
defaultLabel
:
defaultLabel
fieldName
:
$dropdown
.
data
(
'field-name'
)
id
:
(
label
)
->
if
$dropdown
.
hasClass
(
'js-issuable-form-dropdown'
)
...
...
app/assets/javascripts/milestone_select.js.coffee
View file @
0a986081
...
...
@@ -70,11 +70,12 @@ class @MilestoneSelect
search
:
fields
:
[
'title'
]
selectable
:
true
toggleLabel
:
(
selected
)
->
if
selected
&&
'id'
of
select
ed
toggleLabel
:
(
selected
,
el
,
e
,
added
)
->
if
selected
and
'id'
of
selected
and
add
ed
selected
.
title
else
defaultLabel
defaultLabel
:
defaultLabel
fieldName
:
$dropdown
.
data
(
'field-name'
)
text
:
(
milestone
)
->
_
.
escape
(
milestone
.
title
)
...
...
app/assets/javascripts/users_select.js.coffee
View file @
0a986081
...
...
@@ -142,12 +142,12 @@ class @UsersSelect
selectable
:
true
fieldName
:
$dropdown
.
data
(
'field-name'
)
toggleLabel
:
(
selected
)
->
if
selected
&&
'id'
of
select
ed
toggleLabel
:
(
selected
,
el
,
e
,
added
)
->
if
selected
and
'id'
of
selected
and
add
ed
if
selected
.
text
then
selected
.
text
else
selected
.
name
else
defaultLabel
defaultLabel
:
defaultLabel
inputId
:
'issue_assignee_id'
hidden
:
(
e
)
->
...
...
app/assets/stylesheets/framework/dropdowns.scss
View file @
0a986081
...
...
@@ -562,3 +562,9 @@
display
:
block
;
color
:
$gl-placeholder-color
;
}
.dropdown-toggle-text
{
&
.is-default
{
color
:
$gl-placeholder-color
;
}
}
app/helpers/dropdowns_helper.rb
View file @
0a986081
...
...
@@ -40,8 +40,9 @@ module DropdownsHelper
end
def
dropdown_toggle
(
toggle_text
,
data_attr
,
options
=
{})
default_label
=
options
[
:data
][
:default_label
]
content_tag
(
:button
,
class:
"dropdown-menu-toggle
#{
options
[
:toggle_class
]
if
options
.
has_key?
(
:toggle_class
)
}
"
,
id:
(
options
[
:id
]
if
options
.
has_key?
(
:id
)),
type:
"button"
,
data:
data_attr
)
do
output
=
content_tag
(
:span
,
toggle_text
,
class:
"dropdown-toggle-text"
)
output
=
content_tag
(
:span
,
toggle_text
,
class:
"dropdown-toggle-text
#{
'is-default'
if
toggle_text
==
default_label
}
"
)
output
<<
icon
(
'chevron-down'
)
output
.
html_safe
end
...
...
app/views/shared/issuable/_label_dropdown.html.haml
View file @
0a986081
...
...
@@ -18,7 +18,7 @@
=
hidden_field_tag
data_options
[
:field_name
],
label
,
id:
nil
.dropdown
%button
.dropdown-menu-toggle.js-label-select.js-multiselect
{
class:
classes
.
join
(
' '
),
type:
"button"
,
data:
dropdown_data
}
%span
.dropdown-toggle-text
%span
.dropdown-toggle-text
{
class:
(
"is-default"
if
selected_toggle
)
}
=
h
(
multi_label_name
(
selected_toggle
||
selected
,
"Label"
))
=
icon
(
'chevron-down'
)
.dropdown-menu.dropdown-select.dropdown-menu-paging.dropdown-menu-labels.dropdown-menu-selectable
...
...
app/views/shared/issuable/_milestone_dropdown.html.haml
View file @
0a986081
-
project
=
@target_project
||
@project
-
selected_text
=
project
.
milestones
.
find
(
selected
).
try
(
:name
)
-
selected_text
=
project
.
milestones
.
find
_by_id
(
selected
).
try
(
:name
)
-
if
selected
.
present?
=
hidden_field_tag
(
name
,
selected
)
=
dropdown_tag
(
milestone_dropdown_label
(
selected_text
),
options:
{
title:
"Filter by milestone"
,
toggle_class:
"js-milestone-select js-filter-submit
#{
extra_class
}
"
,
filter:
true
,
dropdown_class:
"dropdown-menu-selectable"
,
...
...
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