demarches-normaliennes/app/controllers/prefill_descriptions_controller.rb
Sébastien Carceles 0a10a08c21
feat(demarche): describe procedure prefilling (#8187)
* feat(demarche): description

Show the description of an opendata procedure (published or draft),
with help about how to prefill a dossier for this procedure.

Co-authored-by: Damien Le Thiec <damien.lethiec@gmail.com>
2022-12-19 11:32:09 +00:00

32 lines
760 B
Ruby

class PrefillDescriptionsController < ApplicationController
before_action :retrieve_procedure
before_action :set_prefill_description
def edit
end
def update
@prefill_description.update(prefill_description_params)
respond_to do |format|
format.turbo_stream
format.html { render :edit }
end
end
private
def retrieve_procedure
@procedure = Procedure.publiees_ou_brouillons.opendata.find_by!(path: params[:path])
end
def set_prefill_description
@prefill_description = PrefillDescription.new(@procedure)
end
def prefill_description_params
params.require(:procedure).permit(selected_type_de_champ_ids: [])
rescue ActionController::ParameterMissing
{ selected_type_de_champ_ids: [] }
end
end