diff options
author | Robert Speicher <rspeicher@gmail.com> | 2015-04-02 20:46:43 -0400 |
---|---|---|
committer | Robert Speicher <rspeicher@gmail.com> | 2015-04-20 13:01:42 -0400 |
commit | 96c2b940480eb1bafd47e1f6d203ad11f8f646df (patch) | |
tree | 91d4a52b7e5558677f864b1eb1371a40bc681b33 /app/helpers/labels_helper.rb | |
parent | 76aade28e25d1f6e8924b35ed9bd365c8889987f (diff) | |
download | gitlab-ce-96c2b940480eb1bafd47e1f6d203ad11f8f646df.tar.gz |
Reference filters :sparkles:
Commit ranges, commits, external issues, issues, labels, merge requests,
snippets, users.
Diffstat (limited to 'app/helpers/labels_helper.rb')
-rw-r--r-- | app/helpers/labels_helper.rb | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/app/helpers/labels_helper.rb b/app/helpers/labels_helper.rb index 32ef2e7ca84..0259829a059 100644 --- a/app/helpers/labels_helper.rb +++ b/app/helpers/labels_helper.rb @@ -7,9 +7,13 @@ module LabelsHelper label_color = label.color || Label::DEFAULT_COLOR text_color = text_color_for_bg(label_color) - content_tag :span, class: 'label color-label', style: "background-color:#{label_color};color:#{text_color}" do - label.name - end + # Intentionally not using content_tag here so that this method can be called + # by LabelReferenceFilter + span = %(<span class="label color-label") + + %( style="background-color: #{label_color}; color: #{text_color}">) + + label.name + '</span>' + + span.html_safe end def suggested_colors @@ -42,13 +46,15 @@ module LabelsHelper r, g, b = bg_color.slice(1,7).scan(/.{2}/).map(&:hex) if (r + g + b) > 500 - "#333" + '#333333' else - "#FFF" + '#FFFFFF' end end def project_labels_options(project) options_from_collection_for_select(project.labels, 'name', 'name', params[:label_name]) end + + module_function :render_colored_label, :text_color_for_bg end |