Skip to content

Commit 42b7877

Browse files
authored
News item-related fixes and improvements (#1593)
1 parent 4b8b554 commit 42b7877

File tree

3 files changed

+21
-23
lines changed

3 files changed

+21
-23
lines changed

templates/homepage.html

Lines changed: 17 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{% extends "base.html" %}
22

33
{% load static %}
4-
{% load text_helpers %}
4+
{% load text_helpers avatar_tags %}
55

66
{% block content %}
77
{# homepage hero #}
@@ -211,17 +211,22 @@ <h3 class="pb-2 mb-4 text-lg md:text-2xl capitalize border-b border-gray-400 tex
211211
{% for entry in entries %}
212212
<div class="pt-0">
213213
<h2 class="flex items-center pb-2 mb-3 text-lg md:text-2xl lg:text-2xl font-semibold mr-4 border-b border-gray-400 dark:border-slate">
214-
{% if entry.author.image %}
215-
<span class="flex flex-shrink-0 items-center h-[36px] w-[36px] overflow-hidden rounded-lg border border-gray-400 dark:border-gray-500">
216-
<img src="{{ entry.author.image.url }}" alt="{{ entry.author.get_full_name }}" class="h-full w-full object-cover">
217-
</span>
218-
{% else %}
219-
<span class="flex items-center justify-center h-[30px] w-[30px] bg-white rounded dark:text-white dark:bg-slate border border-gray-400 dark:border-gray-500">
220-
<i class="text-2xl fas fa-user" title="{{ entry.author.get_full_name }}"></i>
221-
</span>
222-
{% endif %}
223-
<a class="link-header ml-4" {% if entry.tag == "link" %}target="_blank"{% endif %} href="{% if entry.tag == "link" %}{{ entry.external_url }}{% else %}{{ entry.get_absolute_url }}{% endif %}">
224-
{{ entry.title }}
214+
{% avatar user=entry.author %}
215+
<span class="text-sm ml-4 bg-white rounded-full dark:text-gray-300 w-[36px] dark:bg-slate">
216+
{% if entry.tag == "link" %}
217+
<i class="fas fa-link"></i>
218+
{% elif entry.tag == "news" %}
219+
<i class="fas fa-newspaper"></i>
220+
{% elif entry.tag == "blogpost" %}
221+
<i class="fas fa-comment"></i>
222+
{% elif entry.tag == "poll" %}
223+
<i class="fas fa-poll"></i>
224+
{% elif entry.tag == "video" %}
225+
<i class="fas fa-video"></i>
226+
{% endif %}
227+
</span>
228+
<a class="link-header" {% if entry.external_url %}target="_blank"{% endif %} href="{% if entry.external_url %}{{ entry.external_url }}{% else %}{{ entry.get_absolute_url }}{% endif %}">
229+
{{ entry.title }} {% if entry.external_url %}<i class="fa fa-external-link text-sm ml-1"></i>{% endif %}
225230
</a>
226231
</h2>
227232

templates/news/create.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,15 +18,15 @@ <h1 class="text-3xl text-center capitalize">{% translate 'Create news' %}</h1>
1818
{% if item.model_name != 'Poll' %}
1919
<a href="{% url item.add_url_name %}" class="p-5 font-semibold text-center bg-white rounded-lg dark:text-white dark:bg-slate hover:bg-white/60">
2020
{% if item.model_name == 'BlogPost' %}
21-
<i class="mr-3 fas fa-newspaper"></i> Blog Post
21+
<i class="mr-3 fas fa-comment"></i> Blog Post
2222
{% elif item.model_name == 'Poll' %}
2323
<i class="mr-3 fas fa-poll"></i> Poll
2424
{% elif item.model_name == 'Video' %}
2525
<i class="mr-3 fas fa-video"></i> Video
2626
{% elif item.model_name == 'Link' %}
2727
<i class="mr-3 fas fa-link"></i> Link
2828
{% elif item.model_name == 'News' %}
29-
<i class="mr-3 fas fa-bell"></i> News
29+
<i class="mr-3 fas fa-newspaper"></i> News
3030
{% else %}
3131
{{ item.model_name }}
3232
{% endif %}

templates/news/list.html

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
{% load i18n %}
33
{% load static %}
44
{% load news_tags %}
5+
{% load avatar_tags %}
56
{% load text_helpers %}
67

78
{% block title %}{% trans "News" %}{% endblock %}
@@ -114,15 +115,7 @@ <h6 class="pb-1 text-base">Moderate</h6>
114115
{% endif %}
115116
</div>
116117
<div class="hidden pt-2 mt-4 text-xs text-left md:block min-w-[70px] relative group">
117-
{% if entry.author.image %}
118-
<span class="inline-block h-[36px] w-[36px] overflow-hidden rounded-lg bg-white dark:bg-slate">
119-
<img src="{{ entry.author.image_thumbnail.url }}" alt="{{ entry.author.get_full_name }}" class="h-full w-full object-cover">
120-
</span>
121-
{% else %}
122-
<span class="inline-block h-[36px] w-[36px] bg-white rounded-lg dark:text-white dark:bg-slate">
123-
<i class="text-2xl fas fa-user ml-1" title="{{ entry.author.get_full_name }}"></i>
124-
</span>
125-
{% endif %}
118+
{% avatar user=entry.author %}
126119
<span class="group-hover:opacity-100 transition-opacity bg-slate px-1 text-xs text-gray-100 rounded-sm absolute top-5 left-1/2 -translate-x-1/2 translate-y-full opacity-0 m-0 mx-auto w-auto">{{ entry.author.first_name}}&nbsp;{{ entry.author.last_name }}</span>
127120
</div>
128121
<div class="block p-6 mb-3 md:mb-10 w-full bg-white md:rounded-lg md:shadow-lg md:ml-6 dark:bg-charcoal overflow-hidden">

0 commit comments

Comments
 (0)