contentdb/app/templates/threads/view.html

97 lines
3.6 KiB
HTML
Raw Normal View History

2018-06-11 23:49:25 +02:00
{% extends "base.html" %}
{% block title %}
2021-08-17 22:16:43 +02:00
{%- if thread.package -%}
{%- if thread.review -%}
{%- if thread.review.recommends -%}
{%- set rating = "👍" -%}
{%- else -%}
{%- set rating = "👎" -%}
{%- endif -%}
{%- endif -%}
{{ rating }} {{ thread.title }} - {{ thread.package.title }}
2021-08-17 22:16:43 +02:00
{%- else -%}
{{ thread.title }}
{%- endif -%}
{% endblock %}
{% block headextra %}
<meta name="og:title" content="{{ self.title() }}"/>
<meta name="og:description" content="{{ thread.get_description() }}"/>
<meta name="description" content="{{ thread.get_description() }}"/>
<meta name="og:url" content="{{ thread.getViewURL(absolute=True) }}"/>
<meta name="og:image" content="{{ thread.author.getProfilePicURL() }}"/>
2018-06-11 23:49:25 +02:00
{% endblock %}
{% block content %}
2018-12-22 21:13:43 +01:00
{% if current_user.is_authenticated %}
{% if current_user in thread.watchers %}
<form method="post" action="{{ thread.getUnsubscribeURL() }}" class="float-right">
<input type="hidden" name="csrf_token" value="{{ csrf_token() }}" />
2022-01-08 00:27:00 +01:00
<input type="submit" class="btn btn-primary" value="{{ _('Unsubscribe') }}" />
2018-12-22 21:13:43 +01:00
</form>
{% else %}
<form method="post" action="{{ thread.getSubscribeURL() }}" class="float-right">
<input type="hidden" name="csrf_token" value="{{ csrf_token() }}" />
2022-01-08 00:27:00 +01:00
<input type="submit" class="btn btn-primary" value="{{ _('Subscribe') }}" />
2018-12-22 21:13:43 +01:00
</form>
{% endif %}
{% if thread.checkPerm(current_user, "DELETE_THREAD") %}
<a href="{{ url_for('threads.delete_thread', id=thread.id) }}" class="float-right mr-2 btn btn-danger">{{ _('Delete') }}</a>
{% endif %}
{% if thread.review and thread.review.checkPerm(current_user, "DELETE_REVIEW") and current_user.username != thread.review.author.username %}
<form method="post" action="{{ thread.review.getDeleteURL() }}" class="float-right mr-2">
<input type="hidden" name="csrf_token" value="{{ csrf_token() }}" />
<input type="submit" class="btn btn-danger" value="{{ _('Convert to Thread') }}" />
</form>
{% endif %}
{% if thread.checkPerm(current_user, "LOCK_THREAD") %}
2020-07-11 02:34:51 +02:00
{% if thread.locked %}
<form method="post" action="{{ url_for('threads.set_lock', id=thread.id, lock=0) }}" class="float-right mr-2">
<input type="hidden" name="csrf_token" value="{{ csrf_token() }}" />
<input type="submit" class="btn btn-secondary" value="{{ _('Unlock') }}" />
2020-07-11 02:34:51 +02:00
</form>
{% else %}
<form method="post" action="{{ url_for('threads.set_lock', id=thread.id, lock=1) }}" class="float-right mr-2">
<input type="hidden" name="csrf_token" value="{{ csrf_token() }}" />
<input type="submit" class="btn btn-secondary" value="{{ _('Lock') }}" />
2020-07-11 02:34:51 +02:00
</form>
{% endif %}
{% endif %}
2018-12-22 21:13:43 +01:00
{% endif %}
{% if current_user == thread.author and thread.review %}
<a class="btn btn-primary ml-1 float-right mr-2"
2021-07-24 05:30:14 +02:00
href="{{ thread.review.package.getURL("packages.review") }}">
2021-02-28 06:16:15 +01:00
<i class="fas fa-pen"></i>
{{ _("Edit Review") }}
</a>
{% endif %}
2020-07-09 05:10:09 +02:00
<h1>
{% if thread.review %}
{% if thread.review.recommends %}
<i class="fas fa-thumbs-up mr-2" style="color:#6f6;"></i>
{% else %}
<i class="fas fa-thumbs-down mr-2" style="color:#f66;"></i>
{% endif %}
2018-07-28 16:30:59 +02:00
{% endif %}
2020-07-09 05:10:09 +02:00
{% if thread.private %}&#x1f512; {% endif %}{{ thread.title }}
</h1>
{% if thread.package %}
<p>
2022-01-08 00:27:00 +01:00
{{ _("Package") }}: <a href="{{ thread.package.getURL("packages.view") }}">{{ thread.package.title }}</a>
2020-07-09 05:10:09 +02:00
</p>
2018-06-11 23:49:25 +02:00
{% endif %}
{% if thread.private %}
<i>
2022-01-08 00:27:00 +01:00
{{ _("This thread is only visible to its creator, the package owner, and users of Approver rank or above.") }}
2018-06-11 23:49:25 +02:00
</i>
{% endif %}
{% from "macros/threads.html" import render_thread %}
{{ render_thread(thread, current_user) }}
{% endblock %}