Don't know how to get the page to scroll back to the last update

Evidence is now saved
More cleaning up to do.
This commit is contained in:
2024-10-14 11:55:43 +01:00
parent b725d2dd74
commit 7f2275c40e
3 changed files with 16 additions and 5 deletions

View File

@@ -1,5 +1,6 @@
class SubprincipleitemsController < ApplicationController
before_action :set_subprincipleitem, only: %i[ edit update ]
before_action :set_caf, only: %i[ edit update ]
def edit
end
@@ -7,7 +8,7 @@ class SubprincipleitemsController < ApplicationController
def update
respond_to do |format|
if @subprincipleitem.update(subprincipleitem_params)
format.html { redirect_to company_url(@company), notice: "Company was successfully updated." }
format.html { redirect_to (company_caf_path(@caf.company, @caf) + "#subprincipleitem_#{@subprincipleitem.id}"), notice: "CAF item was updated." }
format.json { render :show, status: :ok, location: @company }
else
format.html { render :edit, status: :unprocessable_entity }
@@ -21,8 +22,12 @@ class SubprincipleitemsController < ApplicationController
@subprincipleitem = Subprincipleitem.find(params[:id])
end
def set_caf
@caf = Caf.find(params[:caf_id])
end
# Only allow a list of trusted parameters through.
def subprincipleitem_params
params.require(:subprincipleitem).permit(:affirmative)
params.require(:subprincipleitem).permit(:affirmative,:evidence)
end
end