Re-publish bookmarks
This commit is contained in:
15
slices/admin/actions/bookmarks/publish.rb
Normal file
15
slices/admin/actions/bookmarks/publish.rb
Normal 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
|
@@ -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
|
||||
|
@@ -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"
|
||||
|
||||
|
Reference in New Issue
Block a user