mirror of
https://github.com/philomena-dev/philomena.git
synced 2024-12-01 07:18:00 +01:00
224 lines
8.3 KiB
Text
224 lines
8.3 KiB
Text
<% route = fn p -> ~p"/forums/#{@forum}/topics/#{@topic}?#{p}" end %>
|
|
<% pagination = render(PhilomenaWeb.PaginationView, "_pagination.html", page: @posts, route: route, last: true) %>
|
|
<h1>
|
|
<%= @topic.title %>
|
|
</h1>
|
|
<%= if @topic.hidden_from_users do %>
|
|
<div class="block block--fixed block--danger">
|
|
<h4>
|
|
This topic has been deleted by a moderator
|
|
</h4>
|
|
<p>
|
|
<strong>
|
|
Reason:
|
|
</strong>
|
|
<em>
|
|
<%= @topic.deletion_reason %>
|
|
</em>
|
|
</p>
|
|
<%= if can?(@conn, :hide, @topic) do %>
|
|
<p>
|
|
<strong>
|
|
Deleted by:
|
|
</strong>
|
|
<em>
|
|
<strong>
|
|
<%= link(@topic.deleted_by.name, to: ~p"/profiles/#{@topic.deleted_by}") %>
|
|
</strong>
|
|
</em>
|
|
</p>
|
|
<p>
|
|
<%= link(to: ~p"/forums/#{@forum}/topics/#{@topic}/hide", method: :delete, class: "button") do %>
|
|
<i class="fas fa-check"></i>
|
|
Restore
|
|
<% end %>
|
|
</p>
|
|
<% end %>
|
|
</div>
|
|
<% end %>
|
|
<% # Header section %>
|
|
<div class="block">
|
|
<div class="block__header">
|
|
<%= link(@forum.name, to: ~p"/forums/#{@forum}") %>
|
|
»
|
|
<%= link(@topic.title, to: ~p"/forums/#{@forum}/topics/#{@topic}") %>
|
|
<%= if not @topic.hidden_from_users or can?(@conn, :hide, @topic) do %>
|
|
<a href={~p"/posts?#{[pq: "topic_id:#{@topic.id}"]}"}>
|
|
<i class="fa fa-fw fa-search"></i>
|
|
Search Posts
|
|
</a>
|
|
<div class="flex flex--wrap block__header block__header--light page__header">
|
|
<div class="flex--fixed page__pagination">
|
|
<%= pagination %>
|
|
</div>
|
|
<div class="flex--fixed block__header__item page__options">
|
|
Started by
|
|
<%= render(PhilomenaWeb.UserAttributionView, "_anon_user.html", object: @topic, conn: @conn) %>
|
|
</div>
|
|
<div class="page__info">
|
|
<div class="flex flex--center-distributed">
|
|
<div class="flex--fixed block__header__item">
|
|
Posted
|
|
<%= pretty_time(@topic.created_at) %>
|
|
</div>
|
|
<div class="flex--fixed block__header__item">
|
|
<%= @topic.post_count - 1 %>
|
|
replies
|
|
</div>
|
|
<%= if not @topic.hidden_from_users do %>
|
|
<%= render(PhilomenaWeb.Topic.SubscriptionView, "_subscription.html", forum: @forum, topic: @topic, watching: @watching, conn: @conn) %>
|
|
<% end %>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<% end %>
|
|
</div>
|
|
</div>
|
|
<%= if not @topic.hidden_from_users or can?(@conn, :hide, @topic) do %>
|
|
<% # Display the poll, if any %>
|
|
<%= if @topic.poll do %>
|
|
<%= render(PhilomenaWeb.Topic.PollView, "_display.html", Map.put(assigns, :poll, @topic.poll)) %>
|
|
<% end %>
|
|
<% # The actual posts %>
|
|
<div class="posts-area">
|
|
<div class="post-list">
|
|
<%= for {post, body} <- @posts, can_view_communication?(@conn, post) do %>
|
|
<%= render(PhilomenaWeb.PostView, "_post.html", conn: @conn, post: post, body: body) %>
|
|
<% end %>
|
|
<%= if @conn.assigns.advert do %>
|
|
<%= render(PhilomenaWeb.AdvertView, "_box.html", advert: @conn.assigns.advert, conn: @conn) %>
|
|
<% end %>
|
|
<% # Footer section %>
|
|
<div class="block">
|
|
<div class="block__header block__header--light page__header">
|
|
<div class="page__pagination">
|
|
<%= pagination %>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<%= if @topic.locked_at do %>
|
|
<div class="block block--fixed block--warning">
|
|
<h4>
|
|
This topic has been locked to new posts from non-moderators.
|
|
</h4>
|
|
<p>
|
|
Locked
|
|
<%= pretty_time(@topic.locked_at) %>
|
|
</p>
|
|
<p>
|
|
Lock reason:
|
|
<em>
|
|
<%= @topic.lock_reason %>
|
|
</em>
|
|
</p>
|
|
<%= if can?(@conn, :hide, @topic) and not is_nil(@topic.locked_by) do %>
|
|
<p>
|
|
Locked by:
|
|
<em>
|
|
<strong>
|
|
<%= link(@topic.locked_by.name, to: ~p"/profiles/#{@topic.locked_by}") %>
|
|
</strong>
|
|
</em>
|
|
</p>
|
|
<% end %>
|
|
</div>
|
|
<% end %>
|
|
</div>
|
|
</div>
|
|
<% # Post form %>
|
|
<%= cond do %>
|
|
<% @conn.assigns.current_ban -> %>
|
|
<%= render(PhilomenaWeb.BanView, "_ban_reason.html", conn: @conn) %>
|
|
<% @topic.hidden_from_users -> %>
|
|
<div class="block block--fixed block--danger">
|
|
<h4>
|
|
Cannot reply to a deleted topic.
|
|
</h4>
|
|
</div>
|
|
<% @topic.post_count < 200_000 and can?(@conn, :create_post, @topic) -> %>
|
|
<%= render(PhilomenaWeb.Topic.PostView, "_form.html", conn: @conn, forum: @forum, topic: @topic, changeset: @changeset) %>
|
|
<% @topic.post_count >= 200_000 -> %>
|
|
<h3>
|
|
Okay, we're impressed
|
|
</h3>
|
|
<p>
|
|
You're looking at a thread with over 200,000 posts in it!
|
|
</p>
|
|
<p>
|
|
For various reasons, we'd like to ask you to start a new topic.
|
|
</p>
|
|
<% true -> %>
|
|
<% end %>
|
|
<%= if can?(@conn, :hide, @topic) do %>
|
|
<div class="block__content block__content--top-border">
|
|
<input class="toggle-box" id="administrator_tools" type="checkbox" />
|
|
<label for="administrator_tools">
|
|
Manage Topic
|
|
</label>
|
|
<div class="toggle-box-container">
|
|
<div class="toggle-box-container__content">
|
|
<p>
|
|
<%= if not @topic.hidden_from_users do %>
|
|
<%= if @topic.sticky do %>
|
|
<%= link(to: ~p"/forums/#{@forum}/topics/#{@topic}/stick", method: :delete, class: "button") do %>
|
|
<i class="fas fa-thumbtack"></i>
|
|
Unstick
|
|
<% end %>
|
|
<% else %>
|
|
<%= link(to: ~p"/forums/#{@forum}/topics/#{@topic}/stick", method: :post, class: "button") do %>
|
|
<i class="fas fa-thumbtack"></i>
|
|
Stick
|
|
<% end %>
|
|
<% end %>
|
|
<%= if @topic.locked_at do %>
|
|
<%= link(to: ~p"/forums/#{@forum}/topics/#{@topic}/lock", method: :delete, class: "button") do %>
|
|
<i class="fas fa-unlock"></i>
|
|
Unlock
|
|
<% end %>
|
|
<% else %>
|
|
<%= form_for :topic, ~p"/forums/#{@forum}/topics/#{@topic}/lock", [method: :post, class: "hform"], fn f -> %>
|
|
<div class="field">
|
|
<%= text_input(f, :lock_reason, class: "input hform__text", placeholder: "Lock reason", required: true) %>
|
|
<%= submit class: "hform__button button" do %>
|
|
<i class="fas fa-lock"></i>
|
|
Lock
|
|
<% end %>
|
|
</div>
|
|
<% end %>
|
|
<% end %>
|
|
<%= form_for @topic_changeset, ~p"/forums/#{@forum}/topics/#{@topic}", [method: :put, class: "hform"], fn f -> %>
|
|
<div class="field">
|
|
<%= text_input(f, :title, class: "input hform__text", placeholder: "New Title") %>
|
|
<%= submit class: "hform__button button" do %>
|
|
<i class="fas fa-pen"></i>
|
|
Set Title
|
|
<% end %>
|
|
</div>
|
|
<% end %>
|
|
<%= form_for :topic, ~p"/forums/#{@forum}/topics/#{@topic}/move", [method: :post, class: "hform"], fn f -> %>
|
|
<div class="field">
|
|
<%= select(f, :target_forum_id, Enum.map(@conn.assigns.forums, &{&1.name, &1.id}), class: "input hform__text") %>
|
|
<%= submit class: "hform__button button" do %>
|
|
<i class="fas fa-truck"></i>
|
|
Move
|
|
<% end %>
|
|
</div>
|
|
<% end %>
|
|
<%= form_for :topic, ~p"/forums/#{@forum}/topics/#{@topic}/hide", [method: :post, class: "hform"], fn f -> %>
|
|
<div class="field">
|
|
<%= text_input(f, :deletion_reason, class: "input hform__text", placeholder: "Deletion reason", required: true) %>
|
|
<%= submit class: "hform__button button" do %>
|
|
<i class="fas fa-trash"></i>
|
|
Delete
|
|
<% end %>
|
|
</div>
|
|
<% end %>
|
|
<% else %>
|
|
Moderation tools unavailable for deleted topics.
|
|
<% end %>
|
|
</p>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<% end %>
|
|
<% end %>
|