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

99 lines
4.2 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=posts_path(forum_id: @forum.id, subject: @topic.title)
/ i.fa.fa-fw.fa-search>
/ | Search Posts
.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
/= render partial: 'polls/display', locals: { poll: @topic.poll }
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 do
= render PhilomenaWeb.PostView, "_post.html", conn: @conn, post: post, body: body
2019-10-06 23:31:48 +02:00
2019-11-11 19:01:46 +01:00
/include ../adverts/_box.html.slim
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-11-11 19:01:46 +01:00
/ Post form
= if @topic.post_count < 200_000 do
2019-11-18 04:31:28 +01:00
= render PhilomenaWeb.Topic.PostView, "_form.html", conn: @conn, forum: @forum, topic: @topic, changeset: @changeset
2019-11-11 19:01:46 +01:00
- else
/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.
2019-10-06 23:31:48 +02:00
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?(:unlock, @topic) && !@topic.locked_at.nil?
/ => button_to forum_topic_lock_path(@forum, @topic), method: :delete, class: 'button' do
/ i.fa.fa-lock>
/ | Unlock
/ - if can?(:stick, @topic) && !@topic.sticky
/ => button_to forum_topic_stick_path(@forum, @topic), method: :post, class: 'button' do
/ i.fa.fa-thumbtack>
/ | Stick
/ - if can?(:stick, @topic) && @topic.sticky
/ => button_to forum_topic_stick_path(@forum, @topic), method: :delete, class: 'button' do
/ i.fa.fa-thumbtack>
/ | Unstick
/ - if can?(:lock, @topic) && @topic.locked_at.nil?
/ = form_tag forum_topic_lock_path(@forum, @topic), method: :post, class: 'hform' do
/ .field
/ => text_field_tag :lock_reason, '', placeholder: 'Lock reason', class: 'input hform__text'
/ => button_tag class: 'hform__button button' do
/ i.fa.fa-unlock>
/ | Lock
/ - if can? :move, @topic
/ = form_tag forum_topic_move_path(@forum, @topic), method: :post, class: 'hform' do
/ .field
/ => select_tag :target_forum_id, options_from_collection_for_select(Forum.where.not(id: @forum.id).all, :short_name, :name), class: 'input hform__text'
/ => button_tag class: 'hform__button button' do
/ i.fa.fa-truck>
/ | Move
/ - 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