From 49e94afa1e4a4d52f500d0aa6c7b33811c98aacc Mon Sep 17 00:00:00 2001 From: Liam Date: Sun, 3 Mar 2024 00:31:06 -0500 Subject: [PATCH] Fix subscription targets --- assets/js/notifications.js | 2 +- .../templates/channel/subscription/_error.html.slime | 4 ++-- .../templates/channel/subscription/_subscription.html.slime | 2 +- .../templates/forum/subscription/_subscription.html.slime | 2 +- .../templates/gallery/subscription/_error.html.slime | 4 ++-- .../templates/gallery/subscription/_subscription.html.slime | 2 +- .../templates/image/subscription/_error.html.slime | 4 ++-- .../templates/image/subscription/_subscription.html.slime | 2 +- 8 files changed, 11 insertions(+), 11 deletions(-) diff --git a/assets/js/notifications.js b/assets/js/notifications.js index 4ff15775..2447debb 100644 --- a/assets/js/notifications.js +++ b/assets/js/notifications.js @@ -17,7 +17,7 @@ function makeRequest(verb) { function bindSubscriptionLinks() { delegate(document, 'fetchcomplete', { '.js-subscription-link': event => { - const target = $('#js-subscription-target'); + const target = event.target.closest('.js-subscription-target'); event.detail.text().then(text => { target.outerHTML = text; }); diff --git a/lib/philomena_web/templates/channel/subscription/_error.html.slime b/lib/philomena_web/templates/channel/subscription/_error.html.slime index b0c027de..dd079424 100644 --- a/lib/philomena_web/templates/channel/subscription/_error.html.slime +++ b/lib/philomena_web/templates/channel/subscription/_error.html.slime @@ -1,2 +1,2 @@ -#js-subscription-target - ' Error! \ No newline at end of file +.js-subscription-target + ' Error! diff --git a/lib/philomena_web/templates/channel/subscription/_subscription.html.slime b/lib/philomena_web/templates/channel/subscription/_subscription.html.slime index c12b47fa..362d9115 100644 --- a/lib/philomena_web/templates/channel/subscription/_subscription.html.slime +++ b/lib/philomena_web/templates/channel/subscription/_subscription.html.slime @@ -6,7 +6,7 @@ elixir: unwatch_class = if @watching, do: "", else: "hidden" = if @conn.assigns.current_user do - span#js-subscription-target + span.js-subscription-target a.js-subscription-link.media-box__header.media-box__header--channel.media-box__header--link href=watch_path class=watch_class data-remote="true" data-method="post" i.fa.fa-bell> span.hide-mobile diff --git a/lib/philomena_web/templates/forum/subscription/_subscription.html.slime b/lib/philomena_web/templates/forum/subscription/_subscription.html.slime index 1477c4e7..f71096cd 100644 --- a/lib/philomena_web/templates/forum/subscription/_subscription.html.slime +++ b/lib/philomena_web/templates/forum/subscription/_subscription.html.slime @@ -6,7 +6,7 @@ elixir: unwatch_class = if @watching, do: "", else: "hidden" = if @conn.assigns.current_user do - span#js-subscription-target + span.js-subscription-target a.js-subscription-link href=watch_path class=watch_class data-remote="true" data-method="post" i.fa.fa-bell> span.hide-mobile diff --git a/lib/philomena_web/templates/gallery/subscription/_error.html.slime b/lib/philomena_web/templates/gallery/subscription/_error.html.slime index b0c027de..dd079424 100644 --- a/lib/philomena_web/templates/gallery/subscription/_error.html.slime +++ b/lib/philomena_web/templates/gallery/subscription/_error.html.slime @@ -1,2 +1,2 @@ -#js-subscription-target - ' Error! \ No newline at end of file +.js-subscription-target + ' Error! diff --git a/lib/philomena_web/templates/gallery/subscription/_subscription.html.slime b/lib/philomena_web/templates/gallery/subscription/_subscription.html.slime index 55cec270..b6c5d895 100644 --- a/lib/philomena_web/templates/gallery/subscription/_subscription.html.slime +++ b/lib/philomena_web/templates/gallery/subscription/_subscription.html.slime @@ -6,7 +6,7 @@ elixir: unwatch_class = if @watching, do: "", else: "hidden" = if @conn.assigns.current_user do - span#js-subscription-target + span.js-subscription-target a.js-subscription-link href=watch_path class=watch_class data-remote="true" data-method="post" i.fa.fa-bell> span.hide-mobile diff --git a/lib/philomena_web/templates/image/subscription/_error.html.slime b/lib/philomena_web/templates/image/subscription/_error.html.slime index b0c027de..dd079424 100644 --- a/lib/philomena_web/templates/image/subscription/_error.html.slime +++ b/lib/philomena_web/templates/image/subscription/_error.html.slime @@ -1,2 +1,2 @@ -#js-subscription-target - ' Error! \ No newline at end of file +.js-subscription-target + ' Error! diff --git a/lib/philomena_web/templates/image/subscription/_subscription.html.slime b/lib/philomena_web/templates/image/subscription/_subscription.html.slime index 063fd896..35c6883d 100644 --- a/lib/philomena_web/templates/image/subscription/_subscription.html.slime +++ b/lib/philomena_web/templates/image/subscription/_subscription.html.slime @@ -6,7 +6,7 @@ elixir: unwatch_class = if @watching, do: "", else: "hidden" = if @conn.assigns.current_user do - span#js-subscription-target + span.js-subscription-target a.js-subscription-link href=watch_path class=watch_class data-remote="true" data-method="post" i.fa.fa-bell> ' Subscribe