philomena/lib/philomena_web/templates/topic/show.html.slime

164 lines
6.3 KiB
Text
Raw Permalink Normal View History

- route = fn p -> ~p"/forums/#{@forum}/topics/#{@topic}?#{p}" end
2019-12-14 20:46:50 +01:00
- pagination = render PhilomenaWeb.PaginationView, "_pagination.html", page: @posts, route: route, last: true
2019-10-09 01:30:51 +02:00
2019-10-06 23:31:48 +02:00
h1 = @topic.title
2019-12-14 20:46:50 +01:00
2019-12-14 19:03:11 +01:00
= if @topic.hidden_from_users do
.block.block--fixed.block--danger
2019-12-14 19:10:27 +01:00
h4 This topic has been deleted by a moderator
2019-12-14 19:03:11 +01:00
p
strong> Reason:
em
= @topic.deletion_reason
2019-12-14 20:46:50 +01:00
= if can?(@conn, :hide, @topic) do
2019-12-14 19:03:11 +01:00
p
strong> Deleted by:
em
strong
= link(@topic.deleted_by.name, to: ~p"/profiles/#{@topic.deleted_by}")
2019-12-14 20:46:50 +01:00
2019-12-14 19:03:11 +01:00
p
= link(to: ~p"/forums/#{@forum}/topics/#{@topic}/hide", method: :delete, class: "button") do
2019-12-14 19:03:11 +01:00
i.fas.fa-check>
' Restore
2019-12-14 20:46:50 +01:00
2019-10-06 23:31:48 +02:00
/ Header section
.block
.block__header
=> link(@forum.name, to: ~p"/forums/#{@forum}")
2019-10-06 23:31:48 +02:00
' »
=> link(@topic.title, to: ~p"/forums/#{@forum}/topics/#{@topic}")
2019-12-14 20:46:50 +01:00
2019-12-14 19:03:11 +01:00
= if not @topic.hidden_from_users or can?(@conn, :hide, @topic) do
a href=~p"/posts?#{[pq: "topic_id:#{@topic.id}"]}"
2019-12-14 19:03:11 +01:00
i.fa.fa-fw.fa-search>
' Search Posts
2020-12-11 17:53:40 +01:00
.flex.flex--wrap.block__header.block__header--light.page__header
.flex--fixed.page__pagination
2019-12-14 19:03:11 +01:00
= pagination
2020-12-11 17:53:40 +01:00
.flex--fixed.block__header__item.page__options
2019-12-14 19:03:11 +01:00
' Started by
=> render PhilomenaWeb.UserAttributionView, "_anon_user.html", object: @topic, conn: @conn
2020-12-11 17:53:40 +01:00
.page__info
.flex.flex--center-distributed
.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
2019-10-06 23:31:48 +02:00
2019-12-14 19:03:11 +01:00
= if not @topic.hidden_from_users or can?(@conn, :hide, @topic) do
/ Display the poll, if any
= if @topic.poll do
2019-12-20 04:41:19 +01:00
= render PhilomenaWeb.Topic.PollView, "_display.html", Map.put(assigns, :poll, @topic.poll)
2019-10-06 23:31:48 +02:00
2019-12-14 19:03:11 +01:00
/ The actual posts
.posts-area
.post-list
2022-03-22 22:23:30 +01:00
= for {post, body} <- @posts, can_view_communication?(@conn, post) do
2019-12-14 19:03:11 +01:00
= render PhilomenaWeb.PostView, "_post.html", conn: @conn, post: post, body: body
2019-10-06 23:31:48 +02:00
2019-12-14 19:03:11 +01:00
= if @conn.assigns.advert do
= render PhilomenaWeb.AdvertView, "_box.html", advert: @conn.assigns.advert, conn: @conn
2019-10-06 23:31:48 +02:00
2019-12-14 19:03:11 +01:00
/ Footer section
.block
2020-12-11 17:53:40 +01:00
.block__header.block__header--light.page__header
.page__pagination = pagination
2019-12-11 04:28:12 +01:00
2019-12-14 19:03:11 +01:00
= 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)
2019-12-11 04:28:12 +01:00
2019-12-14 19:03:11 +01:00
p
' Lock reason:
em = @topic.lock_reason
2019-12-14 20:46:50 +01:00
= 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}")
2019-11-11 19:01:46 +01:00
/ Post form
2019-12-07 00:25:05 +01:00
= cond do
2019-12-13 18:14:34 +01:00
- @conn.assigns.current_ban ->
= render PhilomenaWeb.BanView, "_ban_reason.html", conn: @conn
2019-12-14 19:03:11 +01:00
- @topic.hidden_from_users ->
.block.block--fixed.block--danger
h4 Cannot reply to a deleted topic.
2019-12-07 00:25:05 +01:00
- @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 ->
2019-12-07 00:25:05 +01:00
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 ->
2019-12-14 20:46:50 +01:00
= if can?(@conn, :hide, @topic) do
.block__content.block__content--top-border
2019-12-14 00:31:42 +01:00
input.toggle-box id="administrator_tools" type="checkbox" checked=false
label for="administrator_tools" Manage Topic
.toggle-box-container
.toggle-box-container__content
p
2019-12-14 19:03:11 +01:00
= if not @topic.hidden_from_users do
2019-12-14 20:46:50 +01:00
= if @topic.sticky do
= link(to: ~p"/forums/#{@forum}/topics/#{@topic}/stick", method: :delete, class: "button") do
2019-12-14 20:46:50 +01:00
i.fas.fa-thumbtack>
' Unstick
- else
= link(to: ~p"/forums/#{@forum}/topics/#{@topic}/stick", method: :post, class: "button") do
2019-12-14 20:46:50 +01:00
i.fas.fa-thumbtack>
' Stick
= if @topic.locked_at do
= link(to: ~p"/forums/#{@forum}/topics/#{@topic}/lock", method: :delete, class: "button") do
i.fas.fa-unlock>
' Unlock
- else
= form_for :topic, ~p"/forums/#{@forum}/topics/#{@topic}/lock", [method: :post, class: "hform"], fn f ->
.field
= 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
= form_for @topic_changeset, ~p"/forums/#{@forum}/topics/#{@topic}", [method: :put, class: "hform"], fn f ->
.field
= text_input f, :title, class: "input hform__text", placeholder: "New Title"
= submit class: "hform__button button" do
i.fas.fa-pen>
' Set Title
= form_for :topic, ~p"/forums/#{@forum}/topics/#{@topic}/move", [method: :post, class: "hform"], fn f ->
2019-12-14 20:46:50 +01:00
.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, ~p"/forums/#{@forum}/topics/#{@topic}/hide", [method: :post, class: "hform"], fn f ->
2019-12-14 20:46:50 +01:00
.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
2019-12-14 19:03:11 +01:00
- else
| Moderation tools unavailable for deleted topics.