From fb8f2d10984bcfa2585dc272b4c85d285b722792 Mon Sep 17 00:00:00 2001 From: Michael Manfre Date: Mon, 28 Nov 2022 23:41:36 -0500 Subject: Hashtags --- templates/activities/_hashtag.html | 11 +++++++++ templates/activities/_menu.html | 13 +++++++++- templates/activities/explore_tag.html | 16 ++++++++++++ templates/activities/search.html | 8 ++++++ templates/activities/tag.html | 16 ++++++++++++ templates/admin/hashtag_create.html | 26 ++++++++++++++++++++ templates/admin/hashtag_delete.html | 17 +++++++++++++ templates/admin/hashtag_edit.html | 46 +++++++++++++++++++++++++++++++++++ templates/admin/hashtags.html | 40 ++++++++++++++++++++++++++++++ templates/settings/_menu.html | 3 +++ 10 files changed, 195 insertions(+), 1 deletion(-) create mode 100644 templates/activities/_hashtag.html create mode 100644 templates/activities/explore_tag.html create mode 100644 templates/activities/tag.html create mode 100644 templates/admin/hashtag_create.html create mode 100644 templates/admin/hashtag_delete.html create mode 100644 templates/admin/hashtag_edit.html create mode 100644 templates/admin/hashtags.html (limited to 'templates') diff --git a/templates/activities/_hashtag.html b/templates/activities/_hashtag.html new file mode 100644 index 0000000..19233e5 --- /dev/null +++ b/templates/activities/_hashtag.html @@ -0,0 +1,11 @@ + + + + {{ hashtag.display_name }} + + {% if not hide_stats %} + + Post count: {{ hashtag.stats.total }} + + {% endif %} + diff --git a/templates/activities/_menu.html b/templates/activities/_menu.html index 1ebe940..58295a9 100644 --- a/templates/activities/_menu.html +++ b/templates/activities/_menu.html @@ -6,6 +6,9 @@ Notifications + + Explore + Local @@ -19,13 +22,21 @@ Search + {% if current_page == "tag" %} + + {{ hashtag.display_name }} + + {% endif %} Settings - {% else %} + {% else %} Local Posts + + Explore +

{% if config.signup_allowed %} diff --git a/templates/activities/explore_tag.html b/templates/activities/explore_tag.html new file mode 100644 index 0000000..b2fd79d --- /dev/null +++ b/templates/activities/explore_tag.html @@ -0,0 +1,16 @@ +{% extends "base.html" %} + +{% block title %}#{{ hashtag.display_name }} Timeline{% endblock %} + +{% block content %} +
Explore Trending Tags
+ +
+ {% for hashtag in page_obj %} + {% include "activities/_hashtag.html" %} + {% empty %} + No tags are trending yet. + {% endfor %} + +
+{% endblock %} diff --git a/templates/activities/search.html b/templates/activities/search.html index 3cff2a2..5137740 100644 --- a/templates/activities/search.html +++ b/templates/activities/search.html @@ -18,4 +18,12 @@ {% include "activities/_identity.html" %} {% endfor %} {% endif %} + {% if results.hashtags %} +

Hashtags

+
+ {% for hashtag in results.hashtags %} + {% include "activities/_hashtag.html" with hide_stats=True %} + {% endfor %} +
+ {% endif %} {% endblock %} diff --git a/templates/activities/tag.html b/templates/activities/tag.html new file mode 100644 index 0000000..a319b6a --- /dev/null +++ b/templates/activities/tag.html @@ -0,0 +1,16 @@ +{% extends "base.html" %} + +{% block title %}#{{ hashtag.display_name }} Timeline{% endblock %} + +{% block content %} +
{{ hashtag.display_name }}
+ {% for post in page_obj %} + {% include "activities/_post.html" %} + {% empty %} + No posts yet. + {% endfor %} + + {% if page_obj.has_next %} +
Next Page
+ {% endif %} +{% endblock %} diff --git a/templates/admin/hashtag_create.html b/templates/admin/hashtag_create.html new file mode 100644 index 0000000..2d31cf7 --- /dev/null +++ b/templates/admin/hashtag_create.html @@ -0,0 +1,26 @@ +{% extends "settings/base.html" %} + +{% block title %}Add hashtag - Admin{% endblock %} + +{% block content %} +
+

Add A hashtag

+

+ Use this form to add a hashtag. +

+ {% csrf_token %} +
+ hashtag Details + {% include "forms/_field.html" with field=form.hashtag %} + {% include "forms/_field.html" with field=form.name_override %} +
+
+ Access Control + {% include "forms/_field.html" with field=form.public %} +
+
+ Back + +
+
+{% endblock %} diff --git a/templates/admin/hashtag_delete.html b/templates/admin/hashtag_delete.html new file mode 100644 index 0000000..9aca4e7 --- /dev/null +++ b/templates/admin/hashtag_delete.html @@ -0,0 +1,17 @@ +{% extends "settings/base.html" %} + +{% block title %}Delete {{ hashtag.hashtag }} - Admin{% endblock %} + +{% block content %} +
+ {% csrf_token %} + +

Deleting {{ hashtag.hashtag }}

+ +

Please confirm deletion of this hashtag.

+
+ Cancel + +
+ +{% endblock %} diff --git a/templates/admin/hashtag_edit.html b/templates/admin/hashtag_edit.html new file mode 100644 index 0000000..b023dfa --- /dev/null +++ b/templates/admin/hashtag_edit.html @@ -0,0 +1,46 @@ +{% extends "settings/base.html" %} + +{% block subtitle %}{{ hashtag.hashtag }}{% endblock %} + +{% block content %} + + {% csrf_token %} +
+ hashtag Details + {% include "forms/_field.html" with field=form.hashtag %} + {% include "forms/_field.html" with field=form.name_override %} +
+
+ Access Control + {% include "forms/_field.html" with field=form.public %} +
+
+ Stats +
+ {% for stat_month, stat_value in hashtag.usage_months.items|slice:":5" %} + {% if forloop.first %} + + + + + + {% endif %} + + + + + {% if forloop.last %} +
MonthUsage
{{ stat_month|date:"M Y" }}{{ stat_value }}
+ {% endif %} + {% empty %} +

Hashtag is either not used or stats have not been computed yet.

+ {% endfor %} +
+
+
+ Back + Delete + +
+
+{% endblock %} diff --git a/templates/admin/hashtags.html b/templates/admin/hashtags.html new file mode 100644 index 0000000..4273ac2 --- /dev/null +++ b/templates/admin/hashtags.html @@ -0,0 +1,40 @@ +{% extends "settings/base.html" %} + +{% block subtitle %}Hashtags{% endblock %} + +{% block content %} +
+ {% for hashtag in hashtags %} + + + + {{ hashtag.display_name }} + + {% if hashtag.public %}Public{% elif hashtag.public is None %}Unreviewed{% else %}Private{% endif %} + + + {% if hashtag.stats %} + + Total: + {{ hashtag.stats.total }} + + {% endif %} + {% if hashtag.aliases %} + + + Aliases: + {% for alias in hashtag.aliases %} + {{ alias }}{% if not forloop.last %}, {% endif %} + {% endfor %} + + {% endif %} + + + {% empty %} +

You have no hashtags set up.

+ {% endfor %} + + Add a hashtag + +
+{% endblock %} diff --git a/templates/settings/_menu.html b/templates/settings/_menu.html index 531febb..8aede68 100644 --- a/templates/settings/_menu.html +++ b/templates/settings/_menu.html @@ -36,6 +36,9 @@ Invites + + Hashtags + Django Admin -- cgit v1.2.3