change id for tag in navbar plugins
This commit is contained in:
@@ -30,7 +30,7 @@ register 'register_template_path' => sub {
|
|||||||
register 'register_navbar_item' => sub {
|
register 'register_navbar_item' => sub {
|
||||||
my ($self, $config) = plugin_args(@_);
|
my ($self, $config) = plugin_args(@_);
|
||||||
|
|
||||||
if (!length $config->{id}
|
if (!length $config->{tag}
|
||||||
or !length $config->{path}
|
or !length $config->{path}
|
||||||
or !length $config->{label}) {
|
or !length $config->{label}) {
|
||||||
|
|
||||||
@@ -39,7 +39,7 @@ register 'register_navbar_item' => sub {
|
|||||||
}
|
}
|
||||||
|
|
||||||
foreach my $item (@{ setting('navbar_items') }) {
|
foreach my $item (@{ setting('navbar_items') }) {
|
||||||
if ($item->{id} eq $config->{id}) {
|
if ($item->{tag} eq $config->{tag}) {
|
||||||
$item = $config;
|
$item = $config;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ use Dancer::Plugin::DBIC;
|
|||||||
use App::Netdisco::Web::Plugin;
|
use App::Netdisco::Web::Plugin;
|
||||||
|
|
||||||
register_navbar_item({
|
register_navbar_item({
|
||||||
id => 'inventory',
|
tag => 'inventory',
|
||||||
path => '/inventory',
|
path => '/inventory',
|
||||||
label => 'Inventory',
|
label => 'Inventory',
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -52,7 +52,7 @@
|
|||||||
[% IF session.user %]
|
[% IF session.user %]
|
||||||
<ul class="nav">
|
<ul class="nav">
|
||||||
[% FOREACH ni IN settings.navbar_items %]
|
[% FOREACH ni IN settings.navbar_items %]
|
||||||
<li[% ' class="active"' IF vars.nav == ni.id %]>
|
<li[% ' class="active"' IF vars.nav == ni.tag %]>
|
||||||
<a href="[% uri_for(ni.path) %]">[% ni.label | html_entity %]</a>
|
<a href="[% uri_for(ni.path) %]">[% ni.label | html_entity %]</a>
|
||||||
</li>
|
</li>
|
||||||
[% END %]
|
[% END %]
|
||||||
|
|||||||
Reference in New Issue
Block a user