Commit 101733b5 authored by Jan Provaznik's avatar Jan Provaznik

Merge branch '61788-predefined-colours-dont-have-descriptive-labels' into 'master'

Fix for #61788 predefined colours dont have descriptive labels

Closes #61788

See merge request gitlab-org/gitlab-ce!28343
parents d072cd15 d35f986c
...@@ -76,29 +76,39 @@ module LabelsHelper ...@@ -76,29 +76,39 @@ module LabelsHelper
end end
def suggested_colors def suggested_colors
[ {
'#0033CC', '#0033CC' => s_('SuggestedColors|UA blue'),
'#428BCA', '#428BCA' => s_('SuggestedColors|Moderate blue'),
'#44AD8E', '#44AD8E' => s_('SuggestedColors|lime green'),
'#A8D695', '#A8D695' => s_('SuggestedColors|Feijoa'),
'#5CB85C', '#5CB85C' => s_('SuggestedColors|Slightly desaturated green'),
'#69D100', '#69D100' => s_('SuggestedColors|Bright Green'),
'#004E00', '#004E00' => s_('SuggestedColors|Very dark lime green'),
'#34495E', '#34495E' => s_('SuggestedColors|Very dark desaturated blue'),
'#7F8C8D', '#7F8C8D' => s_('SuggestedColors|Dark grayish cyan'),
'#A295D6', '#A295D6' => s_('SuggestedColors|Slightly desaturated blue'),
'#5843AD', '#5843AD' => s_('SuggestedColors|Dark moderate blue'),
'#8E44AD', '#8E44AD' => s_('SuggestedColors|Dark moderate violet'),
'#FFECDB', '#FFECDB' => s_('SuggestedColors|Very pale orange'),
'#AD4363', '#AD4363' => s_('SuggestedColors|Dark moderate pink'),
'#D10069', '#D10069' => s_('SuggestedColors|Strong pink'),
'#CC0033', '#CC0033' => s_('SuggestedColors|Strong red'),
'#FF0000', '#FF0000' => s_('SuggestedColors|Pure red'),
'#D9534F', '#D9534F' => s_('SuggestedColors|Soft red'),
'#D1D100', '#D1D100' => s_('SuggestedColors|Strong yellow'),
'#F0AD4E', '#F0AD4E' => s_('SuggestedColors|Soft orange'),
'#AD8D43' '#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 end
def text_color_for_bg(bg_color) def text_color_for_bg(bg_color)
......
...@@ -24,10 +24,7 @@ ...@@ -24,10 +24,7 @@
%br %br
= _("Or you can choose one of the suggested colors below") = _("Or you can choose one of the suggested colors below")
.suggest-colors = render_suggested_colors
- suggested_colors.each do |color|
= link_to '#', style: "background-color: #{color}", data: { color: color } do
 
.form-actions .form-actions
= f.submit _('Save'), class: 'btn btn-success js-save-button' = f.submit _('Save'), class: 'btn btn-success js-save-button'
......
...@@ -9,9 +9,7 @@ ...@@ -9,9 +9,7 @@
.dropdown-labels-error.js-label-error .dropdown-labels-error.js-label-error
%input#new_label_name.default-dropdown-input{ type: "text", placeholder: _('Name new label') } %input#new_label_name.default-dropdown-input{ type: "text", placeholder: _('Name new label') }
.suggest-colors.suggest-colors-dropdown .suggest-colors.suggest-colors-dropdown
- suggested_colors.each do |color| = render_suggested_colors
= link_to '#', style: "background-color: #{color}", data: { color: color } do
&nbsp
.dropdown-label-color-input .dropdown-label-color-input
.dropdown-label-color-preview.js-dropdown-label-color-preview .dropdown-label-color-preview.js-dropdown-label-color-preview
%input#new_label_color.default-dropdown-input{ type: "text", placeholder: _('Assign custom color like #FF0000') } %input#new_label_color.default-dropdown-input{ type: "text", placeholder: _('Assign custom color like #FF0000') }
......
...@@ -25,12 +25,7 @@ ...@@ -25,12 +25,7 @@
Choose any color. Choose any color.
%br %br
Or you can choose one of the suggested colors below Or you can choose one of the suggested colors below
= render_suggested_colors
.suggest-colors
- suggested_colors.each do |color|
= link_to '#', style: "background-color: #{color}", data: { color: color } do
 
.form-actions .form-actions
- if @label.persisted? - if @label.persisted?
= f.submit 'Save changes', class: 'btn btn-success js-save-button' = f.submit 'Save changes', class: 'btn btn-success js-save-button'
......
---
title: Adds a text label to color pickers to improve accessibility.
merge_request: 28343
author: Chris Toynbee
type: changed
...@@ -9400,6 +9400,69 @@ msgstr "" ...@@ -9400,6 +9400,69 @@ msgstr ""
msgid "Suggested change" msgid "Suggested change"
msgstr "" 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" msgid "Sunday"
msgstr "" msgstr ""
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment