Add category post counts
- Add pagination (WIP) - Tweak admin category/post list pages
This commit is contained in:
@@ -4,7 +4,6 @@
|
||||
<table class="table table-sm table-hover">
|
||||
<thead>
|
||||
<tr>
|
||||
<th scope="col">Actions</th>
|
||||
<th scope="col">Category</th>
|
||||
<th scope="col">Description</th>
|
||||
</tr>
|
||||
@@ -12,22 +11,28 @@
|
||||
<tbody>
|
||||
{% for cat in categories -%}
|
||||
<tr>
|
||||
<td class="action-button-column">
|
||||
<a class="btn btn-secondary btn-sm" href="/category/{{ cat.id }}/edit">Edit</a>
|
||||
<a class="btn btn-danger btn-sm" href="/category/{{ cat.id }}/delete"
|
||||
onclick="return Admin.deleteCategory('{{ cat.id }}', '{{ cat.name }}')">
|
||||
Delete
|
||||
</a>
|
||||
</td>
|
||||
<td>
|
||||
<td class="no-wrap">
|
||||
{%- if cat.parent_names %}
|
||||
<small class="text-muted">{% for name in cat.parent_names %}{{ name }} ⟩ {% endfor %}</small>
|
||||
{% endif -%}
|
||||
{{ cat.name }}
|
||||
<small><a href="/posts/category/{{ cat.slug }}" target="_blank">View Posts</a></small>
|
||||
{%- endif %}
|
||||
{{ cat.name }}<br>
|
||||
<small>
|
||||
{%- if cat.post_count > 0 %}
|
||||
<a href="/category/{{ cat.slug }}" target="_blank">
|
||||
View {{ cat.post_count }} Post{% unless cat.post_count == 1 %}s{% endunless -%}
|
||||
</a>
|
||||
<span class="text-muted"> • </span>
|
||||
{%- endif %}
|
||||
<a href="/category/{{ cat.id }}/edit">Edit</a>
|
||||
<span class="text-muted"> • </span>
|
||||
<a href="/category/{{ cat.id }}/delete" class="text-danger"
|
||||
onclick="return Admin.deleteCategory('{{ cat.id }}', '{{ cat.name }}')">
|
||||
Delete
|
||||
</a>
|
||||
</small>
|
||||
</td>
|
||||
<td>
|
||||
{%- if cat.description %}{{ cat.description.value }}{% else %}<em class="text-muted">none</em>{% endif -%}
|
||||
{%- if cat.description %}{{ cat.description.value }}{% else %}<em class="text-muted">none</em>{% endif %}
|
||||
</td>
|
||||
</tr>
|
||||
{%- endfor %}
|
||||
|
||||
@@ -15,10 +15,9 @@
|
||||
{% for post in model.posts -%}
|
||||
<tr>
|
||||
<td class="no-wrap">
|
||||
{% if post.published_on.has_value -%}
|
||||
{{ post.published_on | date: "MMMM d, yyyy" }}
|
||||
{%- else -%}
|
||||
{{ post.updated_on | date: "MMMM d, yyyy" }}
|
||||
{% if post.published_on %}{{ post.published_on | date: "MMMM d, yyyy" }}{% else %}Not Published{% endif %}
|
||||
{%- if post.published_on != post.updated_on %}<br>
|
||||
<small class="text-muted"><em>{{ post.updated_on | date: "MMMM d, yyyy" }}</em></small>
|
||||
{%- endif %}
|
||||
</td>
|
||||
<td>
|
||||
@@ -38,4 +37,18 @@
|
||||
{%- endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
{% if model.newer_link or model.older_link %}
|
||||
<div class="d-flex justify-content-evenly">
|
||||
<div>
|
||||
{% if model.newer_link %}
|
||||
<p><a class="btn btn-default" href="/{{ model.newer_link.value }}">« Newer Posts</a></p>
|
||||
{% endif %}
|
||||
</div>
|
||||
<div class="text-right">
|
||||
{% if model.older_link %}
|
||||
<p><a class="btn btn-default" href="/{{ model.older_link.value }}">Older Posts »</a></p>
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
{% endif %}
|
||||
</article>
|
||||
|
||||
Reference in New Issue
Block a user