summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJacob Schatz <jschatz@gitlab.com>2016-06-29 21:32:41 +0000
committerRobert Speicher <rspeicher@gmail.com>2016-06-30 15:22:41 -0400
commiteb7356a4f052ee4c092a1e48adf9af6c0f7ba4a2 (patch)
tree2cb8c7d46f07b6ae184a1d7e66915246976c782d
parentaae4444409a6df29ef5689622ccbcc47cae075c4 (diff)
downloadgitlab-ce-eb7356a4f052ee4c092a1e48adf9af6c0f7ba4a2.tar.gz
Merge branch 'label-filter-path-fix' into 'master'
Fixed URL on label button when filtering ## What does this MR do? Gives the filtered labels the correct URL. Previously they tried to link to `labels#show` whereas now it links to the correct filter path. ## What are the relevant issue numbers? Closes #19005 See merge request !4897 (cherry picked from commit d3d9df5a10d62cc90e9e6c22a6637587c393bb72)
-rw-r--r--CHANGELOG1
-rw-r--r--app/helpers/labels_helper.rb12
-rw-r--r--app/views/shared/_labels_row.html.haml2
3 files changed, 10 insertions, 5 deletions
diff --git a/CHANGELOG b/CHANGELOG
index 0636c8b0b86..05978729d89 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -6,6 +6,7 @@ v 8.9.4
- Fixed search field blur not removing focus. !4704
- Resolve "Sub nav isn't showing on file view". !4890
- Fixes middle click and double request when navigating through the file browser. !4891
+ - Fixed URL on label button when filtering. !4897
v 8.9.3
- Fix encrypted data backwards compatibility after upgrading attr_encrypted gem. !4963
diff --git a/app/helpers/labels_helper.rb b/app/helpers/labels_helper.rb
index 5074e645769..5e9f5837101 100644
--- a/app/helpers/labels_helper.rb
+++ b/app/helpers/labels_helper.rb
@@ -34,10 +34,7 @@ module LabelsHelper
# Returns a String
def link_to_label(label, project: nil, type: :issue, tooltip: true, css_class: nil, &block)
project ||= @project || label.project
- link = send("namespace_project_#{type.to_s.pluralize}_path",
- project.namespace,
- project,
- label_name: [label.name])
+ link = label_filter_path(project, label, type: type)
if block_given?
link_to link, class: css_class, &block
@@ -46,6 +43,13 @@ 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])
+ end
+
def project_label_names
@project.labels.pluck(:title)
end
diff --git a/app/views/shared/_labels_row.html.haml b/app/views/shared/_labels_row.html.haml
index 87028ececd4..5507a05f6c1 100644
--- a/app/views/shared/_labels_row.html.haml
+++ b/app/views/shared/_labels_row.html.haml
@@ -1,6 +1,6 @@
- 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)}" }
- = 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",
style: "background-color: #{label.color};",
title: escape_once(label.description),