From 3c3ff13ab0f13d339a9e3ea8c142e31ae0c23d5b Mon Sep 17 00:00:00 2001 From: xxq250 Date: Mon, 30 Dec 2024 16:04:20 +0800 Subject: [PATCH] =?UTF-8?q?fixed=20=E8=8A=82=E7=82=B9=E5=BA=93=E6=8E=A5?= =?UTF-8?q?=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/action/node_types_controller.rb | 14 ++++++++++++-- app/controllers/action/nodes_controller.rb | 5 ++++- app/controllers/action/templates_controller.rb | 5 ++++- 3 files changed, 20 insertions(+), 4 deletions(-) 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