Commit db00c6c6 authored by Tanya Pazitny's avatar Tanya Pazitny Committed by Clement Ho

Fix link issues with labels

* On the project labels page, the label itself should not be clickable.
* On the group labels page, the links for Issues and Merge Requests should be shown.
parent f1b3db3c
- 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)
.label-description
.append-right-default.prepend-left-default
......@@ -22,5 +20,6 @@
%li.label-link-item.inline
= link_to_label(label, subject: subject, type: :merge_request) { _('Merge requests') }
- if force_priority
·
%li.label-link-item.priority-badge.js-priority-badge.inline.prepend-left-10
.label-badge.label-badge-blue= _('Prioritized label')
---
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
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
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment