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:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user