The Framework Code

twigs/surround/navbar.twig

File List

    <nav class="navbar navbar-expand-md navbar-dark bg-dark sticky-top">
        {% if action == 'home' %}
            <span class="navbar-brand">{{fwurls.sitename.value}}</span>
        {% else %}
            <a class="navbar-brand" href="{{base}}/">{{fwurls.sitename.value}}</a>
        {% endif %}
        <button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbar" aria-controls="navbar" aria-expanded="false" aria-label="Toggle navigation">
            <span class="navbar-toggler-icon"></span>
        </button>

        <div class="collapse navbar-collapse" id="navbar">
            <ul class="navbar-nav mr-auto">
                    <li class="nav-item{{action == 'about' ? ' active'}}"><a class="nav-link" href="{{base}}/about/">About</a></li>
                    <li class="nav-item{{action == 'contact' ? ' active'}}"><a class="nav-link" href="{{base}}/contact/">Contact</a></li>
                    {% if context.hasAdmin %}
                        <li class="nav-item dropdown{{action == 'admin' ? ' active'}}">
                            <a href="#" class="nav-link dropdown-toggle" id="ddadmin" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">Admin<b class="caret"></b></a>
                            <div class="dropdown-menu" aria-labelledby="ddadmin">
                                <a class="dropdown-item" href="{{base}}/admin/pages/">Pages</a>
                                <div class="dropdown-divider"></div>
                                <a class="dropdown-item" href="{{base}}/admin/users/">Users</a>
                                <a class="dropdown-item" href="{{base}}/admin/contexts/">Contexts</a>
                                <a class="dropdown-item" href="{{base}}/admin/roles/">Roles</a>
                                <div class="dropdown-divider"></div>
                                <a class="dropdown-item" href="{{base}}/admin/forms/">Forms</a>
                                <div class="dropdown-divider"></div>
                                <a class="dropdown-item" href="{{base}}/admin/beans/">Beans</a>
                                <div class="dropdown-divider"></div>
                                <a class="dropdown-item" href="{{base}}/admin/config/">Config</a>
                                <a class="dropdown-item" href="{{base}}/admin/checksum/">Checksum</a>
                                <a class="dropdown-item" href="{{base}}/admin/update/">Update</a>
                                <a class="dropdown-item" href="{{base}}/admin/offline/">Go Offline</a>
                            </div>
                        </li>
                    {% endif %}
                    {% if context.hasDeveloper %}
                        <li class="nav-item dropdown{{action == 'developer' ? ' active'}}">
                            <a href="#" class="nav-link dropdown-toggle" id="dddevel" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">Developer<b class="caret"></b></a>
                            <div class="dropdown-menu" aria-labelledby="dddevel">
                                <a class="dropdown-item" href="{{base}}/devel/ajax/">AJAX</a>
                                <div class="dropdown-divider"></div>
                                <a class="dropdown-item" href="{{base}}/devel/hack/">Run Code</a>
                                <div class="dropdown-divider"></div>
                                <a class="dropdown-item" href="{{base}}/admin/info/">PHP Info</a>
                            </div>
                        </li>
                        <li class="nav-item dropdown{{action == 'test' ? ' active'}}">
                            <a href="#" class="nav-link dropdown-toggle" id="ddtest" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">Testing<b class="caret"></b></a>
                            <div class="dropdown-menu" aria-labelledby="ddtest">
                                <a class="dropdown-item" href="{{base}}/devel/test/page/">Test Page</a>
                                <a class="dropdown-item" href="{{base}}/test/">Page Access Check Test</a>
                                <a class="dropdown-item" href="{{base}}/devel/test/ajax/">Ajax Test</a>
                                <a class="dropdown-item" href="{{base}}/devel/test/upload/">Upload Test</a>
                                <div class="dropdown-divider"></div>
                                <a class="dropdown-item" href="{{base}}/devel/test/fail/">Fail</a>
                                <a class="dropdown-item" href="{{base}}/devel/test/toss/">Throw</a>
                                <div class="dropdown-divider"></div>
                                <a class="dropdown-item" href="{{base}}/devel/test/mail/">Test mail</a>
                                <div class="dropdown-divider"></div>
                                <a class="dropdown-item" href="{{base}}/devel/test/get/">Form Get</a>
                                <a class="dropdown-item" href="{{base}}/devel/test/post/">Form Post</a>
                                <a class="dropdown-item" href="{{base}}/devel/test/put/">Form Put</a>
                                <a class="dropdown-item" href="{{base}}/devel/test/file/">Form File</a>
                                <a class="dropdown-item" href="{{base}}/devel/test/cookie/">Form Cookie</a>
                            </div>
                        </li>
                    {% endif %}
            </ul>
            {% if context.hasUser %}
                <ul class="nav navbar-nav navbar-right">
                    <li class="nav-item dropdown">
                        <a href="#" class="nav-link dropdown-toggle" id="dduser" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"><i class="fas fa-user{% if context.hasadmin %} text-danger{% endif %}"></i><b class="caret"></b></a>
                        <div class="dropdown-menu dropdown-menu-right" aria-labelledby="dduser">
                            <a class="dropdown-item" href="{{base}}/logout/">Logout</a>
                            <a class="dropdown-item" href="{{base}}/profile/">Profile</a>
                        </div>
                    </li>
                </ul>
            {% endif %}
            <form class="form-inline my-2 my-lg-0" action="{{base}}/search/" method="get">
                <input class="form-control mr-sm-2" type="text" name="search" placeholder="Search" aria-label="Search">
                <button class="btn btn-outline-success my-2 my-sm-0" type="submit" title="Search"><i class="fas fa-search"></i></button>
            </form>
        </div>
    </nav>
    {% if breadcrumbs is defined %}
        <nav aria-label="breadcrumb" class="position-fixed w-100 z-1k">
          <ol class="breadcrumb">
            {% for l in breadcrumbs %}
                <li class="breadcrumb-item{% if loop.last %} active{% endif %}" aria-current="page">{% if not loop.last %}<a href="{{l.link}}">{% endif %}{{l.text|raw}}{% if not loop.last %}</a>{% endif %}</li>
            {% endfor %}
          </ol>
        </nav>
    {% endif %}