Skip to content

Commit

Permalink
News item-related fixes and improvements (#1593)
Browse files Browse the repository at this point in the history
  • Loading branch information
GregKaleka authored Jan 13, 2025
1 parent 4b8b554 commit 42b7877
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 23 deletions.
29 changes: 17 additions & 12 deletions templates/homepage.html
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{% extends "base.html" %}

{% load static %}
{% load text_helpers %}
{% load text_helpers avatar_tags %}

{% block content %}
{# homepage hero #}
Expand Down Expand Up @@ -211,17 +211,22 @@ <h3 class="pb-2 mb-4 text-lg md:text-2xl capitalize border-b border-gray-400 tex
{% for entry in entries %}
<div class="pt-0">
<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">
{% if entry.author.image %}
<span class="flex flex-shrink-0 items-center h-[36px] w-[36px] overflow-hidden rounded-lg border border-gray-400 dark:border-gray-500">
<img src="{{ entry.author.image.url }}" alt="{{ entry.author.get_full_name }}" class="h-full w-full object-cover">
</span>
{% else %}
<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">
<i class="text-2xl fas fa-user" title="{{ entry.author.get_full_name }}"></i>
</span>
{% endif %}
<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 %}">
{{ entry.title }}
{% avatar user=entry.author %}
<span class="text-sm ml-4 bg-white rounded-full dark:text-gray-300 w-[36px] dark:bg-slate">
{% if entry.tag == "link" %}
<i class="fas fa-link"></i>
{% elif entry.tag == "news" %}
<i class="fas fa-newspaper"></i>
{% elif entry.tag == "blogpost" %}
<i class="fas fa-comment"></i>
{% elif entry.tag == "poll" %}
<i class="fas fa-poll"></i>
{% elif entry.tag == "video" %}
<i class="fas fa-video"></i>
{% endif %}
</span>
<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 %}">
{{ entry.title }} {% if entry.external_url %}<i class="fa fa-external-link text-sm ml-1"></i>{% endif %}
</a>
</h2>

Expand Down
4 changes: 2 additions & 2 deletions templates/news/create.html
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,15 @@ <h1 class="text-3xl text-center capitalize">{% translate 'Create news' %}</h1>
{% if item.model_name != 'Poll' %}
<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">
{% if item.model_name == 'BlogPost' %}
<i class="mr-3 fas fa-newspaper"></i> Blog Post
<i class="mr-3 fas fa-comment"></i> Blog Post
{% elif item.model_name == 'Poll' %}
<i class="mr-3 fas fa-poll"></i> Poll
{% elif item.model_name == 'Video' %}
<i class="mr-3 fas fa-video"></i> Video
{% elif item.model_name == 'Link' %}
<i class="mr-3 fas fa-link"></i> Link
{% elif item.model_name == 'News' %}
<i class="mr-3 fas fa-bell"></i> News
<i class="mr-3 fas fa-newspaper"></i> News
{% else %}
{{ item.model_name }}
{% endif %}
Expand Down
11 changes: 2 additions & 9 deletions templates/news/list.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
{% load i18n %}
{% load static %}
{% load news_tags %}
{% load avatar_tags %}
{% load text_helpers %}

{% block title %}{% trans "News" %}{% endblock %}
Expand Down Expand Up @@ -114,15 +115,7 @@ <h6 class="pb-1 text-base">Moderate</h6>
{% endif %}
</div>
<div class="hidden pt-2 mt-4 text-xs text-left md:block min-w-[70px] relative group">
{% if entry.author.image %}
<span class="inline-block h-[36px] w-[36px] overflow-hidden rounded-lg bg-white dark:bg-slate">
<img src="{{ entry.author.image_thumbnail.url }}" alt="{{ entry.author.get_full_name }}" class="h-full w-full object-cover">
</span>
{% else %}
<span class="inline-block h-[36px] w-[36px] bg-white rounded-lg dark:text-white dark:bg-slate">
<i class="text-2xl fas fa-user ml-1" title="{{ entry.author.get_full_name }}"></i>
</span>
{% endif %}
{% avatar user=entry.author %}
<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>
</div>
<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">
Expand Down

0 comments on commit 42b7877

Please sign in to comment.