diff options
| author | rubenwardy <rw@rubenwardy.com> | 2018-07-28 15:30:59 +0100 |
|---|---|---|
| committer | rubenwardy <rw@rubenwardy.com> | 2018-07-28 15:30:59 +0100 |
| commit | e82166f87e89f329e9fd94a26dfc8651c69deb91 (patch) | |
| tree | 43fc3c193295dba4d6c235d0910b8999ae85a93b /app/templates/threads | |
| parent | 909a2b4ce9ffd325fff06cc26d996c19ca117aa6 (diff) | |
| download | cheatdb-e82166f87e89f329e9fd94a26dfc8651c69deb91.tar.xz | |
Add subscribe/unsubscribe button
Diffstat (limited to 'app/templates/threads')
| -rw-r--r-- | app/templates/threads/view.html | 21 |
1 files changed, 17 insertions, 4 deletions
diff --git a/app/templates/threads/view.html b/app/templates/threads/view.html index 397fba3..71580de 100644 --- a/app/templates/threads/view.html +++ b/app/templates/threads/view.html @@ -6,11 +6,24 @@ Threads {% block content %} <h1>{% if thread.private %}🔒 {% endif %}{{ thread.title }}</h1> + {% if thread.package or current_user.is_authenticated %} + {% if thread.package %} + <p>Package: <a href="{{ thread.package.getDetailsURL() }}">{{ thread.package.title }}</a></p> + {% endif %} - {% if thread.package %} - <p> - Package: <a href="{{ thread.package.getDetailsURL() }}">{{ thread.package.title }}</a> - </p> + {% if current_user.is_authenticated %} + {% if current_user in thread.watchers %} + <form method="post" action="{{ thread.getUnsubscribeURL() }}"> + <input type="hidden" name="csrf_token" value="{{ csrf_token() }}" /> + <input type="submit" value="Unsubscribe" /> + </form> + {% else %} + <form method="post" action="{{ thread.getSubscribeURL() }}"> + <input type="hidden" name="csrf_token" value="{{ csrf_token() }}" /> + <input type="submit" value="Subscribe" /> + </form> + {% endif %} + {% endif %} {% endif %} {% if thread.private %} |
