|
|
|
|
@ -9,10 +9,36 @@ |
|
|
|
|
|
|
|
|
|
{% for post in latest_post_list %} |
|
|
|
|
|
|
|
|
|
<!-- <div class="{% if forloop.counter|divisibleby:2 %}even{% else %}odd{% endif %}"> --> |
|
|
|
|
|
|
|
|
|
<!-- A post --> |
|
|
|
|
{% if post.style == 0 %} |
|
|
|
|
|
|
|
|
|
<div class="grid-x post"> |
|
|
|
|
<div class="post"> |
|
|
|
|
|
|
|
|
|
<div class="imgcontainer"> |
|
|
|
|
<a href="{{ post.url }}"> |
|
|
|
|
<img class="crop" src="{% static 'media/' %}{{ post.image_url }}"/> |
|
|
|
|
<div class="bottom-left"> |
|
|
|
|
<h1>{{ post.title }}</h1> |
|
|
|
|
</div> |
|
|
|
|
</a> |
|
|
|
|
</div> |
|
|
|
|
<p class="contentbody"> |
|
|
|
|
{{ post.body }} |
|
|
|
|
</p> |
|
|
|
|
<div class="info"> |
|
|
|
|
{{ post.date }} - {{ post.author.username }} - <a href="{% url 'news:post' post.id %}">{% if post.comment_set.count > 0 %}{{ post.comment_set.count }} comments{% else %}write comment{% endif %}</a> |
|
|
|
|
</div> |
|
|
|
|
<!-- Some comments --> |
|
|
|
|
<div class="comments"> |
|
|
|
|
{% for comment in post.top_comments %} |
|
|
|
|
<span>{{ comment.body }} - {{ comment.author.username }}</span><br/> |
|
|
|
|
{% endfor %} |
|
|
|
|
</div> |
|
|
|
|
</div> |
|
|
|
|
|
|
|
|
|
<!-- <div class="grid-x post"> |
|
|
|
|
<div class="cell large-2 large-offset-2 info"> |
|
|
|
|
<br/> |
|
|
|
|
{{ post.date }} |
|
|
|
|
@ -29,7 +55,6 @@ |
|
|
|
|
{{ post.body }} |
|
|
|
|
</div> |
|
|
|
|
<div class="cell large-4 comments"> |
|
|
|
|
<!-- Some comments --> |
|
|
|
|
{% for comment in post.top_comments %} |
|
|
|
|
<div class="grid-x"> |
|
|
|
|
<div class="cell small-2 large-2">{{ comment.body }}</div> |
|
|
|
|
@ -39,43 +64,60 @@ |
|
|
|
|
|
|
|
|
|
</div> |
|
|
|
|
</div> |
|
|
|
|
</div> |
|
|
|
|
</div> --> |
|
|
|
|
|
|
|
|
|
{% else %} |
|
|
|
|
|
|
|
|
|
<div class="grid-x post"> |
|
|
|
|
<div class="cell large-2 large-offset-2 info"> |
|
|
|
|
<img src="{% static 'media/' %}{{ post.image_url }}" width="100" height="100"/> |
|
|
|
|
<br/> |
|
|
|
|
{{ post.date }} |
|
|
|
|
<br/> |
|
|
|
|
{{ post.author.username }} |
|
|
|
|
<br/> |
|
|
|
|
<a href="{% url 'news:post' post.id %}">comments</a> |
|
|
|
|
</div> |
|
|
|
|
<div class="cell large-4"> |
|
|
|
|
<div class="grid-y"> |
|
|
|
|
<div class="cell large-4"> |
|
|
|
|
<h1><a href="{{ post.url }}">{{ post.title }}</a></h1> |
|
|
|
|
{{ post.body }} |
|
|
|
|
</div> |
|
|
|
|
<div class="cell large-4 comments"> |
|
|
|
|
<!-- Some comments --> |
|
|
|
|
{% for comment in post.top_comments %} |
|
|
|
|
<div class="grid-x"> |
|
|
|
|
<div class="cell small-2 large-2">{{ comment.body }}</div> |
|
|
|
|
</div> |
|
|
|
|
{% endfor %} |
|
|
|
|
</div> |
|
|
|
|
<div class="post"> |
|
|
|
|
<div class="grid-x"> |
|
|
|
|
<div class="cell large-2"> |
|
|
|
|
<img src="{% static 'media/' %}{{ post.image_url }}" width="150" height="150"/> |
|
|
|
|
</div> |
|
|
|
|
<div class="cell large-8"> |
|
|
|
|
<h1><a href="{{ post.url }}">{{ post.title }}</a></h1> |
|
|
|
|
<p class="contentbody">{{ post.body }}</p> |
|
|
|
|
</div> |
|
|
|
|
|
|
|
|
|
</div> |
|
|
|
|
</div> |
|
|
|
|
</div> |
|
|
|
|
</div> |
|
|
|
|
|
|
|
|
|
<div class="info"> |
|
|
|
|
{{ post.date }} - {{ post.author.username }} - <a href="{% url 'news:post' post.id %}">{% if post.comment_set.count > 0 %}{{ post.comment_set.count }} comments{% else %}write comment{% endif %}</a> |
|
|
|
|
</div> |
|
|
|
|
<!-- Some comments --> |
|
|
|
|
<div class="comments"> |
|
|
|
|
{% for comment in post.top_comments %} |
|
|
|
|
<span>{{ comment.body }} - {{ comment.author.username }}</span><br/> |
|
|
|
|
{% endfor %} |
|
|
|
|
</div> |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
</div> |
|
|
|
|
|
|
|
|
|
{% endif %} |
|
|
|
|
|
|
|
|
|
<!-- </div> --> |
|
|
|
|
{% endfor %} |
|
|
|
|
|
|
|
|
|
<!-- Pagination --> |
|
|
|
|
<div class="pagination"> |
|
|
|
|
<span class="step-links"> |
|
|
|
|
{% if latest_post_list.has_previous %} |
|
|
|
|
<a href="?page=1">« first</a> |
|
|
|
|
<a href="?page={{ latest_post_list.previous_page_number }}">previous</a> |
|
|
|
|
{% endif %} |
|
|
|
|
|
|
|
|
|
<span class="current"> |
|
|
|
|
Page {{ latest_post_list.number }} of {{ latest_post_list.paginator.num_pages }} |
|
|
|
|
</span> |
|
|
|
|
|
|
|
|
|
{% if latest_post_list.has_next %} |
|
|
|
|
<a href="?page={{ latest_post_list.next_page_number }}">next</a> |
|
|
|
|
<a href="?page={{ latest_post_list.paginator.num_pages }}">last »</a> |
|
|
|
|
{% endif %} |
|
|
|
|
</span> |
|
|
|
|
</div> |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
{% else %} |
|
|
|
|
<p>No posts are available.</p> |
|
|
|
|
{% endif %} |
|
|
|
|
|