philomena/lib/philomena_web/templates/communication/_body.html.slime

85 lines
2.9 KiB
Text
Raw Normal View History

2024-05-07 19:33:56 +02:00
- anon = is_nil(assigns[:noanon]) or @noanon == false
2024-05-31 20:07:00 +02:00
- options = if is_nil(assigns[:options]), do: "", else: @options
2024-06-06 20:21:21 +02:00
- deleted = Map.has_key?(@object, :hidden_from_users) and @object.hidden_from_users == true
2024-05-07 19:33:56 +02:00
- avatar = cond do
- not is_nil(assigns[:image]) ->
2024-05-20 19:04:12 +02:00
.post-image-container.media__standalone
2024-05-07 19:33:56 +02:00
= 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
2024-06-06 20:21:21 +02:00
- 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
2024-05-07 19:33:56 +02:00
= if can?(@conn, :hide, @object) and not is_nil(@object.deleted_by) do
2024-06-06 20:21:21 +02:00
span
i.fa.fa-user>
strong Moderator:
=<> @object.deleted_by.name
= if not @object.destroyed_content and can?(@conn, :hide, @object) do
=<> @body
2024-05-07 19:33:56 +02:00
- else
=<> @body
2024-06-06 20:21:21 +02:00
- hidden_if_deleted = if deleted, do: "hidden", else: ""
- deleted_class = if deleted, do: "communication--deleted", else: ""
.flex.flex__grow.hidden--mobile class=deleted_class
.flex.flex__fixed.spacing--right class=hidden_if_deleted
2024-05-07 19:33:56 +02:00
= avatar
.flex__grow.communication__body
.communication__sender-block
span.communication__sender-name
= username
2024-05-31 20:07:00 +02:00
.flex__spacer
span.communication__post-time
' Posted
=< pretty_time(@object.created_at)
= options
2024-06-06 20:21:21 +02:00
div class=hidden_if_deleted
= title
2024-05-07 19:33:56 +02:00
.communication__body__text
= contents
2024-06-06 20:21:21 +02:00
.flex.flex__column.flex__grow.hidden--desktop class=deleted_class
2024-05-07 19:33:56 +02:00
.communication__sender-block
2024-06-06 20:21:21 +02:00
div class=hidden_if_deleted
= avatar
2024-05-07 19:33:56 +02:00
.flex__column.flex--small-gap
span.communication__sender-name
= username
2024-06-06 20:21:21 +02:00
div class=hidden_if_deleted
= title
2024-05-31 20:07:00 +02:00
span.communication__post-time
' Posted
= pretty_time(@object.created_at)
= options
2024-05-07 19:33:56 +02:00
.communication__body.communication__body__text
= contents