use comment listing with images

This commit is contained in:
byte[] 2019-11-17 15:37:01 -05:00
parent a8fef6d03c
commit 850a0d758e
5 changed files with 31 additions and 16 deletions

View file

@ -19,7 +19,7 @@ defmodule PhilomenaWeb.CommentController do
sort: %{posted_at: :desc}
},
conn.assigns.pagination,
Comment |> preload([:image, user: [awards: :badge]])
Comment |> preload([image: [:tags], user: [awards: :badge]])
)
rendered =

View file

@ -0,0 +1,7 @@
defmodule PhilomenaWeb.PostController do
use PhilomenaWeb, :controller
def index(conn, _params) do
end
end

View file

@ -5,20 +5,11 @@ article.block.communication id="comment_#{@comment.id}"
.flex__grow.communication__body
span.communication__body__sender-name = render PhilomenaWeb.UserAttributionView, "_anon_user.html", object: @comment, awards: true, conn: @conn
.communication__body__text
/- if comment.hidden_from_users
/ strong.comment_deleted
/ | Deletion reason:
/ =<> comment.deletion_reason
/ - if can?(:read, comment)
/ | (
/ = comment.deleted_by.try(:name) || 'Orbital Friendship Cannon'
/ | )
/ br
/ - if comment.destroyed_content
/ | This comment's contents have been destroyed.
/ br
/= if can?(:read, @comment)
= if !@comment.hidden_from_users do
= if @comment.hidden_from_users do
strong.comment_deleted
' Deletion reason:
=> @comment.deletion_reason
- else
==<> @body
.block__content.communication__options

View file

@ -0,0 +1,17 @@
article.block.communication id="comment_#{@comment.id}"
.block__content.flex.flex--no-wrap
.flex__fixed.spacing-right
= render PhilomenaWeb.ImageView, "_image_container.html", image: @comment.image, size: :thumb, conn: @conn
.flex__grow.communication__body
span.communication__body__sender-name = render PhilomenaWeb.UserAttributionView, "_anon_user.html", object: @comment, awards: true, conn: @conn
.communication__body__text
= if @comment.hidden_from_users do
strong.comment_deleted
' Deletion reason:
=> @comment.deletion_reason
- else
==<> @body
.block__content.communication__options
.flex.flex--wrap.flex--spaced-out
= render PhilomenaWeb.CommentView, "_comment_options.html", comment: @comment, conn: @conn

View file

@ -7,7 +7,7 @@ elixir:
= pagination
= for {comment, body} <- @comments do
= render PhilomenaWeb.CommentView, "_comment.html", comment: comment, body: body, conn: @conn
= render PhilomenaWeb.CommentView, "_comment_with_image.html", image: comment.image, comment: comment, body: body, conn: @conn
.block
.block__header.block__header--light