Working menu.
[wolnelektury.git] / src / wolnelektury / templates / 2022 / header.html
index 490159c..b7d7a33 100644 (file)
     <div class="l-navigation__actions">
       {% if request.user.is_authenticated %}
         <a href="/ludzie/polka/"><i class="icon icon-liked"></i></a>
+        <div id="user-menu">
+          <ul>
+            <li>
+              <a href="{% url 'user_settings' %}" tabindex="-1">
+                <strong>
+                  {{ request.user.username }}
+                </strong>
+              </a>
+            </li>
+            {% if request.user.is_staff %}
+              <li><a href="{% url 'admin:index' %}" tabindex="-1">Administracja</a></li>
+            {% endif %}
+            <li><a href="{% url 'logout' %}?next={% block logout %}{{ request.get_full_path }}{% endblock %}" tabindex="-1">Wyloguj się</a></li>
+          </ul>
+        </div>
         <a href="{% url 'user_settings' %}" class="user">
           {% if request.user.is_staff %}
             <img src="{% static '2022/images/icons/user-staff.svg' %}">
@@ -28,9 +43,9 @@
         </a>
       {% else %}
         <div class="l-navigation__login">
-          <a href='...'>Zaloguj się</a>
+          <a href='{% url 'login' %}?next={{ request.path }}'>Zaloguj się</a>
           /
-          <a href='...'>Załóż konto</a>
+          <a href='{% url 'register' %}?next={{ request.path }}'>Załóż konto</a>
         </div>
       {% endif %}
       <button class="l-navigation__button js-menu" aria-label="Menu">
     <div class="l-navigation__menu">
       <div class="l-container">
         <div class="l-navigation__menu__links">
-          <ul>
-            <li><strong>Katalog</strong></li>
-            {% menu 'Katalog' %}
-          </ul>
-          <ul>
-            <li><strong>Włącz się</strong></li>
-            {% menu 'Włącz się' %}
-          </ul>
-          <ul>
-            <li><strong>Aktualności</strong></li>
-            {% cache 1800 latest_blog_posts %}
+          {% cache 30 menu LANGUAGE_CODE %}
+            <ul>
+              <li><strong>Katalog</strong></li>
+              {% menu 'Katalog' %}
+            </ul>
+            <ul>
+              <li><strong>Włącz się</strong></li>
+              {% menu 'Włącz się' %}
+            </ul>
+            <ul>
+              <li><strong>Aktualności</strong></li>
               {% latest_blog_posts %}
-            {% endcache %}
-            {% menu 'Aktualności' %}
-          </ul>
-          <ul>
-            <li><strong>Narzędzia</strong></li>
-            {% menu 'Narzędzia' %}
-          </ul>
-          <ul>
-            <li><strong>O nas</strong></li>
-            {% menu 'O nas' %}
-          </ul>
+              {% menu 'Aktualności' %}
+            </ul>
+            <ul>
+              <li><strong>Narzędzia</strong></li>
+              {% menu 'Narzędzia' %}
+            </ul>
+            <ul>
+              <li><strong>O nas</strong></li>
+              {% menu 'O nas' %}
+            </ul>
+          {% endcache %}
         </div>
 
         <div class="l-navigation__menu__info">
 
           <div class="l-navigation__menu__book">
-            {% preview_ad %}
+            {% cache 300 preview_ad LANGUAGE_CODE %}
+              {% preview_ad %}
+            {% endcache %}
           </div>
 
           <div class="l-navigation__menu__social">