Commit 7819a2e8 authored by Justin Ho's avatar Justin Ho

Remove Admin > Settings > Templates from sidenav

When the Templates feature is not included in the
license, we should not be showing the link in the
sidebar since it will lead to an empty page.
parent 79bec796
......@@ -245,7 +245,7 @@
= link_to repository_admin_application_settings_path, title: _('Repository'), class: 'qa-admin-settings-repository-item' do
%span
= _('Repository')
- if template_exists?('admin/application_settings/templates')
- if template_exists?('admin/application_settings/templates') && License.feature_available?(:custom_file_templates)
= nav_link(path: 'application_settings#templates') do
= link_to templates_admin_application_settings_path, title: _('Templates'), class: 'qa-admin-settings-template-item' do
%span
......
---
title: Remove Admin > Settings > Templates link from sidenav when insufficient license
merge_request: 27172
author:
type: fixed
# frozen_string_literal: true
require 'spec_helper'
describe 'layouts/nav/sidebar/_admin' do
context 'on settings' do
context 'when templates partial is present' do
before do
stub_licensed_features(custom_file_templates: custom_file_templates)
render
end
context 'license with custom_file_templates feature' do
let(:custom_file_templates) { true }
it 'includes Templates link' do
expect(rendered).to have_link('Templates', href: '/admin/application_settings/templates')
end
end
context 'license without custom_file_templates feature' do
let(:custom_file_templates) { false }
it 'does not include Templates link' do
expect(rendered).not_to have_link('Templates', href: '/admin/application_settings/templates')
end
end
end
end
end
......@@ -91,4 +91,23 @@ describe 'layouts/nav/sidebar/_admin' do
it_behaves_like 'page has active tab', 'Monitoring'
it_behaves_like 'page has active sub tab', 'Background Jobs'
end
context 'on settings' do
it 'includes General link' do
render
expect(rendered).to have_link('General', href: general_admin_application_settings_path)
end
context 'when templates partial is not present' do
before do
allow(view).to receive(:template_exists?).and_call_original
allow(view).to receive(:template_exists?).with('admin/application_settings/templates') { false }
end
it 'does not include Templates link' do
expect(rendered).not_to have_link('Templates', href: '/admin/application_settings/templates')
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