From 651d0de0295e7c441bd0ce17bc8567f612e27e47 Mon Sep 17 00:00:00 2001 From: Calum Andrew Morrell Date: Mon, 5 May 2025 19:44:42 +0100 Subject: [PATCH] Updated templates for articles app to include tailwind styling. --- .../templates/articles/article_detail.html | 31 +++++------- articles/templates/articles/article_list.html | 48 ++++++++----------- .../templates/articles/category_list.html | 12 ++--- .../articles/includes/display_tags.html | 3 ++ articles/templates/articles/tag_list.html | 8 ++-- core/templates/core/homepage.html | 2 +- 6 files changed, 48 insertions(+), 56 deletions(-) create mode 100644 articles/templates/articles/includes/display_tags.html diff --git a/articles/templates/articles/article_detail.html b/articles/templates/articles/article_detail.html index a885c41..b08ac52 100644 --- a/articles/templates/articles/article_detail.html +++ b/articles/templates/articles/article_detail.html @@ -1,33 +1,28 @@ {% extends 'base.html' %} {% block content %} -
-

{{ article.title }}

+
+

{{ article.title }}

{% if article.subtitle %} -
{{ article.subtitle }}
+
{{ article.subtitle }}
{% endif %} -

Added on the {{ article.created|date:'jS \o\f F, Y' }} +

Added on the {{ article.created | date:'jS \o\f F, Y' }} {% if article.created.date != article.updated.date %} - and updated on the {{ article.updated|date:'jS \o\f F, Y' }} + and updated on the {{ article.updated | date:'jS \o\f F, Y' }} {% endif %}

-
+
{% if article.introduction %} -

{{ article.introduction|linebreaksbr }}

-
+

{{ article.introduction|linebreaksbr }}

+
{% endif %} -
+
{{ article.body_as_markdown|safe }}
-
-
- Posted in the {{ article.category }} category - - {% for tag in article.tags.all %} - {{ tag }}{% if tag != article.tags.last %},{% endif %} - {% endfor %} - +
+
+ Posted in the {{ article.category }} category +{# {% include 'articles/includes/display_tags.html' %}#}
{% endblock %} \ No newline at end of file diff --git a/articles/templates/articles/article_list.html b/articles/templates/articles/article_list.html index 01727cb..aac3fc5 100644 --- a/articles/templates/articles/article_list.html +++ b/articles/templates/articles/article_list.html @@ -4,51 +4,45 @@
{% if object_list %} {% if category %} -

{{ category }} Articles

+

{{ category }} Articles

{% if category.introduction %} -
-

{{ category.introduction }}

+
+

{{ category.introduction }}

{% endif %} {% elif tag %} -

Articles for tag: {{ tag }}

+

Articles for tag: {{ tag }}

{% else %} -

Recent Articles

+

Recent Articles

{% endif %} -
-
+
+
{% for article in object_list %} -
- {{ article.title }} +
+ {{ article.title }} {% if article.subtitle %} -
{{ article.subtitle }}
+
{{ article.subtitle }}
{% endif %} {% if article.introduction %} -
-

{{ article.introduction|linebreaksbr }}

+
+

{{ article.introduction|linebreaksbr }}

{% endif %} -
-
+
+
- {{ article.category }} - • {{ article.created|date:'jS \o\f F, Y' }} - - - {% for tag in article.tags.all %} - {{ tag }}{% if tag != article.tags.last %}, - {% endif %} - {% endfor %} + {{ article.category }} + • {{ article.created | date:'jS \o\f F, Y' }} + {% include 'articles/includes/display_tags.html' %}
{% endfor %}
{% else %} -
-

Oops!

-
It looks like there are no articles for that {% if category %}category{% elif tag %} tag{% endif %} - yet.
-

(sorry not sorry)

+
+

Oops!

+
It looks like there are no articles for that {% if category %}category{% elif tag %}tag{% endif %} yet.
+

(sorry not sorry)

{% endif %} {% if page_obj.has_previous or page_obj.has_next %} diff --git a/articles/templates/articles/category_list.html b/articles/templates/articles/category_list.html index 5df0b7e..b657696 100644 --- a/articles/templates/articles/category_list.html +++ b/articles/templates/articles/category_list.html @@ -3,15 +3,15 @@ {% block content %}
{% if object_list %} -

Category List

-
-
    +

    Category List

    +
    +
      {% for category in object_list %}
    • - {{ category.title }} + {{ category.title }} {% if category.introduction %} -
      -

      {{ category.introduction }}

      +
      +

      {{ category.introduction }}

      {% endif %}
    • {% endfor %} diff --git a/articles/templates/articles/includes/display_tags.html b/articles/templates/articles/includes/display_tags.html new file mode 100644 index 0000000..c7246d3 --- /dev/null +++ b/articles/templates/articles/includes/display_tags.html @@ -0,0 +1,3 @@ +{% for tag in article.tags.all %} + {{ tag }}{% if tag != article.tags.last %},{% endif %} +{% endfor %} \ No newline at end of file diff --git a/articles/templates/articles/tag_list.html b/articles/templates/articles/tag_list.html index 8f75d8a..ca23c3e 100644 --- a/articles/templates/articles/tag_list.html +++ b/articles/templates/articles/tag_list.html @@ -3,12 +3,12 @@ {% block content %}
      {% if object_list %} -

      List of Tags

      -
      -
        +

        List of Tags

        +
        + diff --git a/core/templates/core/homepage.html b/core/templates/core/homepage.html index 4774505..650c9a9 100644 --- a/core/templates/core/homepage.html +++ b/core/templates/core/homepage.html @@ -36,7 +36,7 @@ href="{% url 'articles:list_category' category=article.category.slug %}">{{ article.category }} • {{ article.created | date:'jS \o\f F, Y' }} -{# {% include 'articles/includes/display_tags.html' %}#} + {% include 'articles/includes/display_tags.html' %}
{% endfor %}