rearrange image tag changes

This commit is contained in:
byte[] 2019-12-04 16:47:46 -05:00
parent 413c19a97d
commit ad17b48011
5 changed files with 48 additions and 41 deletions

View file

@ -16,43 +16,4 @@ h1
= link "Added", to: Routes.image_tag_change_path(@conn, :index, @image, added: 1)
= link "All", to: Routes.image_tag_change_path(@conn, :index, @image)
.block__header
= pagination
.block__content
table.table
thead
tr
th colspan=2 Image
th Tag
th Action
th Timestamp
th User
tbody
= for tag_change <- @tag_changes do
tr
td.center
= link tag_change.image_id, to: Routes.image_path(@conn, :show, tag_change.image)
td.center
= render PhilomenaWeb.ImageView, "_image_container.html", image: tag_change.image, size: :thumb_tiny, conn: @conn
td
= if tag_change.tag do
= render PhilomenaWeb.TagView, "_tag.html", tag: tag_change.tag, conn: @conn
- else
= tag_change.tag_name_cache || "Unknown tag"
= if tag_change.added do
td.success Added
- else
td.danger Removed
td
= pretty_time(tag_change.created_at)
td
= render PhilomenaWeb.UserAttributionView, "_anon_user.html", object: tag_change, conn: @conn
.block__header
= pagination
= render PhilomenaWeb.TagChangeView, "index.html", conn: @conn, tag_changes: @tag_changes, pagination: pagination

View file

@ -3,7 +3,7 @@ meta name="theme-color"
meta name="format-detection" content="telephone=no"
meta name="robots" content="noindex, nofollow"
= if !is_nil(@conn.assigns[:image]) and @conn.assigns.image.__meta__.state == :loaded do
= if opengraph?(@conn) do
- image = @conn.assigns.image
- filtered = ImageView.filter_or_spoiler_hits?(@conn, image)

View file

@ -0,0 +1,40 @@
.block__header
= @pagination
.block__content
table.table
thead
tr
th colspan=2 Image
th Tag
th Action
th Timestamp
th User
tbody
= for tag_change <- @tag_changes do
tr
td.center
= link tag_change.image_id, to: Routes.image_path(@conn, :show, tag_change.image)
td.center
= render PhilomenaWeb.ImageView, "_image_container.html", image: tag_change.image, size: :thumb_tiny, conn: @conn
td
= if tag_change.tag do
= render PhilomenaWeb.TagView, "_tag.html", tag: tag_change.tag, conn: @conn
- else
= tag_change.tag_name_cache || "Unknown tag"
= if tag_change.added do
td.success Added
- else
td.danger Removed
td
= pretty_time(tag_change.created_at)
td
= render PhilomenaWeb.UserAttributionView, "_anon_user.html", object: tag_change, conn: @conn
.block__header
= @pagination

View file

@ -76,4 +76,7 @@ defmodule PhilomenaWeb.LayoutView do
def artist_tags(tags),
do: Enum.filter(tags, & &1.namespace == "artist")
def opengraph?(conn),
do: !is_nil(conn.assigns[:image]) and conn.assigns.image.__meta__.state == :loaded and is_list(conn.assigns.image.tags)
end

View file

@ -0,0 +1,3 @@
defmodule PhilomenaWeb.TagChangeView do
use PhilomenaWeb, :view
end