Skip to content
Snippets Groups Projects
Commit f565c439 authored by Winnie Hellmann's avatar Winnie Hellmann
Browse files

Provide default for calculating label text color (!11681)

parent e63d27d8
No related branches found
No related tags found
No related merge requests found
Loading
Loading
@@ -69,13 +69,12 @@ module LabelsHelper
end
 
def render_colored_label(label, label_suffix = '', tooltip: true)
label_color = label.color || Label::DEFAULT_COLOR
text_color = text_color_for_bg(label_color)
text_color = text_color_for_bg(label.color)
 
# Intentionally not using content_tag here so that this method can be called
# by LabelReferenceFilter
span = %(<span class="label color-label #{"has-tooltip" if tooltip}" ) +
%(style="background-color: #{label_color}; color: #{text_color}" ) +
%(style="background-color: #{label.color}; color: #{text_color}" ) +
%(title="#{escape_once(label.description)}" data-container="body">) +
%(#{escape_once(label.name)}#{label_suffix}</span>)
 
Loading
Loading
Loading
Loading
@@ -133,6 +133,10 @@ class Label < ActiveRecord::Base
template
end
 
def color
super || DEFAULT_COLOR
end
def text_color
LabelsHelper.text_color_for_bg(self.color)
end
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment