diff --git a/lib/philomena/duplicate_reports.ex b/lib/philomena/duplicate_reports.ex index c6cb2c55..a9cad67b 100644 --- a/lib/philomena/duplicate_reports.ex +++ b/lib/philomena/duplicate_reports.ex @@ -87,7 +87,7 @@ defmodule Philomena.DuplicateReports do {intensities, aspect} |> find_duplicates(dist: dist, aspect_dist: dist, limit: limit) |> preload([:user, :intensity, [:sources, tags: :aliases]]) - |> Repo.all() + |> Repo.paginate(page_size: 50) {:ok, images} diff --git a/lib/philomena_web/controllers/search/reverse_controller.ex b/lib/philomena_web/controllers/search/reverse_controller.ex index 967b968a..ef4fa836 100644 --- a/lib/philomena_web/controllers/search/reverse_controller.ex +++ b/lib/philomena_web/controllers/search/reverse_controller.ex @@ -16,15 +16,32 @@ defmodule PhilomenaWeb.Search.ReverseController do case DuplicateReports.execute_search_query(image_params) do {:ok, images} -> changeset = DuplicateReports.change_search_query(%SearchQuery{}) - render(conn, "index.html", title: "Reverse Search", images: images, changeset: changeset) + + render(conn, "index.html", + title: "Reverse Search", + layout_class: "layout--wide", + images: images, + changeset: changeset + ) {:error, changeset} -> - render(conn, "index.html", title: "Reverse Search", images: nil, changeset: changeset) + render(conn, "index.html", + title: "Reverse Search", + layout_class: "layout--wide", + images: nil, + changeset: changeset + ) end end def create(conn, _params) do changeset = DuplicateReports.change_search_query(%SearchQuery{}) - render(conn, "index.html", title: "Reverse Search", images: nil, changeset: changeset) + + render(conn, "index.html", + title: "Reverse Search", + layout_class: "layout--wide", + images: nil, + changeset: changeset + ) end end diff --git a/lib/philomena_web/templates/search/reverse/index.html.slime b/lib/philomena_web/templates/search/reverse/index.html.slime index 97d88686..7e714600 100644 --- a/lib/philomena_web/templates/search/reverse/index.html.slime +++ b/lib/philomena_web/templates/search/reverse/index.html.slime @@ -1,12 +1,13 @@ h1 Reverse Search = form_for @changeset, ~p"/search/reverse", [multipart: true, as: :image], fn f -> - p - ' Basic image similarity search. Finds uploaded images similar to the one - ' provided based on simple intensities and uses the median frame of - ' animations; very low contrast images (such as sketches) will produce - ' poor results and, regardless of contrast, results may include seemingly - ' random images that look very different. + .walloftext + p + ' Basic image similarity search. Finds uploaded images similar to the one + ' provided based on simple intensities and uses the median frame of + ' animations; very low contrast images (such as sketches) will produce + ' poor results and, regardless of contrast, results may include seemingly + ' random images that look very different. .image-other #js-image-upload-previews @@ -40,42 +41,28 @@ h1 Reverse Search = cond do - is_nil(@images) -> + / Don't render anything. - Enum.any?(@images) -> - h2 Results + .block#imagelist-container + section.block__header.page__header.flex + span.block__header__title.page__title.hide-mobile + ' Search by uploaded image - table - tr - th   - th Image - th   + .block__content.js-resizable-media-container + = for image <- @images do + = render PhilomenaWeb.ImageView, "_image_box.html", image: image, link: ~p"/images/#{image}", size: :thumb, conn: @conn - = for match <- @images do - tr - th - h3 = link "##{match.id}", to: ~p"/images/#{match}" - p - = if image_has_sources(match) do - span.source_url - = link "Source", to: image_first_source(match) - - else - ' Unknown source + .block__header.block__header--light.page__header.flex + span.block__header__title.page__info + = render PhilomenaWeb.PaginationView, "_pagination_info.html", page: @images - th - = render PhilomenaWeb.ImageView, "_image_container.html", image: match, size: :thumb, conn: @conn - - th - h3 - = match.image_width - | x - => match.image_height - ' - - => round(match.image_size / 1024) - ' KiB - - = render PhilomenaWeb.TagView, "_tag_list.html", tags: Tag.display_order(match.tags), conn: @conn + .flex__right.page__options + a href="/settings/edit" title="Display Settings" + i.fa.fa-cog + span.hide-mobile.hide-limited-desktop<> + ' Display Settings - true -> - h2 Results p - ' We couldn't find any images matching this in our image database. + ' No images found!