From 0a73b27d4ac0e2192e7ce63ddd288f1cb42c0709 Mon Sep 17 00:00:00 2001 From: Kieran Eglin Date: Mon, 30 Dec 2024 12:18:50 -0800 Subject: [PATCH] Hooked up new OPML route to UI; turned RSS and OPML feed buttons into links --- .../controllers/sources/source_html.ex | 3 ++- .../source_html/actions_dropdown.html.heex | 20 +++++++++---------- .../sources/source_html/index.html.heex | 9 +++++---- lib/pinchflat_web/endpoint.ex | 7 +++++++ lib/pinchflat_web/router.ex | 4 +++- 5 files changed, 26 insertions(+), 17 deletions(-) diff --git a/lib/pinchflat_web/controllers/sources/source_html.ex b/lib/pinchflat_web/controllers/sources/source_html.ex index 4692a04..a552da2 100644 --- a/lib/pinchflat_web/controllers/sources/source_html.ex +++ b/lib/pinchflat_web/controllers/sources/source_html.ex @@ -40,11 +40,12 @@ defmodule PinchflatWeb.Sources.SourceHTML do end def rss_feed_url(conn, source) do + # TODO: finally address this. I shouldn't have to use concatination here url(conn, ~p"/sources/#{source.uuid}/feed") <> ".xml" end def opml_feed_url(conn) do - url(conn, ~p"/sources/opml") <> ".xml" + url(conn, ~p"/sources/opml.xml?#{[route_token: Settings.get!(:route_token)]}") end def output_path_template_override_placeholders(media_profiles) do diff --git a/lib/pinchflat_web/controllers/sources/source_html/actions_dropdown.html.heex b/lib/pinchflat_web/controllers/sources/source_html/actions_dropdown.html.heex index f2681c0..43d0e64 100644 --- a/lib/pinchflat_web/controllers/sources/source_html/actions_dropdown.html.heex +++ b/lib/pinchflat_web/controllers/sources/source_html/actions_dropdown.html.heex @@ -1,18 +1,16 @@ <.button_dropdown text="Actions" class="justify-center w-full sm:w-50"> <:option> - copied = true, - () => copied = false - ) - "} - > + <.link href={rss_feed_url(@conn, @source)} x-data="{ copied: false }" x-on:click={~s" + $event.preventDefault(); + copyWithCallbacks( + '#{rss_feed_url(@conn, @source)}', + () => copied = true, + () => copied = false + ) + "}> Copy RSS Feed <.icon name="hero-check" class="ml-2 h-4 w-4" /> - + <:option>

Sources

-