themes: easily move the user-info block (#52275)

* add block 'header-content'
* add block 'top-links'
* move user-info code in own file
This commit is contained in:
Thomas Jund 2021-03-22 14:54:10 +01:00
parent e38c943f87
commit b9cdb20a1d
3 changed files with 31 additions and 29 deletions

View File

@ -134,23 +134,8 @@ data-api-root="{{ site_base }}/api/"
{% placeholder "footer" acquired=True name=name %}
{% endblock %}
{% block user-info %}
{% skeleton_extra_placeholder user-info %}
{% if user.is_authenticated %}
<span class="logged-in">
{% if idp_account_url %}<a class="account-link" href="{{idp_account_url}}">{% endif %}
<span class="connected-user">{% block user-info-user-name %}{{user.first_name}} {{user.last_name}}{% endblock %}</span>{% if idp_account_url %}</a>{% endif %}
<a accesskey="o" class="logout" href="{% url 'auth_logout' %}">{% block user-info-logout-label %}Déconnexion{% endblock %}</a>
</span>
{% else %}
<span class="login"><a accesskey="2" class="login-link" href="{% url 'auth_login' %}"
>{% block user-info-login-label %}Connexion{% endblock %}
{% if idp_registration_url and include_registration_link != False %}</a>{% endif %}
<span class="sep">/</span>
{% if idp_registration_url and include_registration_link != False %}<a class="registration" href="{{idp_registration_url}}"
>{% block user-info-registration-label %}Inscription{% endblock %}{% endif %}</a></span>
{% endif %}
{% end_skeleton_extra_placeholder %}
{% block top-links %}
{% include 'includes/user-info.html' %}
{% endblock %}
{% block back-top %}

View File

@ -0,0 +1,24 @@
{% load combo %}
{% if include_top_links != False %}
<div id="toplinks">
{% block user-info %}
{% skeleton_extra_placeholder user-info %}
{% if user.is_authenticated %}
<span class="logged-in">
{% if idp_account_url %}<a class="account-link" href="{{idp_account_url}}">{% endif %}
<span class="connected-user">{% block user-info-user-name %}{{user.first_name}} {{user.last_name}}{% endblock %}</span>{% if idp_account_url %}</a>{% endif %}
<a accesskey="o" class="logout" href="{% url 'auth_logout' %}">{% block user-info-logout-label %}Déconnexion{% endblock %}</a>
</span>
{% else %}
<span class="login"><a accesskey="2" class="login-link" href="{% url 'auth_login' %}"
>{% block user-info-login-label %}Connexion{% endblock %}
{% if idp_registration_url and include_registration_link != False %}</a>{% endif %}
<span class="sep">/</span>
{% if idp_registration_url and include_registration_link != False %}<a class="registration" href="{{idp_registration_url}}"
>{% block user-info-registration-label %}Inscription{% endblock %}{% endif %}</a></span>
{% endif %}
{% end_skeleton_extra_placeholder %}
{% endblock %}
</div>
{% endif %}

View File

@ -60,18 +60,11 @@
{% block header-title %}
<h1 id="logo"><a accesskey="1" href="{% firstof logo_link_url portal_url '/' %}">{% firstof global_title site_title "Compte Citoyen" %}</a></h1>
{% endblock %}
{% if include_top_links != False %}
<div id="toplinks">
{% block user-info %}
{% if user.is_authenticated %}
<span class="logged-in">
<span class="connected-user">{{user.first_name}} {{user.last_name}}</span>
<a class="logout" href="{% url 'auth_logout' %}">D&eacute;connexion</a>
</span>
{% endif %}
{% endblock %}
</div> <!-- toplinks -->
{% endif %}
{% block header-content %}
{% block top-links %}
{% endblock %}
{% endblock %}
</div>
{% block header-bottom %}{% endblock %}
</div> <!-- header -->