Add auto tagger for posts
This commit is contained in:
28
slices/admin/actions/auto_tagging/create.rb
Normal file
28
slices/admin/actions/auto_tagging/create.rb
Normal file
@@ -0,0 +1,28 @@
|
||||
module Admin
|
||||
module Actions
|
||||
module AutoTagging
|
||||
class Create < Action
|
||||
|
||||
include Deps["commands.auto_tagging.create",
|
||||
"views.auto_tagging.index",
|
||||
auto_tag: "commands.auto_tagging.tag"]
|
||||
|
||||
def handle(req, res)
|
||||
title_contains = req.params[:title_contains]
|
||||
body_contains = req.params[:body_contains]
|
||||
tag_id = req.params[:tag_id]
|
||||
|
||||
result = create.(title_contains: title_contains,
|
||||
body_contains: body_contains,
|
||||
tag_id: tag_id)
|
||||
|
||||
if result.success?
|
||||
auto_tag.(auto_tag_id: result.value!)
|
||||
end
|
||||
|
||||
res.render index
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
14
slices/admin/actions/auto_tagging/delete.rb
Normal file
14
slices/admin/actions/auto_tagging/delete.rb
Normal file
@@ -0,0 +1,14 @@
|
||||
module Admin
|
||||
module Actions
|
||||
module AutoTagging
|
||||
class Delete < Action
|
||||
|
||||
include Deps["repos.auto_tagging_repo"]
|
||||
|
||||
def handle(req, res)
|
||||
auto_tagging_repo.delete(id: req.params[:id])
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
14
slices/admin/actions/auto_tagging/index.rb
Normal file
14
slices/admin/actions/auto_tagging/index.rb
Normal file
@@ -0,0 +1,14 @@
|
||||
module Admin
|
||||
module Actions
|
||||
module AutoTagging
|
||||
class Index < Action
|
||||
|
||||
include Deps["views.auto_tagging.index"]
|
||||
|
||||
def handle(req, res)
|
||||
res.render index
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
14
slices/admin/actions/auto_tagging/new.rb
Normal file
14
slices/admin/actions/auto_tagging/new.rb
Normal file
@@ -0,0 +1,14 @@
|
||||
module Admin
|
||||
module Actions
|
||||
module AutoTagging
|
||||
class New < Action
|
||||
|
||||
include Deps[new_view: "views.auto_tagging.new"]
|
||||
|
||||
def handle(req, res)
|
||||
res.render new_view
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
Reference in New Issue
Block a user