diff --git a/app/controllers/action/node_types_controller.rb b/app/controllers/action/node_types_controller.rb index 32508d942..e90bb665c 100644 --- a/app/controllers/action/node_types_controller.rb +++ b/app/controllers/action/node_types_controller.rb @@ -4,6 +4,10 @@ class Action::NodeTypesController < ApplicationController def index @node_types = Action::NodeType.all + respond_to do |format| + format.html + format.json { render_ok(data: @node_types.as_json) } + end end def create @@ -20,7 +24,10 @@ class Action::NodeTypesController < ApplicationController end def show - + respond_to do |format| + format.html + format.json { render_ok(data: @node_type.as_json) } + end end def new @@ -45,7 +52,10 @@ class Action::NodeTypesController < ApplicationController else flash[:danger] = '删除失败' end - redirect_to action_node_types_path + respond_to do |format| + format.html { redirect_to action_node_types_path } + format.json { render_ok } + end end private diff --git a/app/controllers/action/nodes_controller.rb b/app/controllers/action/nodes_controller.rb index 2664ff95a..f8219ca8d 100644 --- a/app/controllers/action/nodes_controller.rb +++ b/app/controllers/action/nodes_controller.rb @@ -58,7 +58,10 @@ class Action::NodesController < ApplicationController else flash[:danger] = '删除失败' end - redirect_to action_nodes_path + respond_to do |format| + format.html { redirect_to action_nodes_path } + format.json { render_ok() } + end end private diff --git a/app/controllers/action/templates_controller.rb b/app/controllers/action/templates_controller.rb index 092d38d64..f7f99b7d7 100644 --- a/app/controllers/action/templates_controller.rb +++ b/app/controllers/action/templates_controller.rb @@ -49,7 +49,10 @@ class Action::TemplatesController < ApplicationController else flash[:danger] = '删除失败' end - redirect_to action_templates_path + respond_to do |format| + format.html { redirect_to action_templates_path } + format.json { render_ok } + end end private