administrateur can add zone to procedure

This commit is contained in:
Christophe Robillard 2021-12-01 21:38:41 +01:00
parent 561f6fb274
commit 9341c787a1
4 changed files with 14 additions and 1 deletions

View file

@ -251,7 +251,7 @@ module Administrateurs
end end
def procedure_params def procedure_params
editable_params = [:libelle, :description, :organisation, :direction, :lien_site_web, :cadre_juridique, :deliberation, :notice, :web_hook_url, :declarative_with_state, :logo, :auto_archive_on, :monavis_embed, :api_entreprise_token, :duree_conservation_dossiers_dans_ds] editable_params = [:libelle, :description, :organisation, :direction, :lien_site_web, :cadre_juridique, :deliberation, :notice, :web_hook_url, :declarative_with_state, :logo, :auto_archive_on, :monavis_embed, :api_entreprise_token, :duree_conservation_dossiers_dans_ds, :zone_id]
permited_params = if @procedure&.locked? permited_params = if @procedure&.locked?
params.require(:procedure).permit(*editable_params) params.require(:procedure).permit(*editable_params)
else else

View file

@ -13,6 +13,11 @@
%span.mandatory * %span.mandatory *
= f.text_area :description, rows: '6', placeholder: 'Description de la démarche, destinataires, etc. ', class: 'form-control' = f.text_area :description, rows: '6', placeholder: 'Description de la démarche, destinataires, etc. ', class: 'form-control'
= f.label :zone do
Organisme qui met en oeuvre la démarche
%span.mandatory *
= f.collection_select :zone_id, Zone.order(:label), :id, :label, prompt: true
%h3.header-subsection Logo de la démarche %h3.header-subsection Logo de la démarche
= image_upload_and_render f, @procedure.logo = image_upload_and_render f, @procedure.logo

View file

@ -7,6 +7,7 @@ describe Administrateurs::ProceduresController, type: :controller do
let(:description) { 'Description de test' } let(:description) { 'Description de test' }
let(:organisation) { 'Organisation de test' } let(:organisation) { 'Organisation de test' }
let(:direction) { 'Direction de test' } let(:direction) { 'Direction de test' }
let(:ministere) { create(:zone) }
let(:cadre_juridique) { 'cadre juridique' } let(:cadre_juridique) { 'cadre juridique' }
let(:duree_conservation_dossiers_dans_ds) { 3 } let(:duree_conservation_dossiers_dans_ds) { 3 }
let(:monavis_embed) { nil } let(:monavis_embed) { nil }
@ -30,6 +31,7 @@ describe Administrateurs::ProceduresController, type: :controller do
description: description, description: description,
organisation: organisation, organisation: organisation,
direction: direction, direction: direction,
ministere: ministere,
cadre_juridique: cadre_juridique, cadre_juridique: cadre_juridique,
duree_conservation_dossiers_dans_ds: duree_conservation_dossiers_dans_ds, duree_conservation_dossiers_dans_ds: duree_conservation_dossiers_dans_ds,
monavis_embed: monavis_embed, monavis_embed: monavis_embed,

6
spec/factories/zone.rb Normal file
View file

@ -0,0 +1,6 @@
FactoryBot.define do
factory :zone do
sequence(:acronym) { |n| "MA#{n}" }
sequence(:label) { |n| "Ministère de l'Education Populaire #{n}" }
end
end