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

128 lines
5.4 KiB
Text
Raw Normal View History

elixir:
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
2019-10-09 01:30:51 +02:00
2019-10-06 23:31:48 +02:00
h1 = @topic.title
/ 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))
a href=Routes.post_path(@conn, :index, pq: "topic_id:#{@topic.id}")
i.fa.fa-fw.fa-search>
' Search Posts
2019-10-06 23:31:48 +02:00
.flex.flex--wrap.block__header.block__header--light
2019-10-09 01:30:51 +02:00
.flex--fixed
= pagination
2019-10-06 23:31:48 +02:00
.flex--fixed.block__header__item
' Started by
2019-11-12 02:27:09 +01:00
=> render PhilomenaWeb.UserAttributionView, "_anon_user.html", object: @topic, conn: @conn
2019-10-06 23:31:48 +02:00
.flex--fixed.block__header__item
' Posted
=< pretty_time(@topic.created_at)
.flex--fixed.block__header__item
=> @topic.post_count - 1
' replies
2019-11-17 19:05:50 +01:00
= render PhilomenaWeb.Topic.SubscriptionView, "_subscription.html", forum: @forum, topic: @topic, watching: @watching, conn: @conn
2019-10-06 23:31:48 +02:00
2019-11-11 19:01:46 +01:00
/ Display the poll, if any
2019-11-18 19:09:59 +01:00
= if @topic.poll do
2019-11-18 19:13:31 +01:00
= render PhilomenaWeb.Topic.PollView, "_display.html", poll: @topic.poll, conn: @conn
2019-10-06 23:31:48 +02:00
2019-11-11 19:01:46 +01:00
/ The actual posts
.posts-area
.post-list
= for {post, body} <- @posts, (!post.destroyed_content or can?(@conn, :hide, post)) do
2019-11-11 19:01:46 +01:00
= render PhilomenaWeb.PostView, "_post.html", conn: @conn, post: post, body: body
2019-10-06 23:31:48 +02:00
2019-11-29 07:26:05 +01:00
= if @conn.assigns.advert do
2019-11-29 07:28:04 +01:00
= render PhilomenaWeb.AdvertView, "_box.html", advert: @conn.assigns.advert, conn: @conn
2019-10-06 23:31:48 +02:00
2019-11-11 19:01:46 +01:00
/ Post editability data for JS
/.js-editable-posts data-editable=editable_communications(@posts).to_json
2019-10-06 23:31:48 +02:00
2019-11-11 19:01:46 +01:00
/ Footer section
.block
.block__header.block__header--light
= pagination
2019-10-06 23:31:48 +02:00
2019-12-11 04:28:12 +01:00
= if @topic.locked_at do
2019-12-11 04:29:27 +01:00
.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-11 04:29:27 +01:00
p
' Lock reason:
em = @topic.lock_reason
2019-12-11 04:28:12 +01:00
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-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 00:31:42 +01:00
= if can?(@conn, :assist, 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
= cond do
- can?(@conn, :lock, @topic) and is_nil(@topic.locked_at) ->
= form_for :topic, Routes.forum_topic_lock_path(@conn, :create, @topic.forum_id, @topic), [method: :post, class: "hform"], fn f ->
= text_input f, :lock_reason, class: "input hform__text", placeholder: "Lock reason"
= submit class: "hform__button button" do
i.fas.fa-lock>
' Lock
- can?(@conn, :unlock, @topic) and not is_nil(@topic.locked_at) ->
= link(to: Routes.forum_topic_lock_path(@conn, :delete, @topic.forum_id, @topic), method: :delete, class: "button") do
i.fas.fa-unlock>
' Unlock
- true ->
= cond do
- can?(@conn, :stick, @topic) and @topic.sticky ->
= link(to: Routes.forum_topic_stick_path(@conn, :delete, @topic.forum_id, @topic), method: :delete, class: "button") do
i.fas.fa-thumbtack>
' Unstick
- can?(@conn, :stick, @topic) and not @topic.sticky ->
= link(to: Routes.forum_topic_stick_path(@conn, :create, @topic.forum_id, @topic), method: :post, class: "button") do
i.fas.fa-thumbtack>
' Stick
- true ->
2019-12-14 17:10:33 +01:00
= if can?(@conn, :move, @topic) do
= form_for :topic, Routes.forum_topic_move_path(@conn, :create, @topic.forum_id, @topic), [method: :post, class: "hform"], fn f ->
.field
= select f, :target_forum_id, @conn.assigns.forums |> Enum.map(fn forum -> {forum.name, forum.id} end), class: "input hform__text"
= submit class: "hform__button button" do
i.fas.fa-truck>
' Move
2019-11-11 19:01:46 +01:00
/ Mod tools
/- if can? :assist, Topic
/ .block__content
/ input.toggle-box id="administrator_tools" type="checkbox" checked=false
/ label for="administrator_tools" Topic Admin Tools
/ .toggle-box-container
/ .toggle-box-container__content
/ p
/ - if can?(:destroy, @topic) && !@topic.hidden_from_users
/ = form_tag forum_topic_hide_path(@forum, @topic), method: :post, class: 'hform' do
/ .field
/ => text_field_tag :deletion_reason, '', placeholder: 'Deletion reason', required: true, class: 'input hform__text'
/ => button_tag class: 'hform__button button' do
/ i.fa.fa-trash>
/ | Delete