diff options
author | Douglas Barbosa Alexandre <dbalexandre@gmail.com> | 2016-09-19 22:49:08 +0300 |
---|---|---|
committer | Douglas Barbosa Alexandre <dbalexandre@gmail.com> | 2016-10-19 19:57:15 +0300 |
commit | 52e0c3b565b7b177abbf8ea3bc573651060179a2 (patch) | |
tree | 1cd659377de0a28c7dc5afee456a1b9bb9849d7b /app/helpers/labels_helper.rb | |
parent | d820c090ec85f8118e4cea75bd63d800e812ea25 (diff) |
Add CRUD for Group Labels
Diffstat (limited to 'app/helpers/labels_helper.rb')
-rw-r--r-- | app/helpers/labels_helper.rb | 28 |
1 files changed, 23 insertions, 5 deletions
diff --git a/app/helpers/labels_helper.rb b/app/helpers/labels_helper.rb index b9f3d6c75c2..540eb6dd493 100644 --- a/app/helpers/labels_helper.rb +++ b/app/helpers/labels_helper.rb @@ -43,11 +43,29 @@ module LabelsHelper 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]) + def link_to_group_label(label, group: nil, type: :issue, tooltip: true, css_class: nil, &block) + group ||= @group || label.group + link = label_filter_path(group, label, type: type) + + if block_given? + link_to link, class: css_class, &block + else + link_to render_colored_label(label, tooltip: tooltip), link, class: css_class + end + end + + def label_filter_path(subject, label, type: issue) + case subject + when Project + send("namespace_project_#{type.to_s.pluralize}_path", + subject.namespace, + subject, + label_name: [label.name]) + when Group + send("#{type.to_s.pluralize}_group_path", + subject, + label_name: [label.name]) + end end def project_label_names |