diff --git a/news/templatetags/__init__.py b/news/templatetags/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/news/templatetags/news_tags.py b/news/templatetags/news_tags.py new file mode 100644 index 00000000..4aaae85a --- /dev/null +++ b/news/templatetags/news_tags.py @@ -0,0 +1,9 @@ +from django import template + +register = template.Library() + + +@register.simple_tag(takes_context=True) +def can_edit(context, news_item, *args, **kwargs): + request = context.get("request") + return news_item.can_edit(request.user) diff --git a/static/css/styles.css b/static/css/styles.css index f654d0c1..8da80e39 100644 --- a/static/css/styles.css +++ b/static/css/styles.css @@ -1510,6 +1510,22 @@ code, margin-left: 1rem; } +.-mt-3 { + margin-top: -0.75rem; +} + +.-mt-4 { + margin-top: -1rem; +} + +.-mr-3 { + margin-right: -0.75rem; +} + +.-mt-5 { + margin-top: -1.25rem; +} + .block { display: block; } @@ -3557,6 +3573,12 @@ code, margin-left: calc(1.5rem * calc(1 - var(--tw-space-x-reverse))); } + .md\:space-x-11 > :not([hidden]) ~ :not([hidden]) { + --tw-space-x-reverse: 0; + margin-right: calc(2.75rem * var(--tw-space-x-reverse)); + margin-left: calc(2.75rem * calc(1 - var(--tw-space-x-reverse))); + } + .md\:space-x-3 > :not([hidden]) ~ :not([hidden]) { --tw-space-x-reverse: 0; margin-right: calc(0.75rem * var(--tw-space-x-reverse)); diff --git a/templates/news/list.html b/templates/news/list.html index 54520346..ebfa0757 100644 --- a/templates/news/list.html +++ b/templates/news/list.html @@ -1,81 +1,79 @@ {% extends "base.html" %} {% load i18n %} {% load static %} +{% load news_tags %} {% block title %}{% trans "News" %}{% endblock %} {% block content %} -
+
-

Latest Stories

+

Latest Stories

-
-

- Stay up to date with Boost and the C++ ecosystem with the latest news, videos, resources, polls, and user-created content. - {% if user.is_authenticated %} - Or, Create a Post to include in the feed (posts are reviewed before publication). - {% else %} - Signed-in users may submit items to include in the feed (posts are reviewed before publication). - {% endif %} -

-
- - - - - - -
-
- - {% url 'news' as target_url %} - -
All
- -
- - {% url 'news-news-list' as target_url %} - -
News
- -
- - {% url 'news-blogpost-list' as target_url %} - -
Blogs
- -
- - {% url 'news-link-list' as target_url %} - -
Links
- -
- - {% comment %} - - {% url 'news-poll-list' as target_url %} - -
Polls
- -
- {% endcomment %} - - {% url 'news-video-list' as target_url %} - -
Videos
- -
- - {% if is_moderator %} - -
Moderate
- -
- {% endif %} +
+
+

+ Stay up to date with Boost and the C++ ecosystem with the latest news, videos, resources, polls, and user-created content. + {% if user.is_authenticated %} + Or, Create a Post to include in the feed (posts are reviewed before publication). + {% else %} + Signed-in users may submit items to include in the feed (posts are reviewed before publication). + {% endif %} +

-
+ +
+
+ + {% url 'news' as target_url %} + +
All
+ +
+ + {% url 'news-news-list' as target_url %} + +
News
+ +
+ + {% url 'news-blogpost-list' as target_url %} + +
Blogs
+ +
+ + {% url 'news-link-list' as target_url %} + +
Links
+ +
+ + {% comment %} + + {% url 'news-poll-list' as target_url %} + +
Polls
+ +
+ {% endcomment %} + + {% url 'news-video-list' as target_url %} + +
Videos
+ +
+ + {% if is_moderator %} + +
Moderate
+ +
+ {% endif %} +
+
+
@@ -126,6 +124,12 @@ {% endif %}
+ {% can_edit news_item=entry as editable %} + {% if editable %} + + + + {% endif %}

{{ entry.title }}