Commit 0addef2e authored by Tim Zallmann's avatar Tim Zallmann

Merge branch 'breadcrumb-item-links' into 'master'

Fixed breadcrumb title not linking

Closes #38059

See merge request gitlab-org/gitlab-ce!14532
parents a481337b d0737b18
...@@ -10,12 +10,8 @@ module BreadcrumbsHelper ...@@ -10,12 +10,8 @@ module BreadcrumbsHelper
def breadcrumb_title_link def breadcrumb_title_link
return @breadcrumb_link if @breadcrumb_link return @breadcrumb_link if @breadcrumb_link
if controller.available_action?(:index)
url_for(action: "index")
else
request.path request.path
end end
end
def breadcrumb_title(title) def breadcrumb_title(title)
return if defined?(@breadcrumb_title) return if defined?(@breadcrumb_title)
......
...@@ -16,5 +16,5 @@ ...@@ -16,5 +16,5 @@
= breadcrumb_list_item link_to(extra[:text], extra[:link]) = breadcrumb_list_item link_to(extra[:text], extra[:link])
= render "layouts/nav/breadcrumbs/collapsed_dropdown", location: :after = render "layouts/nav/breadcrumbs/collapsed_dropdown", location: :after
%li %li
%h2.breadcrumbs-sub-title= @breadcrumb_title %h2.breadcrumbs-sub-title= link_to @breadcrumb_title, breadcrumb_title_link
= yield :header_content = yield :header_content
---
title: Fixed issue/merge request breadcrumb titles not having links
merge_request:
author:
type: fixed
...@@ -131,6 +131,14 @@ describe 'Issues' do ...@@ -131,6 +131,14 @@ describe 'Issues' do
end end
describe 'Issue info' do 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 it 'excludes award_emoji from comment count' do
issue = create(:issue, author: user, assignees: [user], project: project, title: 'foobar') issue = create(:issue, author: user, assignees: [user], project: project, title: 'foobar')
create(:award_emoji, awardable: issue) create(:award_emoji, awardable: issue)
......
...@@ -40,7 +40,7 @@ describe 'User updates wiki page' do ...@@ -40,7 +40,7 @@ describe 'User updates wiki page' do
expect(current_path).to include('one/two/three-test') expect(current_path).to include('one/two/three-test')
expect(find('.wiki-pages')).to have_content('Three') expect(find('.wiki-pages')).to have_content('Three')
click_on('Three') first(:link, text: 'Three').click
expect(find('.nav-text')).to have_content('Three') expect(find('.nav-text')).to have_content('Three')
......
...@@ -34,7 +34,7 @@ describe 'User views a wiki page' do ...@@ -34,7 +34,7 @@ describe 'User views a wiki page' do
it 'shows the history of a page that has a path', :js do it 'shows the history of a page that has a path', :js do
expect(current_path).to include('one/two/three-test') expect(current_path).to include('one/two/three-test')
click_on('Three') first(:link, text: 'Three').click
click_on('Page history') click_on('Page history')
expect(current_path).to include('one/two/three-test') expect(current_path).to include('one/two/three-test')
...@@ -48,7 +48,7 @@ describe 'User views a wiki page' do ...@@ -48,7 +48,7 @@ describe 'User views a wiki page' do
expect(current_path).to include('one/two/three-test') expect(current_path).to include('one/two/three-test')
expect(find('.wiki-pages')).to have_content('Three') expect(find('.wiki-pages')).to have_content('Three')
click_on('Three') first(:link, text: 'Three').click
expect(find('.nav-text')).to have_content('Three') expect(find('.nav-text')).to have_content('Three')
......
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