Archive bookmarks
This commit is contained in:
@@ -69,6 +69,7 @@ module Adamantium
|
||||
get "/bookmarks", to: "bookmarks.index"
|
||||
delete "/bookmarks/:id", to: "bookmarks.delete"
|
||||
post "/bookmarks/cache/:id", to: "bookmarks.cache"
|
||||
post "/bookmarks/:id/archive", to: "bookmarks.archive"
|
||||
end
|
||||
end
|
||||
end
|
||||
|
16
slices/admin/actions/bookmarks/archive.rb
Normal file
16
slices/admin/actions/bookmarks/archive.rb
Normal file
@@ -0,0 +1,16 @@
|
||||
module Admin
|
||||
module Actions
|
||||
module Bookmarks
|
||||
class Archive < Action
|
||||
|
||||
include Deps["repos.bookmark_repo"]
|
||||
|
||||
def handle(req, res)
|
||||
bookmark_id = req.params[:id]
|
||||
|
||||
bookmark_repo.archive(id: bookmark_id)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
@@ -15,6 +15,10 @@ module Admin
|
||||
posts.where(id: id).delete
|
||||
end
|
||||
|
||||
def archive(id:)
|
||||
posts.where(id: id).update(published_at: nil)
|
||||
end
|
||||
|
||||
def update(id:, cached_content:)
|
||||
posts.where(id: id).update(cached_content: cached_content)
|
||||
end
|
||||
|
@@ -24,6 +24,7 @@ div class="max-w-prose mx-auto"
|
||||
= bookmark.published_at&.strftime("%d %b %Y")
|
||||
td
|
||||
button hx-delete="/admin/bookmarks/#{bookmark.id}" hx-target="#bookmark-#{bookmark.id}" delete
|
||||
button hx-post="/admin/bookmarks/#{bookmark.id}/archive" archive
|
||||
|
||||
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