Create books via admin
This commit is contained in:
26
slices/admin/actions/books/create.rb
Normal file
26
slices/admin/actions/books/create.rb
Normal file
@@ -0,0 +1,26 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
module Admin
|
||||
module Actions
|
||||
module Books
|
||||
class Create < Admin::Action
|
||||
|
||||
include Deps["repos.book_repo"]
|
||||
|
||||
def handle(req, resp)
|
||||
book_repo.create({
|
||||
name: req.params[:name],
|
||||
book_author: req.params[:book_author],
|
||||
slug: req.params[:slug],
|
||||
content: "",
|
||||
book_status: req.params[:book_status],
|
||||
post_type: "book",
|
||||
published_at: Time.now
|
||||
})
|
||||
|
||||
resp.redirect_to "/admin/books"
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
Reference in New Issue
Block a user