Class: Integral::Backend::BlockListsController
- Inherits:
-
BaseController
- Object
- ActionController::Base
- BaseController
- Integral::Backend::BlockListsController
- Defined in:
- app/controllers/integral/backend/block_lists_controller.rb
Overview
Block Lists controller
Instance Method Summary collapse
-
#block_lists ⇒ Object
Maybe able to get rid of the content here.
-
#current_policy ⇒ BasePolicy
Current authorization policy.
- #index ⇒ Object
- #show ⇒ Object
- #wp_type ⇒ Object
- #wp_types ⇒ Object
Methods inherited from BaseController
#activities, #activity, #create, #destroy, #duplicate, #edit, #list, #new, #update
Instance Method Details
#block_lists ⇒ Object
Maybe able to get rid of the content here
40 41 42 43 44 |
# File 'app/controllers/integral/backend/block_lists_controller.rb', line 40 def block_lists res = BlockEditor::BlockList.reusable.map { |block_list| { id: block_list.id, title: { raw: block_list.name }, content: block_list.content } } render json: res, status: 200, layout: false end |
#current_policy ⇒ BasePolicy
Returns current authorization policy.
34 35 36 |
# File 'app/controllers/integral/backend/block_lists_controller.rb', line 34 def current_policy policy(Integral::Page.new) end |
#index ⇒ Object
8 9 10 |
# File 'app/controllers/integral/backend/block_lists_controller.rb', line 8 def index redirect_to list_backend_block_lists_url end |
#show ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'app/controllers/integral/backend/block_lists_controller.rb', line 12 def show if params["_locale"].present? block_list = BlockEditor::BlockList.reusable.find(params[:id]) res = { id: block_list.id, status: "publish", name: "wp_block", title: { raw: block_list.name }, content: { raw: block_list.content } } render json: res, status: 200, layout: false else redirect_to edit_backend_block_list_url(@resource.id) end end |
#wp_type ⇒ Object
46 47 48 |
# File 'app/controllers/integral/backend/block_lists_controller.rb', line 46 def wp_type render json: { "rest_base" => "block_list" }, status: 200, layout: false end |
#wp_types ⇒ Object
50 51 52 53 54 55 56 57 58 59 60 61 |
# File 'app/controllers/integral/backend/block_lists_controller.rb', line 50 def wp_types res = { "wp_block" => { "rest_base": "block_lists", "labels": { "singular_name": "Block Lists" } } } render json: res, status: 200, layout: false end |