Skip to content

Commit

Permalink
adds recent article list
Browse files Browse the repository at this point in the history
  • Loading branch information
actlikewill committed Sep 22, 2023
1 parent 7e053b8 commit a168506
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 5 deletions.
8 changes: 4 additions & 4 deletions peachjam/templates/peachjam/_article_list.html
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{% load i18n peachjam %}
{% for article in articles %}
<div class="rounded-0 p-2 mb-3">
<div class="my-1">
<div>
<div class="mb-3">
<div class="row">
<div class="col-md-3 col-lg-2 mb-1">
{% if article.image %}
<a href="{{ article.get_absolute_url }}">
<img src="{{ article.image.url }}"
Expand All @@ -11,7 +11,7 @@
</a>
{% endif %}
</div>
<div>
<div class="col-md-9 col-lg-10">
<h5>
<a href="{{ article.get_absolute_url }}">{{ article.title }}</a>
</h5>
Expand Down
33 changes: 33 additions & 0 deletions peachjam/templates/peachjam/_recent_article_list.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
{% load i18n peachjam %}
{% for article in articles %}
<div class="rounded-0 p-2 mb-3">
<div class="my-1">
<div>
{% if article.image %}
<a href="{{ article.get_absolute_url }}">
<img src="{{ article.image.url }}"
alt="{{ article.title }}"
class="img-fluid"/>
</a>
{% endif %}
</div>
<div>
<h5>
<a href="{{ article.get_absolute_url }}">{{ article.title }}</a>
</h5>
<ul class="text-muted list-inline text-muted">
<li class="list-inline-item">{{ article.date }}</li>
<li class="list-inline-item">
<a href={% url 'user_profile' article.author.username %}>{% user_name article.author %}</a>
</li>
{% for topic in article.topics.all %}
<li class="list-inline-item">
<a href="{% url 'article_topic_list' topic.slug %}">{{ topic }}</a>
</li>
{% endfor %}
</ul>
{% if article.summary %}<p>{{ article.summary }}</p>{% endif %}
</div>
</div>
</div>
{% endfor %}
2 changes: 1 addition & 1 deletion peachjam/templates/peachjam/article_detail.html
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ <h5 class="card-title">
{% if more_articles %}
{% user_name article.author as username %}
<h4>{% blocktrans trimmed %}Recent articles by {{ username }}{% endblocktrans %}</h4>
{% include 'peachjam/_article_list.html' with articles=more_articles %}
{% include 'peachjam/_recent_article_list.html' with articles=more_articles %}
{% endif %}
</div>
</div>
Expand Down

0 comments on commit a168506

Please sign in to comment.