Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sample implementation should use active link detection #63

Open
gbrock opened this issue Aug 18, 2015 · 1 comment
Open

Sample implementation should use active link detection #63

gbrock opened this issue Aug 18, 2015 · 1 comment

Comments

@gbrock
Copy link

gbrock commented Aug 18, 2015

Here's my alteration to the Bootstrap 3 sample code for items.blade.php from the wiki (not the cleanest, I know, but it works):

<ul class="{{ $class or 'nav nav-tabs' }}">
@foreach($items as $item)
    <?php if($item->hasChildren()) { $item->attribute('class', $item->attribute('class') . ' dropdown'); } ?>
    <li {!! $item->attributes() !!}>
        @if($item->link) <a @if($item->hasChildren()) class="dropdown-toggle" data-toggle="dropdown" @endif href="{{ $item->url() }}">
            {!! $item->title !!}
            @if($item->hasChildren()) <b class="caret"></b> @endif
        </a>
        @else
            {{$item->title}}
        @endif
        @if($item->hasChildren())
            <ul class="{{ $submenu_class or 'dropdown-menu' }})">
                @foreach($item->children() as $child)
                    <li><a href="{{ $child->url() }}">{{ $child->title }}</a></li>
                @endforeach
            </ul>
        @endif
    </li>
    @if($item->divider)
        <li{{\HTML::attributes($item->divider)}}></li>
    @endif
@endforeach
</ul>
@vedmant
Copy link

vedmant commented Sep 7, 2015

+1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants