Commit 4cc5f3f1 authored by Jan Provaznik's avatar Jan Provaznik

Merge branch 'ag-325650-admin-license-nav-bar-does-not-display-active-status' into 'master'

Add controller path to helper to display active state

See merge request gitlab-org/gitlab!57214
parents d4bb48b8 b7abc7eb
...@@ -2,6 +2,10 @@ ...@@ -2,6 +2,10 @@
module Admin module Admin
module NavbarHelper module NavbarHelper
def navbar_controller_path
cloud_license_enabled? ? 'admin/cloud_licenses' : 'admin/licenses'
end
def navbar_item_name def navbar_item_name
cloud_license_enabled? ? _('Cloud License') : _('License') cloud_license_enabled? ? _('Cloud License') : _('License')
end end
......
= nav_link(controller: controller) do = nav_link(controller: navbar_controller_path) do
= link_to navbar_item_path, class: "qa-link-license-menu" do = link_to navbar_item_path, class: "qa-link-license-menu" do
.nav-icon-container .nav-icon-container
= sprite_icon('license') = sprite_icon('license')
......
---
title: Fix active state for license link in navigation bar
merge_request: 57214
author:
type: fixed
...@@ -10,6 +10,10 @@ RSpec.describe Admin::NavbarHelper do ...@@ -10,6 +10,10 @@ RSpec.describe Admin::NavbarHelper do
stub_application_setting(cloud_license_enabled: true) stub_application_setting(cloud_license_enabled: true)
end end
it 'returns the correct controller path' do
expect(helper.navbar_controller_path).to eq('admin/cloud_licenses')
end
it 'returns the correct navbar item name' do it 'returns the correct navbar item name' do
expect(helper.navbar_item_name).to eq('Cloud License') expect(helper.navbar_item_name).to eq('Cloud License')
end end
...@@ -24,6 +28,10 @@ RSpec.describe Admin::NavbarHelper do ...@@ -24,6 +28,10 @@ RSpec.describe Admin::NavbarHelper do
stub_application_setting(cloud_license_enabled: false) stub_application_setting(cloud_license_enabled: false)
end end
it 'returns the correct controller path' do
expect(helper.navbar_controller_path).to eq('admin/licenses')
end
it 'returns the correct navbar item name' do it 'returns the correct navbar item name' do
expect(helper.navbar_item_name).to eq('License') expect(helper.navbar_item_name).to eq('License')
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