Socialify

Folder ..

Viewing articles.html
65 lines (65 loc) • 3.1 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
64
65
66
{% extends 'blog/partials/base.html' %} {% block content %}
{% if type == 'articles' %}
<h2 style="margin-top:15px;"> All Posts</h2>
{% elif type == 'articles-archive' %}
<h2 style="margin-top:15px;"> Posts made in {{ date }}</h2>
{% elif type == 'articles-category' %}
<h2 style="margin-top:15px;"> Posts made in Category: {{ category_name }}</h2>
{% endif %}

<form id="filters" method="get">
    <span><b>Filters:</b>&nbsp;&nbsp;&nbsp;&nbsp;</span>
    <label for="order_by">Order By: </label>
    <select name="order_by">
        <option value="date" {% if order_by == 'date' %}selected{% endif %}>Date</option>
        <option value="title" {% if order_by == 'title' %}selected{% endif %}>Title</option>
    </select>
    <label for="direction">&nbsp;&nbsp;Direction: </label>
    <select name="direction">
        <option value="asc" {% if direction == 'asc' %}selected{% endif %}>Ascending</option>
        <option value="desc" {% if direction == 'desc' %}selected{% endif %}>Descending</option>
    </select>
    {% if type != 'articles-category' %}
    <label for="category">&nbsp;&nbsp;In Category: </label>
    <select name="category">
        <option value="all" {% if category == 'all' %}selected{% endif %}>All</option>
        {% for cat in categories %}
        <option value="{{ cat.slug }}" {% if category == cat.slug %}selected{% endif %}>{{ cat.name }}</option>
        {% endfor %}
    </select>
    {% endif %}
    <span>&nbsp;&nbsp;</span>
    <input type="submit" value="Apply" class="button button-special" />
</form>
{% if posts %}
<div style="margin-top: -10px;">
    {% include 'blog/partials/post_list.html' %}
</div>
<div>
    <table id="pagination" style="clear: both;">
        <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:articles' %}?page=1&order_by={{ order_by }}&direction={{ direction }}&category={{ category }}">&laquo;</a></td>
        <td style="margin-right: 15px;"><a href="{% url 'blog:articles' %}?page={{ page|add:'-1' }}&order_by={{ order_by }}&direction={{ direction }}&category={{ category }}">&lsaquo;</a></td>
      {% endif %}
      {% load times %}
      {% for i in num_pages|times  %}
      <td><a {% if i == page %}class="active"{% endif %} href="{% url 'blog:articles' %}?page={{ i }}&order_by={{ order_by }}&direction={{ direction }}&category={{ category }}">{{ 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:articles' %}?page={{ page|add:'1' }}&order_by={{ order_by }}&direction={{ direction }}&category={{ category }}">&rsaquo;</a></td>
        <td><a href="{% url 'blog:articles' %}?page={{ num_pages }}&order_by={{ order_by }}&direction={{ direction }}&category={{ category }}">&raquo;</a></td>
      {% endif %}
    </tr>
  </table>
</div>
{% include 'blog/partials/mathjax.html' %}
{% else %}
    <p>No posts found.</p>
{% endif %}
{% endblock %}