mirror of
https://github.com/philomena-dev/philomena.git
synced 2024-11-27 13:47:58 +01:00
add basic user attribution
This commit is contained in:
parent
6a461ec927
commit
6e5d81191d
5 changed files with 14 additions and 5 deletions
|
@ -5,7 +5,7 @@ defmodule PhilomenaWeb.ImageController do
|
|||
import Ecto.Query
|
||||
|
||||
plug ImageFilter
|
||||
plug :load_and_authorize_resource, model: Image, only: :show, preload: :tags
|
||||
plug :load_and_authorize_resource, model: Image, only: :show, preload: [:tags, :user]
|
||||
|
||||
def index(conn, _params) do
|
||||
query = conn.assigns.compiled_filter
|
||||
|
@ -16,7 +16,7 @@ defmodule PhilomenaWeb.ImageController do
|
|||
query: %{bool: %{must_not: query}},
|
||||
sort: %{created_at: :desc}
|
||||
},
|
||||
Image |> preload(:tags)
|
||||
Image |> preload([:tags, :user])
|
||||
)
|
||||
|
||||
render(conn, "index.html", images: images)
|
||||
|
|
|
@ -38,7 +38,7 @@ defmodule PhilomenaWeb.TagController do
|
|||
},
|
||||
sort: %{created_at: :desc}
|
||||
},
|
||||
Image |> preload(:tags)
|
||||
Image |> preload([:tags, :user])
|
||||
)
|
||||
|
||||
render(conn, "show.html", tag: tag, images: images)
|
||||
|
|
|
@ -48,8 +48,10 @@
|
|||
| DS
|
||||
.image-metabar.flex.flex--wrap.block__header--user-credit.center--layout#extrameta
|
||||
div
|
||||
| Uploaded
|
||||
=<> pretty_time(@image.created_at)
|
||||
' Uploaded
|
||||
=> pretty_time(@image.created_at)
|
||||
' by
|
||||
=> render PhilomenaWeb.UserAttributionView, "_anon_user.html", object: @image
|
||||
span.image-size
|
||||
|
|
||||
= @image.image_width
|
||||
|
|
|
@ -0,0 +1,5 @@
|
|||
= if !!@object.user and !@object.anonymous do
|
||||
strong<> = @object.user.name
|
||||
- else
|
||||
strong<>
|
||||
' Background Pony
|
|
@ -0,0 +1,2 @@
|
|||
= if !!@object.user do
|
||||
strong<>= @object.user.name
|
Loading…
Reference in a new issue