From d4d4ee0e2d7c464a713f2e9d0d349bdc81d54e4d Mon Sep 17 00:00:00 2001 From: "byte[]" Date: Tue, 10 Dec 2019 19:41:29 -0500 Subject: [PATCH] various fixes: add base line-height: 1.5em add appropriate placeholder color to inputs show number of faves on fave index link to correct location in watched images list on activity page don't show pagination info when there are no results don't create a source history entry if the source wasn't changed --- assets/css/common/base.scss | 1 + assets/css/common/forms.scss | 5 ++++ lib/philomena/images.ex | 10 ++++++- .../controllers/stat_controller.ex | 2 +- .../templates/activity/index.html.slime | 5 ++-- .../image/favorites/index.html.slime | 5 +++- .../pagination/_pagination_info.html.slime | 27 ++++++++++--------- .../templates/stat/index.html.slime | 2 +- 8 files changed, 39 insertions(+), 18 deletions(-) diff --git a/assets/css/common/base.scss b/assets/css/common/base.scss index 459fe1c6..c2ae6545 100644 --- a/assets/css/common/base.scss +++ b/assets/css/common/base.scss @@ -27,6 +27,7 @@ body { font-size: 13px; margin: 0; padding: 0; + line-height: 1.5em; } h1, h2, h3, h4, h5 { diff --git a/assets/css/common/forms.scss b/assets/css/common/forms.scss index f8fe30cd..c872ede2 100644 --- a/assets/css/common/forms.scss +++ b/assets/css/common/forms.scss @@ -26,6 +26,11 @@ form p { max-width: 100%; /* prevent resizable inputs from overflowing the container */ } +.input::placeholder { + opacity: 0.54; + color: inherit; +} + .input[required]:invalid { box-shadow: none; } diff --git a/lib/philomena/images.ex b/lib/philomena/images.ex index 92336318..c51c8747 100644 --- a/lib/philomena/images.ex +++ b/lib/philomena/images.ex @@ -119,7 +119,15 @@ defmodule Philomena.Images do Multi.new |> Multi.update(:image, image_changes) - |> Multi.insert(:source_change, source_changes) + |> Multi.run(:source_change, fn repo, _changes -> + case image_changes.changes do + %{source_url: _new_source} -> + repo.insert(source_changes) + + _ -> + {:ok, nil} + end + end) |> Repo.isolated_transaction(:serializable) end diff --git a/lib/philomena_web/controllers/stat_controller.ex b/lib/philomena_web/controllers/stat_controller.ex index aeef09d0..d633dff4 100644 --- a/lib/philomena_web/controllers/stat_controller.ex +++ b/lib/philomena_web/controllers/stat_controller.ex @@ -36,7 +36,7 @@ defmodule PhilomenaWeb.StatController do open_commissions: open_commissions, commission_items: commission_items, open_reports: open_reports, - report_count: report_count, + report_stat_count: report_count, response_time: response_time, gallery_count: gallery_count, gallery_size: gallery_size, diff --git a/lib/philomena_web/templates/activity/index.html.slime b/lib/philomena_web/templates/activity/index.html.slime index a773fc41..5943b577 100644 --- a/lib/philomena_web/templates/activity/index.html.slime +++ b/lib/philomena_web/templates/activity/index.html.slime @@ -39,7 +39,7 @@ .column-layout__main = render PhilomenaWeb.ImageView, "index.html", conn: @conn, images: @images, size: :thumb - = if !!@watched and @watched != [] do + = if not is_nil(@watched) and Enum.any?(@watched) do .block .block__header span.block__header__title @@ -49,4 +49,5 @@ span.hide-mobile ' Browse Watched Images .block__content.js-resizable-media-container - = render PhilomenaWeb.ImageView, "index.html", conn: @conn, images: @watched, size: :thumb_small + - 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"] diff --git a/lib/philomena_web/templates/image/favorites/index.html.slime b/lib/philomena_web/templates/image/favorites/index.html.slime index 5815945c..3bdd899f 100644 --- a/lib/philomena_web/templates/image/favorites/index.html.slime +++ b/lib/philomena_web/templates/image/favorites/index.html.slime @@ -1,4 +1,7 @@ -h5 Favorited by +h5 + ' Faved by + => @image.faves_count + = pluralize("user", "users", @image.faves_count) = for fave <- Enum.sort_by(@image.faves, & &1.user.name) do => link fave.user.name, to: Routes.profile_path(@conn, :show, fave.user), class: "interaction-user-list-item" \ No newline at end of file diff --git a/lib/philomena_web/templates/pagination/_pagination_info.html.slime b/lib/philomena_web/templates/pagination/_pagination_info.html.slime index f0731211..8d59aedd 100644 --- a/lib/philomena_web/templates/pagination/_pagination_info.html.slime +++ b/lib/philomena_web/templates/pagination/_pagination_info.html.slime @@ -1,13 +1,16 @@ -' Showing -= if @page.total_entries == 1 do - ' result += if @page.total_entries > 0 do + ' Showing + => pluralize("result", "results", @page.total_entries) + + strong + => max(((@page.page_number - 1) * @page.page_size) - 1, 1) + ' - + => min(@page.page_number * @page.page_size, @page.total_entries) + ' of + + strong + => @page.total_entries + ' total + - else - ' results -strong - => max(((@page.page_number - 1) * @page.page_size) - 1, 1) - ' - - => min(@page.page_number * @page.page_size, @page.total_entries) -' of -strong - => @page.total_entries -' total \ No newline at end of file + ' No results found \ No newline at end of file diff --git a/lib/philomena_web/templates/stat/index.html.slime b/lib/philomena_web/templates/stat/index.html.slime index d9ae0921..9033bb4e 100644 --- a/lib/philomena_web/templates/stat/index.html.slime +++ b/lib/philomena_web/templates/stat/index.html.slime @@ -107,7 +107,7 @@ elixir: p ' We have received span.stat> - = number_with_delimiter(@report_count) + = number_with_delimiter(@report_stat_count) ' reports. Out of these reports, => number_with_delimiter(@open_reports) ' reports are outstanding and awaiting action.