Commit b7abc7eb authored by Angelo Gulina's avatar Angelo Gulina Committed by Jan Provaznik

Add controller path to helper to display active state

parent c3228bff
......@@ -2,6 +2,10 @@
module Admin
module NavbarHelper
def navbar_controller_path
cloud_license_enabled? ? 'admin/cloud_licenses' : 'admin/licenses'
end
def navbar_item_name
cloud_license_enabled? ? _('Cloud License') : _('License')
end
......
= nav_link(controller: controller) do
= nav_link(controller: navbar_controller_path) do
= link_to navbar_item_path, class: "qa-link-license-menu" do
.nav-icon-container
= 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
stub_application_setting(cloud_license_enabled: true)
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
expect(helper.navbar_item_name).to eq('Cloud License')
end
......@@ -24,6 +28,10 @@ RSpec.describe Admin::NavbarHelper do
stub_application_setting(cloud_license_enabled: false)
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
expect(helper.navbar_item_name).to eq('License')
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