Skip to content

Commit b69108e

Browse files
Merge pull request #219 from stuartmaxwell:minor-tweak
Refactor post_detail.html for better readability and maintainability
2 parents 0c269de + 087843a commit b69108e

File tree

1 file changed

+40
-15
lines changed

1 file changed

+40
-15
lines changed
Lines changed: 40 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,46 @@
11
{% load djpress_tags %}
22

3-
{% post_wrap %}
3+
{% if not post.title %}
44

5-
{% post_title outer_tag="h1" %}
5+
{% post_wrap class="rounded bg-success-subtle p-3" %}
66

7-
{% post_content outer_tag="section" %}
7+
<h2 class="fs-6">{% get_post_date %}</h2>
88

9-
<footer>
10-
<p>Posted on {% post_date %}</p>
11-
<p>Categories: {% post_categories "span" link_class="badge bg-primary" %}</p>
12-
{% if user.is_authenticated and user.is_staff %}
13-
<p>
14-
<a href="{% url 'admin:djpress_post_change' post.id %}" class="icon-link">
15-
{% include "svg/pencil.svg" %} Edit this
16-
</a>
17-
</p>
18-
{% endif %}
19-
</footer>
9+
{% post_content outer_tag="section" %}
2010

21-
{% end_post_wrap %}
11+
<footer>
12+
<p>{% post_categories "span" link_class="badge bg-primary" %}</p>
13+
{% if user.is_authenticated and user.is_staff %}
14+
<p>
15+
<a href="{% url 'admin:djpress_post_change' post.id %}" class="icon-link">
16+
{% include "svg/pencil.svg" %} Edit this
17+
</a>
18+
</p>
19+
{% endif %}
20+
</footer>
21+
22+
{% end_post_wrap %}
23+
24+
{% else %}
25+
26+
{% post_wrap %}
27+
28+
{% post_title outer_tag="h1" %}
29+
30+
{% post_content outer_tag="section" %}
31+
32+
<footer>
33+
<p>Posted on {% post_date %}</p>
34+
<p>Categories: {% post_categories "span" link_class="badge bg-primary" %}</p>
35+
{% if user.is_authenticated and user.is_staff %}
36+
<p>
37+
<a href="{% url 'admin:djpress_post_change' post.id %}" class="icon-link">
38+
{% include "svg/pencil.svg" %} Edit this
39+
</a>
40+
</p>
41+
{% endif %}
42+
</footer>
43+
44+
{% end_post_wrap %}
45+
46+
{% endif %}

0 commit comments

Comments
 (0)