From bc82e368a5ca0c602fba435d51c19dbc335ec59c Mon Sep 17 00:00:00 2001
From: "byte[]" <byteslice@airmail.cc>
Date: Mon, 18 Nov 2019 00:05:42 -0500
Subject: [PATCH] allow changing the link

---
 lib/philomena_web/templates/gallery/_gallery.html.slime    | 7 ++++---
 .../templates/image/_image_container.html.slime            | 4 +++-
 2 files changed, 7 insertions(+), 4 deletions(-)

diff --git a/lib/philomena_web/templates/gallery/_gallery.html.slime b/lib/philomena_web/templates/gallery/_gallery.html.slime
index 05cf96e9..d7c18a80 100644
--- a/lib/philomena_web/templates/gallery/_gallery.html.slime
+++ b/lib/philomena_web/templates/gallery/_gallery.html.slime
@@ -1,10 +1,11 @@
+- link = Routes.gallery_path(@conn, :show, @gallery)
+
 .media-box
-  a.media-box__header.media-box__header--link href=Routes.gallery_path(@conn, :show, @gallery) title=@gallery.title
+  a.media-box__header.media-box__header--link href=link title=@gallery.title
     = @gallery.title
 
     .media-box__overlay
       = @gallery.spoiler_warning
 
   .media-box__content.media-box__content--large
-    a href=Routes.gallery_path(@conn, :show, @gallery)
-      = render PhilomenaWeb.ImageView, "_image_container.html", image: @gallery.thumbnail, size: :thumb, conn: @conn
\ No newline at end of file
+    = render PhilomenaWeb.ImageView, "_image_container.html", image: @gallery.thumbnail, size: :thumb, conn: @conn, link: link
\ No newline at end of file
diff --git a/lib/philomena_web/templates/image/_image_container.html.slime b/lib/philomena_web/templates/image/_image_container.html.slime
index afb7b843..b1e5d13a 100644
--- a/lib/philomena_web/templates/image/_image_container.html.slime
+++ b/lib/philomena_web/templates/image/_image_container.html.slime
@@ -1,3 +1,5 @@
+- link = assigns[:link] || Routes.image_path(@conn, :show, @image)
+
 = image_container @image, @size, fn ->
   = cond do
     - @image.duplicate_id ->
@@ -13,7 +15,7 @@
     - true ->
 
   .media-box__overlay.js-spoiler-info-overlay
-  a href="/#{@image.id}"
+  a href=link
     = if @image.thumbnails_generated do
       - uris = thumb_urls(@image, false)
       - vid = @image.image_mime_type == "video/webm"