Blob Blame History Raw
% # vim:set sw=4 ts=4 sts=4 ft=html.epl expandtab:
<nav class="navbar" x-data="{ route: '<%= current_route %>', langDpdwn: false, showMenu: false, userDpdwn: false }">
    <ul :class="{ 'show-menu': showMenu }">
        <li class="navbrand">
            <a href="<%= url_for('/') %>">
                &nbsp;
                <img src="<%= url_for('/img/lufi-min.png') %>" alt="logo">
                <%= config('instance_name') %>
            </a>
            <a
                href="#"
                class="hamburger"
                @click.prevent="showMenu = !showMenu">
                %= include 'icons/hamburger.svg'
            </a>
        </li>
        <li>
            <a href="<%= $self->config('report') %>">
                <%= l('Report file') %>
            </a>
        </li>
        % if ((!defined(config('ldap')) && !defined(config('htpasswd'))) || is_user_authenticated()) {
            <li :class="{ 'active': route === 'index' }">
                <a href="<%= url_for('/') %>">
                    <%= l('Upload files') %>
                </a>
            </li>
            % if ((!defined(config('ldap')) && !defined(config('htpasswd')))) {
                <li :class="{ 'active': route === 'files' }">
                    <a href="<%= url_for('/files') %>">
                        <%= l('My files') %>
                    </a>
                </li>
            % }
        % } else {
            <li :class="{ 'active': route === 'login' }">
                <a href="<%= url_for('/login') %>">
                    <%= l('Signin') %>
                </a>
            </li>
        % }
        <li class="dropdown lang">
            <a
                href="#"
                title="<%= l('Change language.') %>"
                @click.prevent="langDpdwn = !langDpdwn"
                @click.away="langDpdwn = false">
                %= include 'icons/meridian.svg'
                %= l('Language')
                <span x-show="!langDpdwn">
                    %= include 'icons/down.svg'
                </span>
                <span x-show="langDpdwn">
                    %= include 'icons/up.svg'
                </span>
            </a>
            <ul x-show="langDpdwn">
                % for my $i (@{$self->available_langs}) {
                    <li @click="changeLang('<%= $i %>')">
                        <%= iso639_native_name($i) %>
                    </li>
                % }
            </ul>
        </li>
        % if ((defined(config('ldap')) || defined(config('htpasswd'))) && is_user_authenticated()) {
            <li class="dropdown user">
                <a
                    href="#"
                    title="<%= l('Menu related to your files, invitations and logout.') %>"
                    @click.prevent="userDpdwn = !userDpdwn"
                    @click.away="userDpdwn = false">
                    %= include 'icons/user.svg'
                    %= $self->current_user->{username}
                    <span x-show="!userDpdwn">
                        %= include 'icons/down.svg'
                    </span>
                    <span x-show="userDpdwn">
                        %= include 'icons/up.svg'
                    </span>
                </a>
                <ul x-show="userDpdwn">
                    <li :class="{ 'active': route === 'files' }">
                        <a href="<%= url_for('/files') %>">
                            <%= l('My files') %>
                        </a>
                    </li>
                    % if (defined config('ldap') && defined config('invitations')) {
                        <li :class="{ 'active': route === 'invite' }">
                            <a href="<%= url_for('/invite') %>">
                                <%= l('Invite a guest') %>
                            </a>
                        </li>
                        <li :class="{ 'active': route === 'invite_list' }">
                            <a href="<%= url_for('/invite/list') %>">
                                <%= l('My invitations') %>
                            </a>
                        </li>
                    % }
                    <li>
                        <form action="<%= url_for('/logout') %>" method="POST">
                            %= csrf_field
                            <button type="submit">
                                <%= l('Logout') %>
                            </button>
                        </form>
                    </li>
                </ul>
            </li>
        % }
        <li :class="{ 'active': route === 'about' }">
            <a href="<%= url_for('/about') %>">
                <%= l('About') %>
            </a>
        </li>
        % #= include 'layouts/nav/normal_nav'
        % #= include 'layouts/nav/mobile_nav'
    </ul>
</nav>