summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorClement Ho <clemmakesapps@gmail.com>2019-04-18 15:51:57 +0000
committerClement Ho <clemmakesapps@gmail.com>2019-04-18 15:51:57 +0000
commitc5df59663dfaff0d196bad0efdde75336b98ea6a (patch)
tree2ee5f3e4b436e6842a358e32ecfb181f7a771bb5
parentf1b3db3cf237daf8da481b594afeca9bc2df276f (diff)
parentdb00c6c6d89135583bad1ce44fa30fa7ee7b14b1 (diff)
downloadgitlab-ce-c5df59663dfaff0d196bad0efdde75336b98ea6a.tar.gz
Merge branch 'gitlab-issue-54894' into 'master'
Fix link issues with labels on project/group labels pages See merge request gitlab-org/gitlab-ce!24060
-rw-r--r--app/views/shared/_label_row.html.haml11
-rw-r--r--changelogs/unreleased/gitlab-issue-54894.yml6
-rw-r--r--spec/views/shared/_label_row.html.haml.rb32
3 files changed, 43 insertions, 6 deletions
diff --git a/app/views/shared/_label_row.html.haml b/app/views/shared/_label_row.html.haml
index 6651f12f6de..9d1648fbf70 100644
--- a/app/views/shared/_label_row.html.haml
+++ b/app/views/shared/_label_row.html.haml
@@ -1,13 +1,11 @@
- subject = local_assigns[:subject]
- force_priority = local_assigns.fetch(:force_priority, false)
-- show_label_issues_link = defined?(@project) && show_label_issuables_link?(label, :issues, project: @project)
-- show_label_merge_requests_link = defined?(@project) && show_label_issuables_link?(label, :merge_requests, project: @project)
+- subject_or_group_defined = defined?(@project) || defined?(@group)
+- show_label_issues_link = subject_or_group_defined && show_label_issuables_link?(label, :issues, project: @project)
+- show_label_merge_requests_link = subject_or_group_defined && show_label_issuables_link?(label, :merge_requests, project: @project)
.label-name
- - if defined?(@project)
- = link_to_label(label, subject: @project, tooltip: false)
- - else
- = render_label(label, tooltip: false)
+ = render_label(label, tooltip: false)
.label-description
.append-right-default.prepend-left-default
- if label.description.present?
@@ -22,5 +20,6 @@
%li.label-link-item.inline
= link_to_label(label, subject: subject, type: :merge_request) { _('Merge requests') }
- if force_priority
+ &middot;
%li.label-link-item.priority-badge.js-priority-badge.inline.prepend-left-10
.label-badge.label-badge-blue= _('Prioritized label')
diff --git a/changelogs/unreleased/gitlab-issue-54894.yml b/changelogs/unreleased/gitlab-issue-54894.yml
new file mode 100644
index 00000000000..513c0163c0e
--- /dev/null
+++ b/changelogs/unreleased/gitlab-issue-54894.yml
@@ -0,0 +1,6 @@
+---
+title: Fix some label links not appearing on group labels page and label title being
+ a link on project labels page
+merge_request: 24060
+author: Tanya Pazitny
+type: fixed
diff --git a/spec/views/shared/_label_row.html.haml.rb b/spec/views/shared/_label_row.html.haml.rb
new file mode 100644
index 00000000000..a58d5efc1e3
--- /dev/null
+++ b/spec/views/shared/_label_row.html.haml.rb
@@ -0,0 +1,32 @@
+require 'spec_helper'
+
+describe 'shared/_label_row.html.haml' do
+ label_types = {
+ 'project label': :label,
+ 'group label': :group_label
+ }
+
+ label_types.each do |label_type, label_factory|
+ let!(:label) { create(label_factory) }
+
+ context "for a #{label_type}" do
+ it 'has a non-linked label title' do
+ render 'shared/label_row', label: label
+
+ expect(rendered).not_to have_css('a', text: label.title)
+ end
+
+ it "has Issues link for #{label_type}" do
+ render 'shared/label_row', label: label
+
+ expect(rendered).to have_css('a', text: 'Issues')
+ end
+
+ it "has Merge request link for #{label_type}" do
+ render 'shared/label_row', label: label
+
+ expect(rendered).to have_css('a', text: 'Merge requests')
+ end
+ end
+ end
+end