Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDouglas Barbosa Alexandre <dbalexandre@gmail.com>2016-09-27 01:58:36 +0300
committerDouglas Barbosa Alexandre <dbalexandre@gmail.com>2016-10-19 19:58:24 +0300
commitb654229dcd3e4460ad7305ee7714395f044a72aa (patch)
treeb5bd0df6a0e8c85dd24d0a5f5ac132193ee46e4a /app/helpers
parentae88126d13d05ea040af495d77dcd1a84253d282 (diff)
Fix LabelsHelper#link_to_label to use the subject argument
Diffstat (limited to 'app/helpers')
-rw-r--r--app/helpers/labels_helper.rb22
1 files changed, 14 insertions, 8 deletions
diff --git a/app/helpers/labels_helper.rb b/app/helpers/labels_helper.rb
index 844bd3fd183..e26e82c6448 100644
--- a/app/helpers/labels_helper.rb
+++ b/app/helpers/labels_helper.rb
@@ -31,7 +31,13 @@ module LabelsHelper
#
# Returns a String
def link_to_label(label, subject: nil, type: :issue, tooltip: true, css_class: nil, &block)
- link = label_filter_path(label, type: type)
+ subject ||=
+ case label
+ when GroupLabel then label.group
+ when ProjectLabel then label.project
+ end
+
+ link = label_filter_path(subject, label, type: type)
if block_given?
link_to link, class: css_class, &block
@@ -40,16 +46,16 @@ module LabelsHelper
end
end
- def label_filter_path(label, type: issue)
- case label
- when GroupLabel
+ def label_filter_path(subject, label, type: issue)
+ case subject
+ when Group
send("#{type.to_s.pluralize}_group_path",
- label.group,
+ subject,
label_name: [label.name])
- else
+ when Project
send("namespace_project_#{type.to_s.pluralize}_path",
- label.project.namespace,
- label.project,
+ subject.namespace,
+ subject,
label_name: [label.name])
end
end