summaryrefslogtreecommitdiff
path: root/src/application/templates
diff options
context:
space:
mode:
authorJonas Kohl2024-12-26 20:12:34 +0100
committerJonas Kohl2024-12-26 20:12:34 +0100
commit686fff945e0b4697aa74da404ce90534bb7b121d (patch)
treecb5582c8d118cb480f2978fa821950f4a2259401 /src/application/templates
parent11fed2c8ce3dd38fe686e7b27db738f64373fe3d (diff)
Add async email and topic subscribingv0.7.2
Diffstat (limited to 'src/application/templates')
-rw-r--r--src/application/templates/bootstrap-3/view_topic.twig40
-rw-r--r--src/application/templates/modern/view_topic.twig34
-rw-r--r--src/application/templates/old/view_topic.twig29
3 files changed, 95 insertions, 8 deletions
diff --git a/src/application/templates/bootstrap-3/view_topic.twig b/src/application/templates/bootstrap-3/view_topic.twig
index 383dd41..7009afc 100644
--- a/src/application/templates/bootstrap-3/view_topic.twig
+++ b/src/application/templates/bootstrap-3/view_topic.twig
@@ -30,6 +30,12 @@
or currentUser.hasPermission(permission("DELETE_OTHER_TOPIC"))
) %}
+{% set canSubscribe = currentUser is not null %}
+
+{% set isSubscribed =
+ currentUser is not null
+ and ctx.subscription is not null %}
+
{% set title = ctx.topic.title %}
{% extends "base.twig" %}
@@ -178,30 +184,40 @@
{{ ctx.topic.title }}
<div class="pull-right text-normal">
{% if canEdit and not ctx.topic.isLocked %}
- <button id="btn-edit-title" class="btn btn-default js-only"><span class="fa fa-pencil" aria-hidden="true"></span> {{ __("Edit title") }}</button>
+ <button id="btn-edit-title" class="btn btn-default btn-xs js-only"><span class="fa fa-pencil" aria-hidden="true"></span> {{ __("Edit title") }}</button>
{% endif %}
{% if canReply %}
- <button id="btn-reply" class="btn btn-default js-only"><span class="fa fa-comment" aria-hidden="true"></span> {{ __("Reply") }}</button>
+ <button id="btn-reply" class="btn btn-default btn-xs js-only"><span class="fa fa-comment" aria-hidden="true"></span> {{ __("Reply") }}</button>
+ {% endif %}
+ {% if canSubscribe %}
+ <form action="?_action=subscribetopic" method="post" class="seamless-inline">
+ <input type="hidden" name="topic" value="{{ ctx.topic.id }}">
+ {% if isSubscribed %}
+ <button type="submit" class="btn btn-xs btn-default"><span class="fa fa-bell-slash" aria-hidden="true"></span> {{ __("Unsubscribe from topic") }}</button>
+ {% else %}
+ <button type="submit" class="btn btn-xs btn-default"><span class="fa fa-bell" aria-hidden="true"></span> {{ __("Subscribe to topic") }}</button>
+ {% endif %}
+ </form>
{% endif %}
{% if canEdit %}
{% if ctx.topic.isLocked %}
<form action="?_action=locktopic" method="post" class="seamless-inline">
<input type="hidden" name="topic" value="{{ ctx.topic.id }}">
<input type="hidden" name="locked" value="false">
- <button type="submit" class="btn btn-success"><span class="fa fa-unlock" aria-hidden="true"></span> {{ __("Unlock topic") }}</button>
+ <button type="submit" class="btn btn-success btn-xs"><span class="fa fa-unlock" aria-hidden="true"></span> {{ __("Unlock topic") }}</button>
</form>
{% else %}
<form action="?_action=locktopic" method="post" class="seamless-inline">
<input type="hidden" name="topic" value="{{ ctx.topic.id }}">
<input type="hidden" name="locked" value="true">
- <button type="submit" class="btn btn-warning"><span class="fa fa-lock" aria-hidden="true"></span> {{ __("Lock topic") }}</button>
+ <button type="submit" class="btn btn-warning btn-xs"><span class="fa fa-lock" aria-hidden="true"></span> {{ __("Lock topic") }}</button>
</form>
{% endif %}
{% endif %}
{% if canDelete %}
<form action="?_action=deletetopic" method="post" class="seamless-inline">
<input type="hidden" name="topic" value="{{ ctx.topic.id }}">
- <button type="submit" class="btn btn-danger"><span class="fa fa-trash" aria-hidden="true"></span> {{ __("Delete topic") }}</button>
+ <button type="submit" class="btn btn-danger btn-xs"><span class="fa fa-trash" aria-hidden="true"></span> {{ __("Delete topic") }}</button>
</form>
{% endif %}
</div>
@@ -209,7 +225,14 @@
{{ __("Started by %user% on %date%", {
"user": (ctx.topicAuthor is not null) ? ('<a href="?_action=viewuser&amp;user=' ~ ctx.topicAuthor.id|url_encode|e("html") ~ '">' ~ ctx.topicAuthor.displayName|e("html") ~ '</a>') : __("(deleted)"),
"date": '<span class="_time">' ~ ctx.topic.creationDate.format("c")|e("html") ~ '</span>',
- }) }}
+ }) }} &bull; {{ ___(
+ "%n% person is watching this topic",
+ "%n% people are watching this topic",
+ ctx.subscription_count,
+ {
+ n: ctx.subscription_count,
+ },
+ ) }}
</div>
{% if canEdit %}
<form action="?_action=updatetopic" method="post" id="editHeading" style="display: none;" class="form-inline seamless-inline">
@@ -351,6 +374,11 @@ $(function() {
}) }}</label>
<input type="file" name="files[]" id="i_files" multiple accept="*/*">
</div>
+ {% if not isSubscribed %}
+ <div class="checkbox">
+ <label><input type="checkbox" name="subscribe" value="on" checked> {{ __("Subscribe to topic") }}</label>
+ </div>
+ {% endif %}
<button type="submit" class="btn btn-success">{{ __("Post reply") }} <span class="fa fa-send" aria-hidden="true"></span></button>
</form>
{% else %}
diff --git a/src/application/templates/modern/view_topic.twig b/src/application/templates/modern/view_topic.twig
index 733ce1b..c064b1c 100644
--- a/src/application/templates/modern/view_topic.twig
+++ b/src/application/templates/modern/view_topic.twig
@@ -30,6 +30,12 @@
or currentUser.hasPermission(permission("DELETE_OTHER_TOPIC"))
) %}
+{% set canSubscribe = currentUser is not null %}
+
+{% set isSubscribed =
+ currentUser is not null
+ and ctx.subscription is not null %}
+
{% set title = ctx.topic.title %}
{% extends "base.twig" %}
@@ -189,6 +195,20 @@
<svg viewBox="0 0 24 24" class="icon"><polyline points="9 17 4 12 9 7"/><path d="M20 18v-2a4 4 0 0 0-4-4H4"/></svg>
</button>
{% endif %}
+ {% if canSubscribe %}
+ <form action="?_action=subscribetopic" method="post" class="seamless-inline">
+ <input type="hidden" name="topic" value="{{ ctx.topic.id }}">
+ {% if isSubscribed %}
+ <button type="submit" class="btn btn-iconic" title="{{ __("Unsubscribe from topic") }}">
+ <svg viewBox="0 0 24 24" class="icon"><path d="M10.268 21a2 2 0 0 0 3.464 0" /><path d="M3.262 15.326A1 1 0 0 0 4 17h16a1 1 0 0 0 .74-1.673C19.41 13.956 18 12.499 18 8A6 6 0 0 0 6 8c0 4.499-1.411 5.956-2.738 7.326" /></svg>
+ </button>
+ {% else %}
+ <button type="submit" class="btn btn-iconic" title="{{ __("Subscribe to topic") }}">
+ <svg viewBox="0 0 24 24" class="icon"><path d="M10.268 21a2 2 0 0 0 3.464 0"/><path d="M17 17H4a1 1 0 0 1-.74-1.673C4.59 13.956 6 12.499 6 8a6 6 0 0 1 .258-1.742"/><path d="m2 2 20 20"/><path d="M8.668 3.01A6 6 0 0 1 18 8c0 2.687.77 4.653 1.707 6.05"/></svg>
+ </button>
+ {% endif %}
+ </form>
+ {% endif %}
{% if canEdit %}
{% if ctx.topic.isLocked %}
<form action="?_action=locktopic" method="post">
@@ -221,7 +241,14 @@
{{ __("Started by %user% on %date%", {
"user": (ctx.topicAuthor is not null) ? ('<a href="?_action=viewuser&amp;user=' ~ ctx.topicAuthor.id|url_encode|e("html") ~ '">' ~ ctx.topicAuthor.displayName|e("html") ~ '</a>') : __("(deleted)"),
"date": '<span class="_time">' ~ ctx.topic.creationDate.format("c")|e("html") ~ '</span>',
- }) }}
+ }) }} &bull; {{ ___(
+ "%n% person is watching this topic",
+ "%n% people are watching this topic",
+ ctx.subscription_count,
+ {
+ n: ctx.subscription_count,
+ },
+ ) }}
</div>
{% if canEdit %}
<form action="?_action=updatetopic" method="post" id="editHeading" hidden>
@@ -348,6 +375,11 @@ document.addEventListener("DOMContentLoaded", function() {
}) }}</label>
<input type="file" name="files[]" id="i_files" multiple accept="*/*">
</div>
+ {% if not isSubscribed %}
+ <div class="checkbox">
+ <label><input type="checkbox" name="subscribe" value="on" checked> {{ __("Subscribe to topic") }}</label>
+ </div>
+ {% endif %}
<button type="submit" class="btn btn-success">
<span>{{ __("Post reply") }}</span>
<svg viewBox="0 0 24 24" class="icon"><path d="M3.714 3.048a.498.498 0 0 0-.683.627l2.843 7.627a2 2 0 0 1 0 1.396l-2.842 7.627a.498.498 0 0 0 .682.627l18-8.5a.5.5 0 0 0 0-.904z"/><path d="M6 12h16"/></svg>
diff --git a/src/application/templates/old/view_topic.twig b/src/application/templates/old/view_topic.twig
index 613de49..70d0d67 100644
--- a/src/application/templates/old/view_topic.twig
+++ b/src/application/templates/old/view_topic.twig
@@ -30,6 +30,12 @@
or currentUser.hasPermission(permission("DELETE_OTHER_TOPIC"))
) %}
+{% set canSubscribe = currentUser is not null %}
+
+{% set isSubscribed =
+ currentUser is not null
+ and ctx.subscription is not null %}
+
{% set title = ctx.topic.title %}
{% extends "base.twig" %}
@@ -76,6 +82,16 @@
#}</form>
{%- endif -%}
{%- endif -%}
+ {%- if canSubscribe -%}
+ <form action="?_action=subscribetopic" method="post" class="inline">{#
+ #}<input type="hidden" name="topic" value="{{ ctx.topic.id }}">
+ {%- if isSubscribed -%}
+ <button type="submit" class="seamless m-r"><img src="/ui/theme-files/old/unsubscribe.gif" width="16" height="16" draggable="false" alt="{{ __("Unsubscribe from topic") }}"></button>
+ {%- else -%}
+ <button type="submit" class="seamless m-r"><img src="/ui/theme-files/old/subscribe.gif" width="16" height="16" draggable="false" alt="{{ __("Subscribe to topic") }}"></button>
+ {%- endif -%}
+ </form>
+ {%- endif -%}
{%- if canDelete -%}
<form action="?_action=deletetopic" method="post" class="inline">{#
#}<input type="hidden" name="topic" value="{{ ctx.topic.id }}">{#
@@ -87,7 +103,14 @@
{{ __("Started by %user% on %date%", {
"user": (ctx.topicAuthor is not null) ? ('<a href="?_action=viewuser&amp;user=' ~ ctx.topicAuthor.id|url_encode|e("html") ~ '">' ~ ctx.topicAuthor.displayName|e("html") ~ '</a>') : __("(deleted)"),
"date": '<span class="_time">' ~ ctx.topic.creationDate.format("c")|e("html") ~ '</span>',
- }) }}
+ }) }} &bull; {{ ___(
+ "%n% person is watching this topic",
+ "%n% people are watching this topic",
+ ctx.subscription_count,
+ {
+ n: ctx.subscription_count,
+ },
+ ) }}
</div>
{% if canEdit %}
<form action="?_action=updatetopic" method="post" id="editHeading" style="display: none;" class="inline">
@@ -216,6 +239,10 @@ $(function() {
}) }}</label><br>
<input type="file" name="files[]" id="i_files" multiple accept="*/*"><br>
<br>
+ {% if not isSubscribed %}
+ <label><input type="checkbox" name="subscribe" value="on" checked> {{ __("Subscribe to topic") }}</label><br>
+ <br>
+ {% endif %}
<button type="submit">{{ __("Post reply") }}</button>
</form>
{% else %}