2017 © Pedro Peláez
 

library laravel-active-menu

Blade directives to manage menu states in a clean an easy way.

image

sahibalejandro/laravel-active-menu

Blade directives to manage menu states in a clean an easy way.

  • Wednesday, September 7, 2016
  • by sahibalejandro
  • Repository
  • 1 Watchers
  • 2 Stars
  • 43 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 1 Forks
  • 0 Open issues
  • 5 Versions
  • 2 % Grown

The README.md

Laravel Active Menu

Build Status Latest Stable Version Total Downloads License, (*1)

Blade directives for Laravel 5.1+ to manage menu states in a clean an easy way., (*2)

Install

composer require sahibalejandro/laravel-active-menu

Usage

Call @activate(...) to specify the activated menu:, (*3)

@activate('security_settings')

Now call @active(...) directive to know if a specified menu is active:, (*4)

<ul>
    <li>
        <a href="/settings">Settings</a>
        <ul class="dropdown">
            <li class="@active('security_settings')">
                <a href="/settings/security">Security</a>
            </li>
        </ul>
    </li>
</ul>

This directive will print the string active if the given menu is activated. The example above will result on the following HTML:, (*5)

<ul>
    <li>
        <a href="/settings">Settings</a>
        <ul class="dropdown">
            <li class="active">
                <a href="/settings/security">Security</a>
            </li>
        </ul>
    </li>
</ul>

Now just add a li.active a { ... } styles to your CSS and you're ready., (*6)

Using dot-notation

Use dot-notation to activate the menu cascade up, for example, using this directive:, (*7)

@activate('settings.security')

This will activate settings and settings.security, so the following directives will print the string active:, (*8)

@active('settings')
@active('settings.security')

Change the class name

You can change the class name passing it as a second parameter:, (*9)

@active('user.account', 'link-active')

But I really recomend you stick to the convention and use the default value., (*10)

The Versions

07/09 2016

dev-master

9999999-dev

Blade directives to manage menu states in a clean an easy way.

  Sources   Download

MIT

The Development Requires

by Sahib J. Leo

07/09 2016

1.2.1

1.2.1.0

Blade directives to manage menu states in a clean an easy way.

  Sources   Download

MIT

The Development Requires

by Sahib J. Leo

07/09 2016

1.2.0

1.2.0.0

Blade directives to manage menu states in a clean an easy way.

  Sources   Download

MIT

The Development Requires

by Sahib J. Leo

09/08 2016

1.1.0

1.1.0.0

Blade directives to manage menu states in a clean an easy way.

  Sources   Download

MIT

The Development Requires

by Sahib J. Leo

09/08 2016

1.0.0

1.0.0.0

Blade directives to manage menu states in a clean an easy way.

  Sources   Download

MIT

The Development Requires

by Sahib J. Leo