philomena/lib/philomena_web/templates/communication/_body.html.slime
2024-06-06 23:16:49 +02:00

85 lines
No EOL
2.9 KiB
Text

elixir:
anon = is_nil(assigns[:noanon]) or @noanon == false
options = if is_nil(assigns[:options]), do: "", else: @options
deleted = Map.has_key?(@object, :hidden_from_users) and @object.hidden_from_users == true
hidden_if_deleted = if deleted, do: "hidden", else: ""
deleted_class = if deleted, do: "communication--deleted", else: ""
- avatar = cond do
- not is_nil(assigns[:image]) ->
.post-image-container.media__standalone
= render PhilomenaWeb.ImageView, "_image_container.html", image: @image, size: :thumb_tiny, conn: @conn
- anon ->
= render PhilomenaWeb.UserAttributionView, "_anon_user_avatar.html", object: @object, conn: @conn
- true ->
= render PhilomenaWeb.UserAttributionView, "_user_avatar.html", object: @object, conn: @conn, class: "avatar--small"
- username = if anon do
= render PhilomenaWeb.UserAttributionView, "_anon_user.html", object: @object, awards: true, conn: @conn
- else
= render PhilomenaWeb.UserAttributionView, "_user.html", object: @object, badges: true, conn: @conn
- title = if anon do
= render PhilomenaWeb.UserAttributionView, "_anon_user_title.html", object: @object, conn: @conn
- else
= render PhilomenaWeb.UserAttributionView, "_user_title.html", object: @object, conn: @conn
- contents = if deleted do
= if @object.destroyed_content and can?(@conn, :hide, @object) do
div.communication__body__text--deleted
span
i.fa.fa-eye-slash>
strong
' Not shown to users, this
=> @name
| is destroyed.
div.communication__body__text--deleted
span
i.fa.fa-trash-can>
strong This #{@name} has been deleted.
span
i.fa.fa-circle-info>
strong Reason:
=<> @object.deletion_reason
= if can?(@conn, :hide, @object) and not is_nil(@object.deleted_by) do
span
i.fa.fa-user>
strong Moderator:
=<> @object.deleted_by.name
= if not @object.destroyed_content and can?(@conn, :hide, @object) do
=<> @body
- else
=<> @body
.flex.flex__grow.hidden--mobile class=deleted_class
.flex.flex__fixed.spacing--right class=hidden_if_deleted
= avatar
.flex__grow.communication__body
.communication__sender-block
span.communication__sender-name
= username
.flex__spacer
span.communication__post-time
' Posted
=< pretty_time(@object.created_at)
= options
div class=hidden_if_deleted
= title
.communication__body__text
= contents
.flex.flex__column.flex__grow.hidden--desktop class=deleted_class
.communication__sender-block
div class=hidden_if_deleted
= avatar
.flex__column.flex--small-gap
span.communication__sender-name
= username
div class=hidden_if_deleted
= title
span.communication__post-time
' Posted
= pretty_time(@object.created_at)
= options
.communication__body.communication__body__text
= contents