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 @@