From d94da6c9ca0556b1b3a9b6e49850ecb4dac60cab Mon Sep 17 00:00:00 2001 From: Daniel Nitsikopoulos Date: Sun, 7 May 2023 12:17:28 +1000 Subject: [PATCH] Add tags to allow list and add re-cache button --- slices/admin/commands/bookmarks/cache.rb | 2 +- slices/admin/templates/bookmarks/index.html.slim | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/slices/admin/commands/bookmarks/cache.rb b/slices/admin/commands/bookmarks/cache.rb index a65463d..3e4e432 100644 --- a/slices/admin/commands/bookmarks/cache.rb +++ b/slices/admin/commands/bookmarks/cache.rb @@ -13,7 +13,7 @@ module Admin bookmark.url tempfile = Down.download(bookmark.url) - content = Readability::Document.new(tempfile.read, tags: %w[div p h1 h2 h3 h4 h5 h6]).content + content = Readability::Document.new(tempfile.read, tags: %w[div section header p h1 h2 h3 h4 h5 h6 ol ul li table td tr thead tbody a]).content bookmark_repo.update(id: bookmark_id, cached_content: content) diff --git a/slices/admin/templates/bookmarks/index.html.slim b/slices/admin/templates/bookmarks/index.html.slim index 5c03515..3fccdd6 100644 --- a/slices/admin/templates/bookmarks/index.html.slim +++ b/slices/admin/templates/bookmarks/index.html.slim @@ -18,6 +18,8 @@ div class="max-w-prose mx-auto" div - if bookmark.cached_content a href="/bookmark/#{bookmark.slug}" View cached version + span   —   + button hx-post="/admin/bookmarks/cache/#{bookmark.id}" Re-cache - else button hx-post="/admin/bookmarks/cache/#{bookmark.id}" No cached content, cache now? td