aboutsummaryrefslogtreecommitdiff
path: root/templates/partials/_weblog_list.html
blob: a9b334624b5ca45a712868e50705cb4298b23631 (plain)
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
{% load tz %}
{% load static %}
<link rel="stylesheet" href="{% static 'css/core/post_list.css' %}">
{% for post in posts %}
    <div class="post">
        <div class="post-body">
            <div class="post-image">
                <img src="{{ post.image_url }}" alt="{{ post.title }}">
            </div>
            <div class="post-content">
                <h2>
                    <a href="{% url "weblog:single_post" post.slug %}">{{ post.title }}</a>
                </h2>
                <div class="author-info">
                    {% with post.author.userprofile_set.first as authorprofile %}
                    <img src="{% static 'images/avatars/' %}{{ authorprofile.avatar_url }}.gif" class="post-profile-image" alt="{{ post.author.first_name }}'s Avatar">
                    {% endwith %}
                    <a href="#"> {{ post.author.first_name }} {{ post.author.last_name }}</a>
                    <span>{% if request.LANGUAGE_CODE == 'ja' %}投稿カテゴリー:{% else %}posted in{% endif %}</span>
                    <a href="#{{ post.category.slug }}">{{ post.category.name }}</a>
                    <span>{% if request.LANGUAGE_CODE == 'ja' %}投稿日:{% else %}on{% endif %}</span>
                    <span style="margin-left: 4px;">{% localtime on %}{{ post.date | date:"M d, Y" }}{% endlocaltime %}</span>
                </div>
                <div class="post-exerpt">
                    {{ post.excerpt | safe }}
                </div>
            </div>
        </div>
        <div class="post-actions">
            <div class="post-links">
                <a href="{% url "weblog:single_post" post.slug %}">{% if request.LANGUAGE_CODE == 'ja' %}続きを読む{% else %}Continue Reading{% endif %}</a> | 
                <a href="{% url "weblog:single_post" post.slug %}#comments">{{ post.comments.all|length }}
                {% if request.LANGUAGE_CODE == 'ja' %}
                    コメント
                {% else %}
                    Comment{% if not post.comments.all|length == 1 %}s{% endif %}
                {% endif %}</a>
            </div>
            <div class="post-tags">
            {% for tag in post.tags.all %}
                <a class="post-tag" href="#{{ tag.slug }}">{{ tag.name }}</a>
            {% endfor %}
            </div>
        </div>
    </div>
{% endfor %}