Add highlights
This commit is contained in:
17
slices/admin/actions/posts/create_highlight.rb
Normal file
17
slices/admin/actions/posts/create_highlight.rb
Normal file
@@ -0,0 +1,17 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
module Admin
|
||||
module Actions
|
||||
module Posts
|
||||
class CreateHighlight < Admin::Action
|
||||
include Deps["commands.highlight.create"]
|
||||
|
||||
def handle(req, res)
|
||||
create.call(post_id: req.params[:id], text: req.params[:text])
|
||||
|
||||
res.redirect_to "/admin/posts/#{req.params[:id]}"
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
17
slices/admin/actions/posts/delete_highlight.rb
Normal file
17
slices/admin/actions/posts/delete_highlight.rb
Normal file
@@ -0,0 +1,17 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
module Admin
|
||||
module Actions
|
||||
module Posts
|
||||
class DeleteHighlight < Admin::Action
|
||||
include Deps["repos.highlight_repo"]
|
||||
|
||||
def handle(req, res)
|
||||
highlight_repo.delete(req.params[:highlight_id])
|
||||
|
||||
res.redirect_to "/admin/posts/#{req.params[:post_id]}"
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
Reference in New Issue
Block a user