From ebe1bd583fdbcf71c6e201051cb99f5220b03a83 Mon Sep 17 00:00:00 2001 From: wandji Date: Fri, 14 Jul 2023 11:30:36 +0100 Subject: [PATCH] Fix issue json response for creating result table [SCI-8853] (#5768) * Fix issue json resposnse for creating result table [SCI-8853] * Fix linter errors [SCI-8853] * Fix linter errors [SCI-8853] * Fix issues when editing and updating results text/table for task [SCI-8853] * Fix linter errors [SCI-8853] --- app/controllers/result_tables_controller.rb | 24 +++++++------------ app/controllers/result_texts_controller.rb | 26 ++++++--------------- 2 files changed, 16 insertions(+), 34 deletions(-) diff --git a/app/controllers/result_tables_controller.rb b/app/controllers/result_tables_controller.rb index 9a08a9f0c..4519b5a75 100644 --- a/app/controllers/result_tables_controller.rb +++ b/app/controllers/result_tables_controller.rb @@ -18,15 +18,9 @@ class ResultTablesController < ApplicationController table: @table ) - respond_to do |format| - format.json { - render json: { - html: render_to_string({ - partial: "new.html.erb" - }) - }, status: :ok - } - end + render json: { + html: render_to_string({ partial: 'new', formats: :html }) + }, status: :ok end def create @@ -57,9 +51,7 @@ class ResultTablesController < ApplicationController respond_to do |format| format.json { render json: { - html: render_to_string({ - partial: "edit.html.erb" - }) + html: render_to_string({ partial: 'edit', formats: :html }) }, status: :ok } end @@ -98,9 +90,11 @@ class ResultTablesController < ApplicationController } format.json { render json: { - html: render_to_string({ - partial: "my_modules/result.html.erb", locals: {result: @result} - }) + html: render_to_string( + partial: 'my_modules/result', + locals: { result: @result }, + formats: :html + ) }, status: :ok } else diff --git a/app/controllers/result_texts_controller.rb b/app/controllers/result_texts_controller.rb index 9ea695025..d2b39b8e5 100644 --- a/app/controllers/result_texts_controller.rb +++ b/app/controllers/result_texts_controller.rb @@ -20,15 +20,9 @@ class ResultTextsController < ApplicationController ) @result.build_result_text - respond_to do |format| - format.json { - render json: { - html: render_to_string({ - partial: "new.html.erb" - }) - }, status: :ok - } - end + render json: { + html: render_to_string({ partial: 'new', formats: :html }) + }, status: :ok end def create @@ -55,15 +49,9 @@ class ResultTextsController < ApplicationController end def edit - respond_to do |format| - format.json { - render json: { - html: render_to_string({ - partial: "edit.html.erb" - }) - }, status: :ok - } - end + render json: { + html: render_to_string({ partial: 'edit', formats: :html }) + }, status: :ok end def update @@ -110,7 +98,7 @@ class ResultTextsController < ApplicationController format.json do render json: { html: render_to_string( - partial: 'my_modules/result.html.erb', + partial: 'my_modules/result', locals: { result: @result }, formats: :html )