parent
4477dc249e
commit
d334f8d4fa
|
@ -34,10 +34,7 @@ module LabelsHelper
|
||||||
# Returns a String
|
# Returns a String
|
||||||
def link_to_label(label, project: nil, type: :issue, tooltip: true, css_class: nil, &block)
|
def link_to_label(label, project: nil, type: :issue, tooltip: true, css_class: nil, &block)
|
||||||
project ||= @project || label.project
|
project ||= @project || label.project
|
||||||
link = send("namespace_project_#{type.to_s.pluralize}_path",
|
link = label_filter_path(project, label, type: type)
|
||||||
project.namespace,
|
|
||||||
project,
|
|
||||||
label_name: [label.name])
|
|
||||||
|
|
||||||
if block_given?
|
if block_given?
|
||||||
link_to link, class: css_class, &block
|
link_to link, class: css_class, &block
|
||||||
|
@ -46,6 +43,13 @@ module LabelsHelper
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def label_filter_path(project, label, type: issue)
|
||||||
|
send("namespace_project_#{type.to_s.pluralize}_path",
|
||||||
|
project.namespace,
|
||||||
|
project,
|
||||||
|
label_name: [label.name])
|
||||||
|
end
|
||||||
|
|
||||||
def project_label_names
|
def project_label_names
|
||||||
@project.labels.pluck(:title)
|
@project.labels.pluck(:title)
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
- labels.each do |label|
|
- labels.each do |label|
|
||||||
%span.label-row.btn-group{ role: "group", aria: { label: escape_once(label.name) }, style: "color: #{text_color_for_bg(label.color)}" }
|
%span.label-row.btn-group{ role: "group", aria: { label: escape_once(label.name) }, style: "color: #{text_color_for_bg(label.color)}" }
|
||||||
= link_to namespace_project_label_path(@project.namespace, @project, label),
|
= link_to label_filter_path(@project, label, type: controller.controller_name),
|
||||||
class: "btn btn-transparent has-tooltip",
|
class: "btn btn-transparent has-tooltip",
|
||||||
style: "background-color: #{label.color};",
|
style: "background-color: #{label.color};",
|
||||||
title: escape_once(label.description),
|
title: escape_once(label.description),
|
||||||
|
|
Loading…
Reference in New Issue