summaryrefslogtreecommitdiff
path: root/src/application/templates/modern/view_topic.twig
diff options
context:
space:
mode:
Diffstat (limited to 'src/application/templates/modern/view_topic.twig')
-rw-r--r--src/application/templates/modern/view_topic.twig34
1 files changed, 33 insertions, 1 deletions
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>