89 lines
		
	
	
		
			4.0 KiB
		
	
	
	
		
			HTML
		
	
	
	
	
	
			
		
		
	
	
			89 lines
		
	
	
		
			4.0 KiB
		
	
	
	
		
			HTML
		
	
	
	
	
	
{% from 'common/macros.html' import pager, babycode_editor_form, full_post %}
 | 
						|
{% extends "base.html" %}
 | 
						|
{% block title %}{{ thread.title }}{% endblock %}
 | 
						|
{% block content %}
 | 
						|
{% set can_post = false %}
 | 
						|
{% set can_lock = false %}
 | 
						|
{% set can_subscribe = false %}
 | 
						|
{% if active_user %}
 | 
						|
  {% set can_subscribe = true %}
 | 
						|
  {% set can_post = (not thread.is_locked and not active_user.is_guest()) or active_user.is_mod() %}
 | 
						|
  {% set can_lock = ((active_user.id | int) == (thread.user_id | int)) or active_user.is_mod() %}
 | 
						|
{% endif %}
 | 
						|
<main>
 | 
						|
  <nav class="darkbg">
 | 
						|
    <h1 class="thread-title">{{ thread.title }}</h1>
 | 
						|
    <span>Posted in <a href="{{ url_for("topics.topic", slug=topic.slug) }}">{{ topic.name }}</a>
 | 
						|
    {% if thread.is_stickied %}
 | 
						|
      • <i>stickied, so it's probably important</i>
 | 
						|
    {% endif %}
 | 
						|
    </span>
 | 
						|
    <div>
 | 
						|
      {% if can_subscribe %}
 | 
						|
        <form class="modform" action="{{ url_for('threads.subscribe', slug=thread.slug) }}" method="post">
 | 
						|
          <input type='hidden' name='last_visible_post' value='{{posts[-1].id}}'>
 | 
						|
          <input type='hidden' name='subscribe' value='{{ 'unsubscribe' if is_subscribed else 'subscribe' }}'>
 | 
						|
          <input type='submit' value='{{ 'Unsubscribe' if is_subscribed else 'Subscribe' }}'>
 | 
						|
        </form>
 | 
						|
      {% endif %}
 | 
						|
      {% if can_lock %}
 | 
						|
        <form class="modform" action="{{ url_for("threads.lock", slug=thread.slug) }}" method="post">
 | 
						|
          <input type=hidden name='target_op' value="{{ (not thread.is_locked) | int }}">
 | 
						|
          <input class="warn" type="submit" value="{{"Unlock thread" if thread.is_locked else "Lock thread"}}">
 | 
						|
        </form>
 | 
						|
      {% endif %}
 | 
						|
      {% if active_user and active_user.is_mod() %}
 | 
						|
        <form class="modform" action="{{ url_for("threads.sticky", slug=thread.slug) }}" method="post">
 | 
						|
          <input type=hidden name='target_op' value="{{ (not thread.is_stickied) | int }}">
 | 
						|
          <input class="warn" type="submit" value="{{"Unsticky thread" if thread.is_stickied else "Sticky thread"}}">
 | 
						|
        </form>
 | 
						|
        <form class="modform" action="{{ url_for("threads.move", slug=thread.slug) }}" method="post">
 | 
						|
          <label for="new_topic_id">Move to topic:</label>
 | 
						|
          <select style="width:200px;" id="new_topic_id" name="new_topic_id" autocomplete="off">
 | 
						|
            {% for topic in topics %}
 | 
						|
              <option value="{{ topic['id'] }}" {{ "selected disabled" if (thread.topic_id | string) == (topic['id'] | string) else "" }}>{{ topic['name'] }}</option>
 | 
						|
            {% endfor %}
 | 
						|
          </select>
 | 
						|
          <input class="warn" type="submit" value="Move thread">
 | 
						|
        </form>
 | 
						|
      {% endif %}
 | 
						|
    </div>
 | 
						|
  </nav>
 | 
						|
  {% for post in posts %}
 | 
						|
    {{ full_post(post = post, active_user = active_user, is_latest = loop.index == (posts | length), Reactions = Reactions) }}
 | 
						|
  {% endfor %}
 | 
						|
</main>
 | 
						|
 | 
						|
<nav id="bottomnav">
 | 
						|
  {{ pager(current_page = current_page, page_count = page_count) }}
 | 
						|
</nav>
 | 
						|
 | 
						|
{% if can_post %}
 | 
						|
  <h1>Respond to "{{ thread.title }}"</h1>
 | 
						|
  {{ babycode_editor_form(ta_name = "post_content")}}
 | 
						|
{% endif %}
 | 
						|
<dialog id="delete-dialog">
 | 
						|
  <div class=delete-dialog-inner>
 | 
						|
    Are you sure you want to delete the highlighted post?
 | 
						|
    <span>
 | 
						|
      <button id=post-delete-dialog-close>Cancel</button>
 | 
						|
      <button class="critical" form=post-delete-form>Delete</button>
 | 
						|
      <form id="post-delete-form" method="post"></form>
 | 
						|
    </span>
 | 
						|
  </div>
 | 
						|
</dialog>
 | 
						|
<input type='hidden' id='allowed-reaction-emoji' value='{{ REACTION_EMOJI | join(' ') }}'>
 | 
						|
<input type='hidden' id='thread-subscribe-endpoint' value='{{ url_for('api.thread_updates', thread_id=thread.id) }}'>
 | 
						|
<div id="new-post-notification" class="new-concept-notification hidden">
 | 
						|
  <div class="new-notification-content">
 | 
						|
    <p>New post in thread!</p>
 | 
						|
    <span class="notification-buttons">
 | 
						|
      <button id="dismiss-new-post-button">Dismiss</button>
 | 
						|
      <a class="linkbutton" id="go-to-new-post-button">View post</a>
 | 
						|
      <button id="unsub-new-post-button">Stop updates</button>
 | 
						|
    </span>
 | 
						|
  </div>
 | 
						|
</div>
 | 
						|
<script src="{{ "/static/js/thread.js" | cachebust }}"></script>
 | 
						|
{% endblock %}
 |