{% extends "layout.twig" %}

{% block title %}${ "Manage Spam" | translate("comments") }{% endblock %}

{% block content %}
            <h2>${ "Need more detail?" | translate }</h2>
            <form class="detail" action="index.php" method="get" accept-charset="utf-8">
                <fieldset>
                    <a class="button boo right" href="{% admin "purge_spam" %}"><img src="$theme_url/images/icons/deny.png" alt="deny" />${ "Delete All (%d)" | translate("comments") | format(comments.total) }</a>
                    <input type="hidden" name="action" value="manage_comments" />
                    <div class="left pad">
                        <h3>
                            ${ "Search&hellip;" | translate }
                            <a href="{% admin "help&id=filtering_results" %}" class="help emblem"><img src="$theme_url/images/icons/help.png" alt="help" /></a>
                        </h3>
                        <input class="text" type="text" name="query" value="${ GET.query | escape }" id="query" />
                        <button type="submit" class="inline">${ "Search &rarr;" | translate }</button>
                    </div>
                    <div class="clear"></div>
                </fieldset>
            </form>
            <br />
            <form action="{% admin "bulk_comments&from=spam" %}" method="post">
                <h2>{% if GET.query %}${ "Search Results" | translate }{% else %}${ "Last 25 Spam" | translate("comments") }{% endif %}</h2>
                <table border="0" cellspacing="0" cellpadding="0" class="wide">
                    <thead>
                        <tr class="head">
                            <th class="toggler center"></th>
                            <th>${ "Post" | translate("comments") }</th>
                            <th>${ "Author" | translate("comments") }</th>
                            <th>${ "Added" | translate("comments") }</th>
                            ${ trigger.call("manage_comments_column_header") }
                            <th colspan="2">${ "Controls" | translate }</th>
                        </tr>
                    </thead>
                    <tbody>
                    {% for comment in comments.paginated %}
                        <tr id="comment_$comment.id" class="comment $comment.status{% if loop.last %} last{% endif %}">
                            <td rowspan="2" class="checkbox center">
                                <input type="checkbox" name="comment[$comment.id]" value="" id="comment_checkbox_$comment.id" />
                            </td>
                            <td class="main"><a href="$comment.post.url#comment_$comment.id">${ comment.post.title | truncate }</a></td>
                            <td>${ comment.user.full_name | fallback(comment.user.login) | fallback(comment.author) }</td>
                            <td>${ comment.created_at | strftime }</td>
                            ${ trigger.call("manage_comments_column", comment) }
                            {% if comment.editable and comment.deletable %}
                        <td class="controls">${ comment.edit_link('<img src="'~ theme_url ~'/images/icons/edit.png" alt="edit" /> '~("edit" | translate)) }</td>
                        <td class="controls">${ comment.delete_link('<img src="'~ theme_url ~'/images/icons/delete.png" alt="delete" /> '~("delete" | translate)) }</td>
                        {% elseif comment.editable or comment.deletable %}
                        ${ comment.edit_link('<img src="'~ theme_url ~'/images/icons/edit.png" alt="edit" /> '~("edit" | translate), '<td class="controls" colspan="2">', '</td>') }
                        ${ comment.delete_link('<img src="'~ theme_url ~'/images/icons/delete.png" alt="delete" /> '~("delete" | translate), '<td class="controls" colspan="2">', '</td>') }
                        {% endif %}
                        </tr>
                        <tr class="excerpt">
                            <td colspan="5">${ comment.body | truncate(100) }</td>
                        </tr>
                    {% else %}
                        <tr class="last">
                            <td colspan="5" class="center"><span class="sub">${ "(none)" | translate }</span></td>
                        </tr>
                    {% endfor %}
                    </tbody>
                </table>
                <br />
                <div class="controls">
                    <h4>${ "With selected:" | translate("comments") }</h4>
                    <button class="lite" name="deny">
                        <img src="$theme_url/images/icons/deny.png" alt="deny" /> ${ "deny" | translate("comments") }
                    </button>
                    <button class="lite yay" name="approve">
                        <img src="$theme_url/images/icons/success.png" alt="approve" /> ${ "approve" | translate("comments") }
                    </button>
                    <button class="lite boo" name="delete">
                        <img src="$theme_url/images/icons/delete.png" alt="delete" /> ${ "delete" | translate("comments") }
                    </button>
                </div>
            </form>
            {% if comments.paginated and comments.pages > 1 %}
            <br />
            <div class="pagination">
                $comments.next_link
                $comments.prev_link
                <span class="pages">${ "Page %d of %d" | translate | format(comments.page, comments.pages) }</span>
            </div>
            {% endif %}
{% endblock %}
