diff --git a/assets/js/alpine_helpers.js b/assets/js/alpine_helpers.js index eaf5cc0..56a7d93 100644 --- a/assets/js/alpine_helpers.js +++ b/assets/js/alpine_helpers.js @@ -22,6 +22,12 @@ window.copyTextToClipboard = async (text) => { } } +window.copyWithCallbacks = async (text, onCopy, onAfterDelay, delay = 4000) => { + await window.copyTextToClipboard(text) + onCopy() + setTimeout(onAfterDelay, delay) +} + window.markVersionAsSeen = (versionString) => { localStorage.setItem('seenVersion', versionString) } diff --git a/lib/pinchflat_web/controllers/media_items/media_item_html/actions_dropdown.html.heex b/lib/pinchflat_web/controllers/media_items/media_item_html/actions_dropdown.html.heex index 537872e..fcd4589 100644 --- a/lib/pinchflat_web/controllers/media_items/media_item_html/actions_dropdown.html.heex +++ b/lib/pinchflat_web/controllers/media_items/media_item_html/actions_dropdown.html.heex @@ -1,4 +1,19 @@ <.button_dropdown text="Actions" class="justify-center w-full sm:w-50"> + <:option> + copied = true, + () => copied = false + ) + "}> + Copy JSON + <.icon name="hero-check" class="ml-2 h-4 w-4" /> + + + <:option> +
+ <:option> <.link href={~p"/sources/#{@media_item.source_id}/media/#{@media_item}/force_download"} diff --git a/lib/pinchflat_web/controllers/media_items/media_item_html/edit.html.heex b/lib/pinchflat_web/controllers/media_items/media_item_html/edit.html.heex index 5b1818c..0924a77 100644 --- a/lib/pinchflat_web/controllers/media_items/media_item_html/edit.html.heex +++ b/lib/pinchflat_web/controllers/media_items/media_item_html/edit.html.heex @@ -5,7 +5,7 @@
-
+
<.media_item_form changeset={@changeset} action={~p"/sources/#{@media_item.source_id}/media/#{@media_item}"} />
diff --git a/lib/pinchflat_web/controllers/media_items/media_item_html/show.html.heex b/lib/pinchflat_web/controllers/media_items/media_item_html/show.html.heex index 0ac630b..03335cc 100644 --- a/lib/pinchflat_web/controllers/media_items/media_item_html/show.html.heex +++ b/lib/pinchflat_web/controllers/media_items/media_item_html/show.html.heex @@ -17,7 +17,7 @@
-
+
<.tabbed_layout> <:tab_append> <.actions_dropdown media_item={@media_item} /> diff --git a/lib/pinchflat_web/controllers/media_profiles/media_profile_html/actions_dropdown.html.heex b/lib/pinchflat_web/controllers/media_profiles/media_profile_html/actions_dropdown.html.heex new file mode 100644 index 0000000..29fbe42 --- /dev/null +++ b/lib/pinchflat_web/controllers/media_profiles/media_profile_html/actions_dropdown.html.heex @@ -0,0 +1,36 @@ +<.button_dropdown text="Actions" class="justify-center w-full sm:w-50"> + <:option> + copied = true, + () => copied = false + ) + "}> + Copy JSON + <.icon name="hero-check" class="ml-2 h-4 w-4" /> + + + <:option> +
+ + <:option> + <.link + href={~p"/media_profiles/#{@media_profile}"} + method="delete" + data-confirm="Are you sure you want to delete this profile and all its sources (leaving files in place)? This cannot be undone." + > + Delete Profile + + + <:option> + <.link + href={~p"/media_profiles/#{@media_profile}?delete_files=true"} + method="delete" + data-confirm="Are you sure you want to delete this profile, all its sources, and its files on disk? This cannot be undone." + class="mt-5 md:mt-0" + > + Delete Profile + Files + + + diff --git a/lib/pinchflat_web/controllers/media_profiles/media_profile_html/edit.html.heex b/lib/pinchflat_web/controllers/media_profiles/media_profile_html/edit.html.heex index ce0bdb4..27459f0 100644 --- a/lib/pinchflat_web/controllers/media_profiles/media_profile_html/edit.html.heex +++ b/lib/pinchflat_web/controllers/media_profiles/media_profile_html/edit.html.heex @@ -8,7 +8,7 @@
-
+
<.media_profile_form changeset={@changeset} action={~p"/media_profiles/#{@media_profile}"} />
diff --git a/lib/pinchflat_web/controllers/media_profiles/media_profile_html/new.html.heex b/lib/pinchflat_web/controllers/media_profiles/media_profile_html/new.html.heex index fe3e9e7..0fe77fe 100644 --- a/lib/pinchflat_web/controllers/media_profiles/media_profile_html/new.html.heex +++ b/lib/pinchflat_web/controllers/media_profiles/media_profile_html/new.html.heex @@ -6,7 +6,7 @@
-
+
<.media_profile_form changeset={@changeset} action={~p"/media_profiles"} />
diff --git a/lib/pinchflat_web/controllers/media_profiles/media_profile_html/show.html.heex b/lib/pinchflat_web/controllers/media_profiles/media_profile_html/show.html.heex index 0beccee..7a33fe8 100644 --- a/lib/pinchflat_web/controllers/media_profiles/media_profile_html/show.html.heex +++ b/lib/pinchflat_web/controllers/media_profiles/media_profile_html/show.html.heex @@ -17,30 +17,10 @@
-
+
<.tabbed_layout> <:tab_append> - <.button_dropdown text="Actions" class="justify-center w-full sm:w-50"> - <:option> - <.link - href={~p"/media_profiles/#{@media_profile}"} - method="delete" - data-confirm="Are you sure you want to delete this profile and all its sources (leaving files in place)? This cannot be undone." - > - Delete Profile - - - <:option> - <.link - href={~p"/media_profiles/#{@media_profile}?delete_files=true"} - method="delete" - data-confirm="Are you sure you want to delete this profile, all its sources, and its files on disk? This cannot be undone." - class="mt-5 md:mt-0" - > - Delete Profile + Files - - - + <.actions_dropdown media_profile={@media_profile} /> <:tab title="Media Profile"> diff --git a/lib/pinchflat_web/controllers/searches/search_html/show.html.heex b/lib/pinchflat_web/controllers/searches/search_html/show.html.heex index de5d3c4..22ea5dd 100644 --- a/lib/pinchflat_web/controllers/searches/search_html/show.html.heex +++ b/lib/pinchflat_web/controllers/searches/search_html/show.html.heex @@ -5,7 +5,7 @@
-
+
<%= if match?([_|_], @search_results) do %> <.table rows={@search_results} table_class="text-black dark:text-white"> diff --git a/lib/pinchflat_web/controllers/settings/setting_html/setting_form.html.heex b/lib/pinchflat_web/controllers/settings/setting_html/setting_form.html.heex index f3ba48e..9958c5a 100644 --- a/lib/pinchflat_web/controllers/settings/setting_html/setting_form.html.heex +++ b/lib/pinchflat_web/controllers/settings/setting_html/setting_form.html.heex @@ -3,7 +3,7 @@ Oops, something went wrong! Please check the errors below. -

