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
d35f986c
Commit
d35f986c
authored
May 16, 2019
by
Chris Toynbee
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix for #61788 predefined colours dont have descriptive labels
parent
3c5d4d52
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
104 additions
and
36 deletions
+104
-36
app/helpers/labels_helper.rb
app/helpers/labels_helper.rb
+33
-23
app/views/admin/labels/_form.html.haml
app/views/admin/labels/_form.html.haml
+1
-4
app/views/shared/issuable/_label_page_create.html.haml
app/views/shared/issuable/_label_page_create.html.haml
+1
-3
app/views/shared/labels/_form.html.haml
app/views/shared/labels/_form.html.haml
+1
-6
changelogs/unreleased/61788-predefined-colours-dont-have-descriptive-labels.yml
...61788-predefined-colours-dont-have-descriptive-labels.yml
+5
-0
locale/gitlab.pot
locale/gitlab.pot
+63
-0
No files found.
app/helpers/labels_helper.rb
View file @
d35f986c
...
...
@@ -76,29 +76,39 @@ module LabelsHelper
end
def
suggested_colors
[
'#0033CC'
,
'#428BCA'
,
'#44AD8E'
,
'#A8D695'
,
'#5CB85C'
,
'#69D100'
,
'#004E00'
,
'#34495E'
,
'#7F8C8D'
,
'#A295D6'
,
'#5843AD'
,
'#8E44AD'
,
'#FFECDB'
,
'#AD4363'
,
'#D10069'
,
'#CC0033'
,
'#FF0000'
,
'#D9534F'
,
'#D1D100'
,
'#F0AD4E'
,
'#AD8D43'
]
{
'#0033CC'
=>
s_
(
'SuggestedColors|UA blue'
),
'#428BCA'
=>
s_
(
'SuggestedColors|Moderate blue'
),
'#44AD8E'
=>
s_
(
'SuggestedColors|lime green'
),
'#A8D695'
=>
s_
(
'SuggestedColors|Feijoa'
),
'#5CB85C'
=>
s_
(
'SuggestedColors|Slightly desaturated green'
),
'#69D100'
=>
s_
(
'SuggestedColors|Bright Green'
),
'#004E00'
=>
s_
(
'SuggestedColors|Very dark lime green'
),
'#34495E'
=>
s_
(
'SuggestedColors|Very dark desaturated blue'
),
'#7F8C8D'
=>
s_
(
'SuggestedColors|Dark grayish cyan'
),
'#A295D6'
=>
s_
(
'SuggestedColors|Slightly desaturated blue'
),
'#5843AD'
=>
s_
(
'SuggestedColors|Dark moderate blue'
),
'#8E44AD'
=>
s_
(
'SuggestedColors|Dark moderate violet'
),
'#FFECDB'
=>
s_
(
'SuggestedColors|Very pale orange'
),
'#AD4363'
=>
s_
(
'SuggestedColors|Dark moderate pink'
),
'#D10069'
=>
s_
(
'SuggestedColors|Strong pink'
),
'#CC0033'
=>
s_
(
'SuggestedColors|Strong red'
),
'#FF0000'
=>
s_
(
'SuggestedColors|Pure red'
),
'#D9534F'
=>
s_
(
'SuggestedColors|Soft red'
),
'#D1D100'
=>
s_
(
'SuggestedColors|Strong yellow'
),
'#F0AD4E'
=>
s_
(
'SuggestedColors|Soft orange'
),
'#AD8D43'
=>
s_
(
'SuggestedColors|Dark moderate orange'
)
}
end
def
render_suggested_colors
colors_html
=
suggested_colors
.
map
do
|
color_hex_value
,
color_name
|
link_to
(
''
,
'#'
,
class:
"has-tooltip"
,
style:
"background-color:
#{
color_hex_value
}
"
,
data:
{
color:
color_hex_value
},
title:
color_name
)
end
content_tag
(
:div
,
class:
'suggest-colors'
)
do
colors_html
.
join
.
html_safe
end
end
def
text_color_for_bg
(
bg_color
)
...
...
app/views/admin/labels/_form.html.haml
View file @
d35f986c
...
...
@@ -24,10 +24,7 @@
%br
=
_
(
"Or you can choose one of the suggested colors below"
)
.suggest-colors
-
suggested_colors
.
each
do
|
color
|
=
link_to
'#'
,
style:
"background-color:
#{
color
}
"
,
data:
{
color:
color
}
do
=
render_suggested_colors
.form-actions
=
f
.
submit
_
(
'Save'
),
class:
'btn btn-success js-save-button'
...
...
app/views/shared/issuable/_label_page_create.html.haml
View file @
d35f986c
...
...
@@ -9,9 +9,7 @@
.dropdown-labels-error.js-label-error
%input
#new_label_name
.default-dropdown-input
{
type:
"text"
,
placeholder:
_
(
'Name new label'
)
}
.suggest-colors.suggest-colors-dropdown
-
suggested_colors
.
each
do
|
color
|
=
link_to
'#'
,
style:
"background-color:
#{
color
}
"
,
data:
{
color:
color
}
do
&
nbsp
=
render_suggested_colors
.dropdown-label-color-input
.dropdown-label-color-preview.js-dropdown-label-color-preview
%input
#new_label_color
.default-dropdown-input
{
type:
"text"
,
placeholder:
_
(
'Assign custom color like #FF0000'
)
}
...
...
app/views/shared/labels/_form.html.haml
View file @
d35f986c
...
...
@@ -25,12 +25,7 @@
Choose any color.
%br
Or you can choose one of the suggested colors below
.suggest-colors
-
suggested_colors
.
each
do
|
color
|
=
link_to
'#'
,
style:
"background-color:
#{
color
}
"
,
data:
{
color:
color
}
do
=
render_suggested_colors
.form-actions
-
if
@label
.
persisted?
=
f
.
submit
'Save changes'
,
class:
'btn btn-success js-save-button'
...
...
changelogs/unreleased/61788-predefined-colours-dont-have-descriptive-labels.yml
0 → 100644
View file @
d35f986c
---
title
:
Adds a text label to color pickers to improve accessibility.
merge_request
:
28343
author
:
Chris Toynbee
type
:
changed
locale/gitlab.pot
View file @
d35f986c
...
...
@@ -9400,6 +9400,69 @@ msgstr ""
msgid "Suggested change"
msgstr ""
msgid "SuggestedColors|Bright Green"
msgstr ""
msgid "SuggestedColors|Dark grayish cyan"
msgstr ""
msgid "SuggestedColors|Dark moderate blue"
msgstr ""
msgid "SuggestedColors|Dark moderate orange"
msgstr ""
msgid "SuggestedColors|Dark moderate pink"
msgstr ""
msgid "SuggestedColors|Dark moderate violet"
msgstr ""
msgid "SuggestedColors|Feijoa"
msgstr ""
msgid "SuggestedColors|Moderate blue"
msgstr ""
msgid "SuggestedColors|Pure red"
msgstr ""
msgid "SuggestedColors|Slightly desaturated blue"
msgstr ""
msgid "SuggestedColors|Slightly desaturated green"
msgstr ""
msgid "SuggestedColors|Soft orange"
msgstr ""
msgid "SuggestedColors|Soft red"
msgstr ""
msgid "SuggestedColors|Strong pink"
msgstr ""
msgid "SuggestedColors|Strong red"
msgstr ""
msgid "SuggestedColors|Strong yellow"
msgstr ""
msgid "SuggestedColors|UA blue"
msgstr ""
msgid "SuggestedColors|Very dark desaturated blue"
msgstr ""
msgid "SuggestedColors|Very dark lime green"
msgstr ""
msgid "SuggestedColors|Very pale orange"
msgstr ""
msgid "SuggestedColors|lime green"
msgstr ""
msgid "Sunday"
msgstr ""
...
...
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