Add pluralizing macro filter to templating engine

- Only some plural edits are included here - some are locked behind commits coming soon™️
- Also made index template statistics variables read better
- Fixed spelling error in CSRF Error template rendering (hadn't hit the page yet)
This commit is contained in:
Xevion
2022-03-29 18:07:39 -05:00
parent 49547e582c
commit db560b7c41
2 changed files with 21 additions and 11 deletions

View File

@@ -16,19 +16,22 @@
</div>
<div class="statistics" style="margin: 1em;">
<h2>runnerspace Statistics</h2>
<div>
{% with comments = stats['total_comments'], posts = stats['total_posts'], users = stats['total_users'] %}
<div>
<ul>
<li>
<strong>{{ stats['total_comments'] }}</strong> comments across <strong>{{ stats['total_posts'] }}</strong> posts<br>
</li>
<li>
<strong>{{ stats['total_users'] }}</strong> users
</li>
</ul>
<div>
<ul>
<li>
<strong>{{ comments }}</strong> comment across <strong>{{ posts }}</strong>
post{{ posts|pluralize }}<br>
</li>
<li>
<strong>{{ users }}</strong> user{{ users|pluralize }}
</li>
</ul>
</div>
</div>
</div>
{% endwith %}
</div>
</div>
{% endblock %}