Add drafts count and pill css
This commit is contained in:
parent
5b247d363c
commit
fb2eae301a
4 changed files with 15 additions and 1 deletions
|
@ -3,3 +3,7 @@ from articles.models import Article, Page
|
||||||
|
|
||||||
def pages(request):
|
def pages(request):
|
||||||
return {"pages": Page.objects.filter(status=Article.PUBLISHED)}
|
return {"pages": Page.objects.filter(status=Article.PUBLISHED)}
|
||||||
|
|
||||||
|
|
||||||
|
def drafts_count(request):
|
||||||
|
return {"drafts_count": Article.with_pages.filter(status=Article.DRAFT).count()}
|
||||||
|
|
|
@ -127,6 +127,15 @@ tr:hover {
|
||||||
background-color: var(--background2);
|
background-color: var(--background2);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.pill {
|
||||||
|
font-size: 60%;
|
||||||
|
background-color: var(--main2);
|
||||||
|
color: var(--background2);
|
||||||
|
padding: .5ex 1ex;
|
||||||
|
border-radius: 1ex;
|
||||||
|
vertical-align: 15%;
|
||||||
|
}
|
||||||
|
|
||||||
@media (prefers-color-scheme: dark) {
|
@media (prefers-color-scheme: dark) {
|
||||||
:root {
|
:root {
|
||||||
--accent: #226997;
|
--accent: #226997;
|
||||||
|
|
|
@ -16,7 +16,7 @@
|
||||||
<a href="{% url 'articles-list' %}">Gab's Notes</a>
|
<a href="{% url 'articles-list' %}">Gab's Notes</a>
|
||||||
|
|
|
|
||||||
{% if user.is_authenticated %}
|
{% if user.is_authenticated %}
|
||||||
<a href="{% url 'drafts-list' %}">View drafts</a>
|
<a href="{% url 'drafts-list' %}">View drafts <span class="pill">{{ drafts_count }}</span></a>
|
||||||
<a href="{% url 'admin:index' %}">Admin</a>
|
<a href="{% url 'admin:index' %}">Admin</a>
|
||||||
{% else %}
|
{% else %}
|
||||||
<a href="{% url 'admin:login' %}?next=/">Log in</a>
|
<a href="{% url 'admin:login' %}?next=/">Log in</a>
|
||||||
|
|
|
@ -73,6 +73,7 @@ TEMPLATES = [
|
||||||
"django.contrib.auth.context_processors.auth",
|
"django.contrib.auth.context_processors.auth",
|
||||||
"django.contrib.messages.context_processors.messages",
|
"django.contrib.messages.context_processors.messages",
|
||||||
"articles.context_processors.pages",
|
"articles.context_processors.pages",
|
||||||
|
"articles.context_processors.drafts_count",
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
Reference in a new issue