Re-publish bookmarks

This commit is contained in:
2023-07-20 21:49:02 +10:00
parent 0c49010f0d
commit e6936755da
5 changed files with 26 additions and 5 deletions

View File

@@ -0,0 +1,15 @@
module Admin
module Actions
module Bookmarks
class Publish < Action
include Deps["repos.bookmark_repo"]
def handle(req, res)
bookmark_id = req.params[:id]
bookmark_repo.publish(id: bookmark_id)
end
end
end
end
end

View File

@@ -27,6 +27,10 @@ module Admin
posts.where(id: id).update(published_at: nil)
end
def publish(id:)
posts.where(id: id).update(published_at: Time.now)
end
def update(id:, cached_content:)
posts.where(id: id).update(cached_content: cached_content)
end

View File

@@ -55,7 +55,7 @@ div class="max-w-prose mx-auto" x-data="{ activeTab: 0 }"
td
button class="text-red-600" hx-delete="/admin/bookmarks/#{bookmark.id}" hx-target="#bookmark-#{bookmark.id}" delete
td
button hx-post="/admin/bookmarks/#{bookmark.id}/archive" archive
button hx-post="/admin/bookmarks/#{bookmark.id}/publish" publish
div class="max-w-screen-md mx-auto border-t-4 border-solid border-gray-400 dark:border-gray-600"