Commit 6827b556 authored by Dennis Tang's avatar Dennis Tang 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 2a777b77
- subject = local_assigns[:subject] - subject = local_assigns[:subject]
- force_priority = local_assigns.fetch(:force_priority, false) - force_priority = local_assigns.fetch(:force_priority, false)
- show_label_epics_link = defined?(@group) && @group&.feature_available?(:epics) - subject_or_group_defined = defined?(@project) || defined?(@group)
- show_label_issues_link = defined?(@project) && show_label_issuables_link?(label, :issues, project: @project) - show_label_issues_link = subject_or_group_defined && show_label_issuables_link?(label, :issues, project: @project)
- show_label_merge_requests_link = defined?(@project) && show_label_issuables_link?(label, :merge_requests, project: @project) - show_label_merge_requests_link = subject_or_group_defined && show_label_issuables_link?(label, :merge_requests, project: @project)
.label-name .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 .label-description
.append-right-default.prepend-left-default .append-right-default.prepend-left-default
...@@ -15,18 +12,15 @@ ...@@ -15,18 +12,15 @@
.description-text .description-text
= markdown_field(label, :description) = markdown_field(label, :description)
%ul.label-links %ul.label-links
- if show_label_epics_link
%li.label-link-item.inline
= link_to 'Epics', group_epics_path(@group, label_name:[label.name])
·
- if show_label_issues_link - if show_label_issues_link
%li.label-link-item.inline %li.label-link-item.inline
= link_to_label(label, subject: subject) { 'Issues' } = link_to_label(label, subject: subject) { 'Issues' }
·
- if show_label_merge_requests_link - if show_label_merge_requests_link
·
%li.label-link-item.inline %li.label-link-item.inline
= link_to_label(label, subject: subject, type: :merge_request) { _('Merge requests') } = link_to_label(label, subject: subject, type: :merge_request) { _('Merge requests') }
·
- if force_priority - if force_priority
·
%li.label-link-item.priority-badge.js-priority-badge.inline.prepend-left-10 %li.label-link-item.priority-badge.js-priority-badge.inline.prepend-left-10
.label-badge.label-badge-blue= _('Prioritized label') .label-badge.label-badge-blue= _('Prioritized label')
= render_if_exists 'shared/label_row_epics_link', label: 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
- show_label_epics_link = defined?(@group) && @group&.feature_available?(:epics)
- if show_label_epics_link
·
%li.label-link-item.inline
= link_to 'Epics', group_epics_path(@group, label_name:[label.name])
# frozen_string_literal: true
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