From bdec219d23101f48d5969ac60815af8c9ba25029 Mon Sep 17 00:00:00 2001 From: "byte[]" Date: Mon, 18 Nov 2019 09:25:56 -0500 Subject: [PATCH] add redirect stub to gallery show page --- lib/philomena_web/controllers/gallery_controller.ex | 7 +++++-- lib/philomena_web/templates/layout/_header.html.slime | 2 +- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/lib/philomena_web/controllers/gallery_controller.ex b/lib/philomena_web/controllers/gallery_controller.ex index 59600cd9..bdac0aa7 100644 --- a/lib/philomena_web/controllers/gallery_controller.ex +++ b/lib/philomena_web/controllers/gallery_controller.ex @@ -4,7 +4,7 @@ defmodule PhilomenaWeb.GalleryController do alias Philomena.Galleries.Gallery import Ecto.Query - plug :load_resource, model: Gallery, only: [:show], preload: [:creator, thumbnail: :tags] + plug :load_resource, model: Gallery, only: [:show] def index(conn, params) do galleries = @@ -24,7 +24,10 @@ defmodule PhilomenaWeb.GalleryController do render(conn, "index.html", galleries: galleries, layout_class: "layout--wide") end - def show(_conn, _params) do + def show(conn, _params) do + # stub + conn + |> redirect(to: Routes.search_path(conn, :index, q: "gallery_id:#{conn.assigns.gallery_id}")) end defp parse_search(%{"gallery" => gallery_params}) do diff --git a/lib/philomena_web/templates/layout/_header.html.slime b/lib/philomena_web/templates/layout/_header.html.slime index dfc0dae1..192ad42d 100644 --- a/lib/philomena_web/templates/layout/_header.html.slime +++ b/lib/philomena_web/templates/layout/_header.html.slime @@ -12,7 +12,7 @@ header.header i.fa.fa-upload form.header__search.flex.flex--no-wrap.flex--centered action="/search" method="get" - input.input.header__input.header__input--search#q name="q" title="For terms all required, separate with ',' or 'AND'; also supports 'OR' for optional terms and '-' or 'NOT' for negation. Search with a blank query for more options or click the ? for syntax help." value=assigns[:search_query] placeholder="Search" autocapitalize="none" + input.input.header__input.header__input--search#q name="q" title="For terms all required, separate with ',' or 'AND'; also supports 'OR' for optional terms and '-' or 'NOT' for negation. Search with a blank query for more options or click the ? for syntax help." value=(assigns[:search_query] || @conn.params["q"]) placeholder="Search" autocapitalize="none" button.header__search__button type="submit" title='Search' i.fa-embedded--search