philomena/lib/philomena_web/templates/topic/show.html.slime
2019-12-19 22:41:19 -05:00

148 lines
5.7 KiB
Text

- route = fn p -> Routes.forum_topic_path(@conn, :show, @forum, @topic, p) end
- pagination = render PhilomenaWeb.PaginationView, "_pagination.html", page: @posts, route: route, last: true
h1 = @topic.title
= if @topic.hidden_from_users do
.block.block--fixed.block--danger
h4 This topic has been deleted by a moderator
p
strong> Reason:
em
= @topic.deletion_reason
= if can?(@conn, :hide, @topic) do
p
strong> Deleted by:
em
strong
= link(@topic.deleted_by.name, to: Routes.profile_path(@conn, :show, @topic.deleted_by))
p
= link(to: Routes.forum_topic_hide_path(@conn, :delete, @forum, @topic), method: :delete, class: "button") do
i.fas.fa-check>
' Restore
/ Header section
.block
.block__header
=> link("Forums", to: Routes.forum_path(@conn, :index))
' »
=> link(@forum.name, to: Routes.forum_path(@conn, :show, @forum))
' »
=> link(@topic.title, to: Routes.forum_topic_path(@conn, :show, @forum, @topic))
= if not @topic.hidden_from_users or can?(@conn, :hide, @topic) do
a href=Routes.post_path(@conn, :index, pq: "topic_id:#{@topic.id}")
i.fa.fa-fw.fa-search>
' Search Posts
.flex.flex--wrap.block__header.block__header--light
.flex--fixed
= pagination
.flex--fixed.block__header__item
' Started by
=> render PhilomenaWeb.UserAttributionView, "_anon_user.html", object: @topic, conn: @conn
.flex--fixed.block__header__item
' Posted
=< pretty_time(@topic.created_at)
.flex--fixed.block__header__item
=> @topic.post_count - 1
' replies
= if not @topic.hidden_from_users do
= render PhilomenaWeb.Topic.SubscriptionView, "_subscription.html", forum: @forum, topic: @topic, watching: @watching, conn: @conn
= 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)
/ The actual posts
.posts-area
.post-list
= for {post, body} <- @posts, (!post.destroyed_content or can?(@conn, :hide, post)) do
= render PhilomenaWeb.PostView, "_post.html", conn: @conn, post: post, body: body
= if @conn.assigns.advert do
= render PhilomenaWeb.AdvertView, "_box.html", advert: @conn.assigns.advert, conn: @conn
/ Footer section
.block
.block__header.block__header--light
= pagination
= if @topic.locked_at do
.block.block--fixed.block--warning
h4 This topic has been locked to new posts from non-moderators.
p
' Locked
=> pretty_time(@topic.locked_at)
p
' Lock reason:
em = @topic.lock_reason
/ Post form
= cond do
- @conn.assigns.current_ban ->
= render PhilomenaWeb.BanView, "_ban_reason.html", conn: @conn
- @topic.hidden_from_users ->
.block.block--fixed.block--danger
h4 Cannot reply to a deleted topic.
- @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
p You're looking at a thread with over 200,000 posts in it!
p For various reasons, we'd like to ask you to start a new topic.
- true ->
= if can?(@conn, :hide, @topic) do
.block__content
input.toggle-box id="administrator_tools" type="checkbox" checked=false
label for="administrator_tools" Manage Topic
.toggle-box-container
.toggle-box-container__content
p
= if not @topic.hidden_from_users do
= if @topic.locked_at do
= link(to: Routes.forum_topic_lock_path(@conn, :delete, @forum, @topic), method: :delete, class: "button") do
i.fas.fa-unlock>
' Unlock
- else
= form_for :topic, Routes.forum_topic_lock_path(@conn, :create, @forum, @topic), [method: :post, class: "hform"], fn f ->
= text_input f, :lock_reason, class: "input hform__text", placeholder: "Lock reason", required: true
= submit class: "hform__button button" do
i.fas.fa-lock>
' Lock
= if @topic.sticky do
= link(to: Routes.forum_topic_stick_path(@conn, :delete, @forum, @topic), method: :delete, class: "button") do
i.fas.fa-thumbtack>
' Unstick
- else
= link(to: Routes.forum_topic_stick_path(@conn, :create, @forum, @topic), method: :post, class: "button") do
i.fas.fa-thumbtack>
' Stick
= form_for :topic, Routes.forum_topic_move_path(@conn, :create, @forum, @topic), [method: :post, class: "hform"], fn f ->
.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.fas.fa-truck>
' Move
= form_for :topic, Routes.forum_topic_hide_path(@conn, :create, @forum, @topic), [method: :post, class: "hform"], fn f ->
.field
= text_input f, :deletion_reason, class: "input hform__text", placeholder: "Deletion reason", required: true
= submit class: "hform__button button" do
i.fas.fa-trash>
' Delete
- else
| Moderation tools unavailable for deleted topics.