Extract navigation into snippet

This commit is contained in:
Gabriel Augendre 2020-12-28 10:13:50 +01:00
parent 766255f5ae
commit 40d6dc4e46
No known key found for this signature in database
GPG key ID: 1E693F4CE4AEE7B4
2 changed files with 18 additions and 17 deletions

View file

@ -17,23 +17,7 @@
<header>
<h1>{{ blog_title }}</h1>
<p>{{ blog_description }}</p>
<nav>
<a href="{% url 'articles-list' %}">Home</a>
&centerdot;
<a href="{% url 'complete-feed' %}">RSS</a>
&centerdot;
{% if user.is_authenticated %}
<a href="{% url 'admin:articles_article_add' %}">Write</a>
&centerdot;
<a href="{% url 'drafts-list' %}">View drafts <span class="pill">{{ drafts_count }}</span></a>
&centerdot;
<a href="{% url 'admin:index' %}">Admin</a>
&centerdot;
<a href="{% url 'admin:logout' %}?next={{ request.get_full_path }}">Log out</a>
{% else %}
<a href="{% url 'admin:login' %}?next={{ request.get_full_path }}">Log in</a>
{% endif %}
</nav>
{% include "articles/snippets/navigation.html" %}
</header>
{% block content %}

View file

@ -0,0 +1,17 @@
<nav>
<a href="{% url 'articles-list' %}">Home</a>
&centerdot;
<a href="{% url 'complete-feed' %}">RSS</a>
&centerdot;
{% if user.is_authenticated %}
<a href="{% url 'admin:articles_article_add' %}">Write</a>
&centerdot;
<a href="{% url 'drafts-list' %}">View drafts <span class="pill">{{ drafts_count }}</span></a>
&centerdot;
<a href="{% url 'admin:index' %}">Admin</a>
&centerdot;
<a href="{% url 'admin:logout' %}?next={{ request.get_full_path }}">Log out</a>
{% else %}
<a href="{% url 'admin:login' %}?next={{ request.get_full_path }}">Log in</a>
{% endif %}
</nav>