leilukin-tumbleblog/admin/pages/manage_posts.twig

76 lines
2.5 KiB
Twig

{% extends "layouts" ~ DIR ~ "default.twig" %}
{% block title %}{{ "Manage Posts" | translate }}{% endblock %}
{% block content %}
<form class="filters" action="{{ url('manage_posts') }}" method="post" accept-charset="UTF-8" role="search">
<fieldset role="presentation">
<label for="query">
{{ "Search&hellip;" | translate }}
<a href="{{ url('help/id/filtering_results') }}" rel="help" target="_blank" class="help emblem">
{{- icon_img("help.svg", "help" | translate) -}}
</a>
</label>
<input class="text filter_text" type="text" name="query" value="{{ GET.query | fix(true, true) }}" id="query">
<button type="submit">{{ "Search" | translate }}</button>
{% if visitor.group.can("add_post", "add_draft") %}
<a href="{{ url('write_post') }}" class="button yay">
{{ icon_img("add.svg") }}{{ "New Post" | translate }}
</a>
{% endif %}
</fieldset>
</form>
<h2>{{ GET.query is not empty ? "Search Results" | translate : "Posts" | translate }}</h2>
<table>
<thead>
<tr class="head">
<th class="post_title title main">{{ "Title" | translate }}</th>
<th class="post_date date">{{ "Posted" | translate }}</th>
<th class="post_status status">{{ "Status" | translate }}</th>
<th class="post_author value">{{ "Author" | translate }}</th>
{{ trigger.call("manage_posts_column_header") }}
<th class="controls" colspan="2">{{ "Controls" | translate }}</th>
</tr>
</thead>
<tbody>
{% for post in posts.paginated %}
<tr id="post_{{ post.id }}" class="post {{ post.status_class }}">
<td class="post_title title main">
<a href="{{ post.url() }}">{{ post.title() | striptags | oneof("[Untitled]" | translate) | truncate(40) }}</a>
</td>
<td class="post_date date">
{{ post.created_at | time }}
</td>
<td class="post_status status">
{{ post.status_name }}
</td>
<td class="post_author value">
{{ post.author.name }}
</td>
{{ trigger.call("manage_posts_column", post) }}
<td class="controls">
{{ post.edit_link(icon_img("edit.svg", "edit" | translate), null, null, "emblem") }}
</td>
<td class="controls">
{{ post.delete_link(icon_img("delete.svg", "delete" | translate), null, null, "emblem") }}
</td>
</tr>
{% else %}
<tr>
<td class="placeholder">
<img class="emblem" src="{{ site.chyrp_url }}/admin/images/icons/failure.svg" alt="">
{{ "No results" | translate }}
</td>
</tr>
{% endfor %}
</tbody>
</table>
{% if posts.paginated is defined and posts.pages > 1 %}
<div class="pagination">
<span class="pages">{{ "Page %d of %s" | translate | format(posts.page, posts.final_link(posts.pages)) }}</span>
{{ posts.prev_link }}
{{ posts.next_link }}
</div>
{% endif %}
{% endblock %}