hibbitts-design / grav-theme-learn2-git-sync

A customized version of the Learn2 theme for use with the Learn2 with Git Sync skeleton package. Includes selectable visual styles.
http://demo.hibbittsdesign.org/grav-learn2-git-sync/
MIT License
18 stars 13 forks source link

Missing logout link #20

Open timinator2020 opened 2 years ago

timinator2020 commented 2 years ago

This may be more of a feature request than an issue.

When you login to the site as a normal user (NOT the admin panel), there is no way to logout again. The quark theme has a logout link, but Learn2/Learn2-git-sync do not.

See this for more info.

While I have already added a custom theme which inherits this theme with the suggested changes, it might be handy to have it show up by default (or perhaps an option).

This is what I added to put the logout link in the sidebar, just above the "Built with" text:

templates/partials/sidebar.html.twig (added between the footer and feed link):

{# Added by Tim M. - adds a logout link to the sidebar #}
            {% if config.plugins.login.enabled and grav.user.username %} <span class="login-status-wrapper"><i class="fa fa-user"></i> {% include 'partials/login-status.html.twig' %}</span><br><br> {% endif %}
{# Ends the logout link code #}

The bottom part of the file looks like this:

        <a class="padding" href="#" data-clear-history-toggle><i
                    class="fa fa-fw fa-history"></i> {{ 'THEME_LEARN2_CLEAR_HISTORY'|t }}</a><br/>
        <section id="footer">
{# Added by Timinator - adds a logout link to the sidebar #}
            {% if config.plugins.login.enabled and grav.user.username %} <span class="login-status-wrapper"><i class="fa fa-user"></i> {% include 'partials/login-status.html.twig' %}</span><br><br> {% endif %}
{# Ends the logout link code #}
            {% if config.plugins.feed.enabled and pages.find('/feed') %}
              <a class="button" href="{{ base_url }}/feed.atom"><i class="fa fa-rss-square"></i> Atom 1.0</a>
              <a class="button" href="{{ base_url }}/feed.rss"><i class="fa fa-rss-square"></i> RSS</a><br><br>
            {% endif %}
            <p>{{ 'THEME_LEARN2_BUILT_WITH_GRAV'|t|raw }}</p>
        </section>
    </div>
</div>
paulhibbitts commented 2 years ago

Thanks for the feature request, this was likely not in the source Learn2 theme either so it never got added. Glad you were able to add this to your own install and thanks for sharing your Twig. I am tending not to add this right now to the theme but let's see if that might change in the future due to additional user requests etc.