Socialify

Folder ..

Viewing comments.html
62 lines (63 loc) • 2.6 KB

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
{% extends 'blog/partials/base.html' %} {% block content %}
{% load static %}
<div class="main">
    <h2 class="mtctitem" {% if not messages %}style="border: none; margin-bottom: 0;"{% endif %}>{{ title }}</h2>
{% for message in messages  %}
<div style="text-align:center;padding:0;">
    <p class="{{message.tags}}" style="text-align:center; margin-bottom: 15px;">{{ message }}</p>
</div>
{% endfor %}
<table id="tabular">
    <thead>
        <tr>
            <th colspan="3">Text</th>
            <th>Author</th>
            <th colspan="2">Post</th>
            <th>Comment Date</th>
            <th>Actions</th>
        </tr>
    </thead>
    <tbody>
        {% for comment in comments %}
        <tr>
            <td colspan="3">{{ comment.body }}</td>
            <td>{% if comment.user %}{{ comment.user.username }}{% else %}{{ comment.anonymous_user.name }}{% endif %}</td>
            <td colspan="2">{{ comment.post.title }}</td>
            <td>{{ comment.created_at | date:"d.m.Y" }}</td>
            <td>
                <a href="{% url 'admin:blog_comment_change' comment.id %}">Edit</a>
                <a href="{% url 'admin:blog_comment_delete' comment.id %}">Delete</a>
            </td>
        </tr>
        {% endfor %}
    </tbody>
</table>
{% if num_pages and page %}
    <div class="pagination">
        <center>
        <table id="pagination">
            <tr>
            {% if page == 1 %}
                <td><a class="disabled">&laquo;</a></td>
                <td style="margin-right: 15px;"><a class="disabled">&lsaquo;</a></td>
            {% else %}
                <td><a href="{% url 'blog-admin:comments' %}?page=1">&laquo;</a></td>
                <td style="margin-right: 15px;"><a href="{% url 'blog-admin:comments' %}?page={{ page|add:'-1' }}">&lsaquo;</a></td>
            {% endif %}
            {% load times %}
            {% for i in num_pages|times  %}
            <td><a {% if i == page %}class="active"{% endif %} href="{% url 'blog-admin:comments' %}?page={{ i }}">{{ i }}</a></td>
            {% endfor %}
            {% if page == num_pages %}
                <td style="margin-left: 15px;" class="disabled"><a class="disabled">&rsaquo;</a></td>
                <td><a class="disabled">&raquo;</a></td>
            {% else %}
                <td style="margin-left: 15px;"><a href="{% url 'blog-admin:comments' %}?page={{ page|add:'1' }}">&rsaquo;</a></td>
                <td><a href="{% url 'blog-admin:comments' %}?page={{ num_pages }}">&raquo;</a></td>
            {% endif %}
            </tr>
        </table>
        </center>
    </div>
{% endif %}
{% endblock %}