From 0838c0db33c9b0fa0a9614f3df50e82681a05719 Mon Sep 17 00:00:00 2001 From: Jez Caudle Date: Wed, 4 Dec 2024 18:03:43 +0000 Subject: [PATCH] Fixed with JavaScript. Should have done this first. --- app/controllers/subprincipleitems_controller.rb | 5 +++-- app/views/subprincipleitems/update.html.erb | 4 +++- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/app/controllers/subprincipleitems_controller.rb b/app/controllers/subprincipleitems_controller.rb index 1afd8e9..8954060 100644 --- a/app/controllers/subprincipleitems_controller.rb +++ b/app/controllers/subprincipleitems_controller.rb @@ -6,14 +6,15 @@ class SubprincipleitemsController < ApplicationController end def update + @redirect_path = helpers.raw("#{company_caf_path(@caf.company, @caf)}##{helpers.dom_id(@subprincipleitem)}") respond_to do |format| if @subprincipleitem.update(subprincipleitem_params) - #redirect_path = helpers.raw("#{company_caf_path(@caf.company, @caf)}/bollox") + #format.html { redirect_to company_caf_path(@caf.company, @caf) , html_options: { target: helpers.dom_id(@subprincipleitem) } , notice: "html" } ##{company_caf_path(@caf.company, @caf)}#subprincipleitem_#{@subprincipleitem.id} #{helpers.dom_id(@subprincipleitem)} #format.json { render :show, status: :ok, location: @company } - format.html { render :update } + format.html { render :update, status: :temporary_redirect} else format.html { render :edit, status: :unprocessable_entity } format.json { render json: @company.errors, status: :unprocessable_entity } diff --git a/app/views/subprincipleitems/update.html.erb b/app/views/subprincipleitems/update.html.erb index 42d40b1..6785255 100644 --- a/app/views/subprincipleitems/update.html.erb +++ b/app/views/subprincipleitems/update.html.erb @@ -1 +1,3 @@ -Bollox +