You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Add view partials for repeated content on post or topic writer
If we want to override the way the last writer of a
post or a topic is shown, the project forces us to repeat
our modification in multiple templates. We introduce two
different partials to simplify the overload.
Copy file name to clipboardexpand all lines: machina/templates/machina/forum_conversation/topic_detail.html
+5-12
Original file line number
Diff line number
Diff line change
@@ -45,21 +45,14 @@ <h4 class="m-0 subject">
45
45
</h4>
46
46
{% endspaceless %}
47
47
<p>
48
+
{% block written_by %}
48
49
<smallclass="text-muted">
49
50
{% spaceless %}
50
51
<iclass="fas fa-clock"></i>
51
-
{% if post.poster %}
52
-
{% url 'forum_member:profile' post.poster_id as poster_url %}
53
-
{% blocktrans trimmed with poster_url=poster_url username=post.poster|forum_member_display_name creation_date=post.created %}
54
-
By: <ahref="{{ poster_url }}">{{ username }}</a> on {{ creation_date }}
55
-
{% endblocktrans %}
56
-
{% else %}
57
-
{% blocktrans trimmed with poster_username=post.username creation_date=post.created %}
58
-
By: {{ poster_username }} on {{ creation_date }}
59
-
{% endblocktrans %}
60
-
{% endif %}
52
+
{% include "partials/posted_by.html" with poster=post.poster creation_date=post.created username=poster_username %}
61
53
{% endspaceless %}
62
54
</small>
55
+
{% endblock %}
63
56
</p>
64
57
<divclass="post-content">
65
58
{{ post.content.rendered }}
@@ -73,7 +66,7 @@ <h4 class="m-0 subject">
73
66
{% if post.updates_count %}
74
67
<divclass="mt-4 edit-info">
75
68
<smallclass="text-muted">
76
-
<iclass="fas fa-edit"></i> {% if post.updated_by %}{% trans "Last edited by:" %} <ahref="{% url 'forum_member:profile' post.updated_by_id %}">{{ post.updated_by|forum_member_display_name }}</a> {% else %}{% trans "Updated" %} {% endif %}{% trans "on" %} {{ post.updated }}, {% blocktrans count counter=post.updates_count %}edited {{counter }} time in total.{% plural %}edited {{counter }} times in total.{% endblocktrans %}
69
+
<iclass="fas fa-edit"></i> {% if post.updated_by %}{% trans "Last edited by:" %} {% include "partials/profile_link.html" with poster=post.updated_by %} {% else %}{% trans "Updated" %} {% endif %}{% trans "on" %} {{ post.updated }}, {% blocktrans count counter=post.updates_count %}edited {{counter }} time in total.{% plural %}edited {{counter }} times in total.{% endblocktrans %}
77
70
</small>
78
71
{% if post.update_reason %}
79
72
<br/>
@@ -91,7 +84,7 @@ <h4 class="m-0 subject">
91
84
{% include "partials/avatar.html" with profile=post.poster.forum_profile show_placeholder=True %}
<divclass="username">{% include "partials/posted_by.html" with poster=post.poster username=post.username username_highlighted=True display_label_by=False %}</div>
0 commit comments