Disable carto for new procedures

This commit is contained in:
Paul Chavard 2018-11-20 11:20:10 +01:00
parent 864d1df413
commit d43068ace5
3 changed files with 1 additions and 41 deletions

View file

@ -66,7 +66,7 @@ class Admin::ProceduresController < AdminController
@procedure = Procedure.new(procedure_params)
if @procedure.valid?
@procedure.module_api_carto = ModuleAPICarto.new(create_module_api_carto_params)
@procedure.module_api_carto = ModuleAPICarto.new
end
@path = @procedure.path
@ -271,8 +271,4 @@ class Admin::ProceduresController < AdminController
params.require(:procedure).permit(*editable_params, :duree_conservation_dossiers_dans_ds, :duree_conservation_dossiers_hors_ds, :for_individual, :individual_with_siret, :ask_birthday, module_api_carto_attributes: [:id, :use_api_carto, :quartiers_prioritaires, :cadastre]).merge(administrateur_id: current_administrateur.id)
end
end
def create_module_api_carto_params
params.require(:procedure).require(:module_api_carto_attributes).permit(:id, :use_api_carto, :quartiers_prioritaires, :cadastre)
end
end

View file

@ -119,30 +119,6 @@
Afficher le drapeau européen
- if !@procedure.locked?
.row
.col-md-6
%h4 Cartographie
= f.fields_for :module_api_carto, @procedure.module_api_carto do |ff|
.checkbox
%label
= ff.check_box :use_api_carto, id: "procedure-module-api-carto-use-api-carto"
Utilisation de la cartographie
%ul#modules-api-carto
%li
.checkbox
%label
= ff.check_box :quartiers_prioritaires
Quartiers prioritaires
%li
.checkbox
%label
= ff.check_box :cadastre
Cadastre
.col-md-6
.row
.col-md-6
%h4 Particuliers

View file

@ -201,18 +201,6 @@ describe Admin::ProceduresController, type: :controller do
it { expect(subject.duree_conservation_dossiers_hors_ds).to eq(duree_conservation_dossiers_hors_ds) }
end
describe 'procedure module api carto attributs in database' do
let(:procedure) { Procedure.last }
let(:use_api_carto) { '1' }
let(:quartiers_prioritaires) { '1' }
subject { ModuleAPICarto.last }
it { expect(subject.procedure).to eq(procedure) }
it { expect(subject.use_api_carto).to be_truthy }
it { expect(subject.quartiers_prioritaires).to be_truthy }
end
it { is_expected.to redirect_to(admin_procedure_types_de_champ_path(procedure_id: Procedure.last.id)) }
it { expect(flash[:notice]).to be_present }