From 05844d8b471b98c6b3251006aebfc78b97d88ac6 Mon Sep 17 00:00:00 2001 From: Phil Hughes Date: Wed, 27 Sep 2017 16:22:12 +0100 Subject: Fixed breadcrumb title not linking This fixes the breadcrumb titles not having links. This was a regression in the updated breadcrumbs introduced in 10.0. This introduces the link for all pages rather than selectively doing it. This will cover issues, merge requests, pipelines, jobs etc. Closes #38059 --- app/helpers/breadcrumbs_helper.rb | 6 +----- app/views/layouts/nav/_breadcrumbs.html.haml | 2 +- changelogs/unreleased/breadcrumb-item-links.yml | 5 +++++ spec/features/issues_spec.rb | 8 ++++++++ 4 files changed, 15 insertions(+), 6 deletions(-) create mode 100644 changelogs/unreleased/breadcrumb-item-links.yml diff --git a/app/helpers/breadcrumbs_helper.rb b/app/helpers/breadcrumbs_helper.rb index ee1b7ed083e..87d2a47f6cb 100644 --- a/app/helpers/breadcrumbs_helper.rb +++ b/app/helpers/breadcrumbs_helper.rb @@ -10,11 +10,7 @@ module BreadcrumbsHelper def breadcrumb_title_link return @breadcrumb_link if @breadcrumb_link - if controller.available_action?(:index) - url_for(action: "index") - else - request.path - end + request.path end def breadcrumb_title(title) diff --git a/app/views/layouts/nav/_breadcrumbs.html.haml b/app/views/layouts/nav/_breadcrumbs.html.haml index 7bd3f5306a2..002922e13f1 100644 --- a/app/views/layouts/nav/_breadcrumbs.html.haml +++ b/app/views/layouts/nav/_breadcrumbs.html.haml @@ -16,5 +16,5 @@ = breadcrumb_list_item link_to(extra[:text], extra[:link]) = render "layouts/nav/breadcrumbs/collapsed_dropdown", location: :after %li - %h2.breadcrumbs-sub-title= @breadcrumb_title + %h2.breadcrumbs-sub-title= link_to @breadcrumb_title, breadcrumb_title_link = yield :header_content diff --git a/changelogs/unreleased/breadcrumb-item-links.yml b/changelogs/unreleased/breadcrumb-item-links.yml new file mode 100644 index 00000000000..9b66456efca --- /dev/null +++ b/changelogs/unreleased/breadcrumb-item-links.yml @@ -0,0 +1,5 @@ +--- +title: Fixed issue/merge request breadcrumb titles not having links +merge_request: +author: +type: fixed diff --git a/spec/features/issues_spec.rb b/spec/features/issues_spec.rb index fb763c93c66..b4222edbcd0 100644 --- a/spec/features/issues_spec.rb +++ b/spec/features/issues_spec.rb @@ -131,6 +131,14 @@ describe 'Issues' do end describe 'Issue info' do + it 'links to current issue in breadcrubs' do + issue = create(:issue, project: project) + + visit project_issue_path(project, issue) + + expect(find('.breadcrumbs-sub-title a')[:href]).to end_with(issue_path(issue)) + end + it 'excludes award_emoji from comment count' do issue = create(:issue, author: user, assignees: [user], project: project, title: 'foobar') create(:award_emoji, awardable: issue) -- cgit v1.2.3