From 8196271976101f13a1e34fbd3eff21e7c8579838 Mon Sep 17 00:00:00 2001 From: "byte[]" Date: Fri, 13 Dec 2019 14:56:52 -0500 Subject: [PATCH] show error tags first; signifiy staff metadata updates; remove pagination from watched images section --- lib/philomena/tags/tag.ex | 1 + .../templates/activity/index.html.slime | 8 ++++---- .../templates/source_change/index.html.slime | 12 ++++++++++-- .../templates/tag_change/index.html.slime | 12 ++++++++++-- lib/philomena_web/views/source_change_view.ex | 10 ++++++++++ lib/philomena_web/views/tag_change_view.ex | 10 ++++++++++ 6 files changed, 45 insertions(+), 8 deletions(-) diff --git a/lib/philomena/tags/tag.ex b/lib/philomena/tags/tag.ex index c20d8342..553bab02 100644 --- a/lib/philomena/tags/tag.ex +++ b/lib/philomena/tags/tag.ex @@ -99,6 +99,7 @@ defmodule Philomena.Tags.Tag do def display_order(tags) do tags |> Enum.sort_by(&{ + &1.category != "error", &1.category != "rating", &1.category != "origin", &1.category != "character", diff --git a/lib/philomena_web/templates/activity/index.html.slime b/lib/philomena_web/templates/activity/index.html.slime index 5943b577..9a247d0d 100644 --- a/lib/philomena_web/templates/activity/index.html.slime +++ b/lib/philomena_web/templates/activity/index.html.slime @@ -9,8 +9,8 @@ a href="/pages/donations" ' Become a patron or donate! .block.block--fixed.block--fixed--sub.center.hide-mobile - | Issues? Want to chat? - a< href="/pages/contact" Contact us! + ' Issues? Want to chat? + a href="/pages/contact" Contact us! .block.hide-mobile a.block__header--single-item.center href="/search?q=first_seen_at.gt:3 days ago&sf=score&sd=desc" ' Trending Images @@ -49,5 +49,5 @@ span.hide-mobile ' Browse Watched Images .block__content.js-resizable-media-container - - route = fn p -> Routes.search_path(@conn, :index, p) end - = render PhilomenaWeb.ImageView, "index.html", conn: @conn, images: @watched, size: :thumb_small, route: route, scope: [q: "my:watched"] + = for image <- @watched do + = render PhilomenaWeb.ImageView, "_image_box.html", image: image, link: Routes.image_path(@conn, :show, image, q: "my:watched"), size: :thumb_small, conn: @conn diff --git a/lib/philomena_web/templates/source_change/index.html.slime b/lib/philomena_web/templates/source_change/index.html.slime index ff7ee287..6fd42897 100644 --- a/lib/philomena_web/templates/source_change/index.html.slime +++ b/lib/philomena_web/templates/source_change/index.html.slime @@ -26,12 +26,20 @@ td = pretty_time(source_change.created_at) - td + td class=user_column_class(source_change) = render PhilomenaWeb.UserAttributionView, "_anon_user.html", object: source_change, conn: @conn + = if staff?(source_change) do + br + small + strong> Stop! + ' This user is a staff member. + br + ' Ask them before reverting their changes. + td = if source_change.initial do ' ✓ .block__header - = @pagination \ No newline at end of file + = @pagination diff --git a/lib/philomena_web/templates/tag_change/index.html.slime b/lib/philomena_web/templates/tag_change/index.html.slime index 58bef6d6..e20c06c5 100644 --- a/lib/philomena_web/templates/tag_change/index.html.slime +++ b/lib/philomena_web/templates/tag_change/index.html.slime @@ -33,8 +33,16 @@ td = pretty_time(tag_change.created_at) - td + td class=user_column_class(tag_change) = render PhilomenaWeb.UserAttributionView, "_anon_user.html", object: tag_change, conn: @conn + = if staff?(tag_change) do + br + small + strong> Stop! + ' This user is a staff member. + br + ' Ask them before reverting their changes. + .block__header - = @pagination \ No newline at end of file + = @pagination diff --git a/lib/philomena_web/views/source_change_view.ex b/lib/philomena_web/views/source_change_view.ex index ec0da593..5b1d0128 100644 --- a/lib/philomena_web/views/source_change_view.ex +++ b/lib/philomena_web/views/source_change_view.ex @@ -1,3 +1,13 @@ defmodule PhilomenaWeb.SourceChangeView do use PhilomenaWeb, :view + + def staff?(source_change), + do: not is_nil(source_change.user) and not Philomena.Attribution.anonymous?(source_change) and source_change.user.role != "user" + + def user_column_class(source_change) do + case staff?(source_change) do + true -> "success" + false -> nil + end + end end diff --git a/lib/philomena_web/views/tag_change_view.ex b/lib/philomena_web/views/tag_change_view.ex index e4d3cb1f..6ac18308 100644 --- a/lib/philomena_web/views/tag_change_view.ex +++ b/lib/philomena_web/views/tag_change_view.ex @@ -1,3 +1,13 @@ defmodule PhilomenaWeb.TagChangeView do use PhilomenaWeb, :view + + def staff?(tag_change), + do: not is_nil(tag_change.user) and not Philomena.Attribution.anonymous?(tag_change) and tag_change.user.role != "user" + + def user_column_class(tag_change) do + case staff?(tag_change) do + true -> "success" + false -> nil + end + end end