Commit fad2edcb authored by Tom Quirk's avatar Tom Quirk Committed by Gabriel Mazetto

Create wiki link partial and use in all sidebars

Use wiki link partial in group and project sidebars
parent 02814027
......@@ -124,18 +124,7 @@
= render 'layouts/nav/sidebar/analytics_links', links: group_analytics_navbar_links(@group, current_user)
- if group_sidebar_link?(:wiki)
- wiki_url = @group.wiki.web_url
= nav_link(controller: :wikis) do
= link_to wiki_url, class: 'shortcuts-wiki', data: { qa_selector: 'wiki_link' } do
.nav-icon-container
= sprite_icon('book')
%span.nav-item-name
= _('Wiki')
%ul.sidebar-sub-level-items.is-fly-out-only
= nav_link(controller: :wikis, html_options: { class: "fly-out-top-item" } ) do
= link_to wiki_url do
%strong.fly-out-top-item-name
= _('Wiki')
= render 'layouts/nav/sidebar/wiki_link', wiki_url: @group.wiki.web_url
- if group_sidebar_link?(:group_members)
= nav_link(path: 'group_members#index') do
......
......@@ -308,18 +308,7 @@
= _('Confluence')
- if project_nav_tab? :wiki
- wiki_url = wiki_path(@project.wiki)
= nav_link(controller: :wikis) do
= link_to wiki_url, class: 'shortcuts-wiki', data: { qa_selector: 'wiki_link' } do
.nav-icon-container
= sprite_icon('book')
%span.nav-item-name
= _('Wiki')
%ul.sidebar-sub-level-items.is-fly-out-only
= nav_link(controller: :wikis, html_options: { class: "fly-out-top-item" } ) do
= link_to wiki_url do
%strong.fly-out-top-item-name
= _('Wiki')
= render 'layouts/nav/sidebar/wiki_link', wiki_url: wiki_path(@project.wiki)
- if project_nav_tab?(:external_wiki)
- external_wiki_url = @project.external_wiki.external_wiki_url
......
= nav_link(controller: :wikis) do
= link_to wiki_url, class: 'shortcuts-wiki', data: { qa_selector: 'wiki_link' } do
.nav-icon-container
= sprite_icon('book')
%span.nav-item-name
= _('Wiki')
%ul.sidebar-sub-level-items.is-fly-out-only
= nav_link(controller: :wikis, html_options: { class: "fly-out-top-item" } ) do
= link_to wiki_url do
%strong.fly-out-top-item-name
= _('Wiki')
......@@ -200,6 +200,39 @@ RSpec.describe 'layouts/nav/sidebar/_group' do
end
end
describe 'wiki tab' do
let(:can_read_wiki) { true }
let_it_be(:current_user) { create(:user) }
before do
group.add_guest(current_user)
allow(view).to receive(:current_user).and_return(current_user)
allow(view).to receive(:can?).with(current_user, :read_wiki, group).and_return(can_read_wiki)
# TODO can be removed with https://gitlab.com/gitlab-org/gitlab/-/issues/207888
stub_feature_flags(group_wiki: true)
end
describe 'when wiki is available to user' do
it 'shows the wiki tab with the wiki internal link' do
render
expect(rendered).to have_link('Wiki', href: group.wiki.web_url)
end
end
describe 'when wiki is unavailable to user' do
let(:can_read_wiki) { false }
it 'does not show the wiki tab' do
render
expect(rendered).not_to have_link('Wiki', href: group.wiki.web_url)
end
end
end
describe 'iterations link' do
let_it_be(:current_user) { create(:user) }
......
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