+

Notification Settings

@@ -17,5 +17,5 @@ placeholder="https://discordapp.com/api/webhooks/{WebhookID}/{WebhookToken}" /> - <.button class="my-10 sm:mb-7.5 w-full sm:w-auto" rounding="rounded-lg">Save Settings + <.button class="mt-10 mb-4 sm:mb-8 w-full sm:w-auto" rounding="rounded-lg">Save Settings diff --git a/lib/pinchflat_web/controllers/settings/setting_html/show.html.heex b/lib/pinchflat_web/controllers/settings/setting_html/show.html.heex index db90e00..abe2938 100644 --- a/lib/pinchflat_web/controllers/settings/setting_html/show.html.heex +++ b/lib/pinchflat_web/controllers/settings/setting_html/show.html.heex @@ -6,7 +6,7 @@
-
+
<.setting_form changeset={@changeset} action={~p"/settings"} />
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 964395c..617ddb1 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 @@ -3,15 +3,32 @@ copied = false, 4000) - "} + 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> + copied = true, + () => copied = false + ) + "}> + Copy JSON + <.icon name="hero-check" class="ml-2 h-4 w-4" /> + + + <:option> +
+ <:option :if={@source.download_media}> <.link href={~p"/sources/#{@source}/force_download"} diff --git a/lib/pinchflat_web/controllers/sources/source_html/edit.html.heex b/lib/pinchflat_web/controllers/sources/source_html/edit.html.heex index 5192a51..680d2e3 100644 --- a/lib/pinchflat_web/controllers/sources/source_html/edit.html.heex +++ b/lib/pinchflat_web/controllers/sources/source_html/edit.html.heex @@ -8,7 +8,7 @@
-
+
<.source_form changeset={@changeset} media_profiles={@media_profiles} action={~p"/sources/#{@source}"} />
diff --git a/lib/pinchflat_web/controllers/sources/source_html/new.html.heex b/lib/pinchflat_web/controllers/sources/source_html/new.html.heex index 2817c78..f144d9e 100644 --- a/lib/pinchflat_web/controllers/sources/source_html/new.html.heex +++ b/lib/pinchflat_web/controllers/sources/source_html/new.html.heex @@ -6,7 +6,7 @@
-
+
<.source_form changeset={@changeset} media_profiles={@media_profiles} action={~p"/sources"} />
diff --git a/lib/pinchflat_web/controllers/sources/source_html/show.html.heex b/lib/pinchflat_web/controllers/sources/source_html/show.html.heex index 0f8869d..92104c8 100644 --- a/lib/pinchflat_web/controllers/sources/source_html/show.html.heex +++ b/lib/pinchflat_web/controllers/sources/source_html/show.html.heex @@ -17,7 +17,7 @@
-
+
<.tabbed_layout> <:tab_append> <.actions_dropdown source={@source} conn={@conn} />