diff --git a/app/controllers/admin/procedures_controller.rb b/app/controllers/admin/procedures_controller.rb index 2f7f11d1b..febf858fd 100644 --- a/app/controllers/admin/procedures_controller.rb +++ b/app/controllers/admin/procedures_controller.rb @@ -3,7 +3,6 @@ class Admin::ProceduresController < AdminController helper SmartListing::Helper before_action :retrieve_procedure, only: [:show, :edit] - before_action :procedure_locked?, only: [:edit] def index @procedures = smart_listing_create :procedures, @@ -61,7 +60,7 @@ class Admin::ProceduresController < AdminController end def create - @procedure = Procedure.new(create_procedure_params) + @procedure = Procedure.new(procedure_params) @procedure.module_api_carto = ModuleAPICarto.new(create_module_api_carto_params) if @procedure.valid? unless @procedure.save @@ -76,7 +75,7 @@ class Admin::ProceduresController < AdminController def update @procedure = current_administrateur.procedures.find(params[:id]) - unless @procedure.update_attributes(create_procedure_params) + unless @procedure.update_attributes(procedure_params) flash.now.alert = @procedure.errors.full_messages.join('
').html_safe return render 'edit' end @@ -192,8 +191,9 @@ class Admin::ProceduresController < AdminController private - def create_procedure_params + def procedure_params params.require(:procedure).permit(:libelle, :description, :organisation, :direction, :lien_demarche, :lien_site_web, :lien_notice, :euro_flag, :logo, :cerfa_flag, :for_individual, :individual_with_siret, module_api_carto_attributes: [:id, :use_api_carto, :quartiers_prioritaires, :cadastre]).merge(administrateur_id: current_administrateur.id) + end def create_module_api_carto_params diff --git a/app/views/admin/procedures/_informations.html.haml b/app/views/admin/procedures/_informations.html.haml index d34f1c07f..035381d5b 100644 --- a/app/views/admin/procedures/_informations.html.haml +++ b/app/views/admin/procedures/_informations.html.haml @@ -1,5 +1,7 @@ -%br +- if @procedure.locked? + .alert.alert-info + Cette procédure est publiée, certaines informations ne sont plus modifiables -{libelle: 'Libellé*', description: 'Description*', organisation: 'Organisation', direction: 'Direction', lien_site_web: 'Lien site internet', lien_notice: 'Lien notice'}.each do |key, value| .form-group @@ -16,7 +18,7 @@ %h4 Logo de la procédure - unless @procedure.logo.blank? = image_tag @procedure.decorate.logo_img, {style: 'height: 40px; display: inline; margin-right: 6px', id: 'preview_procedure_logo'} - = f.file_field(:logo, accept: 'image/png, image/jpg, image/jpeg', style: 'display:inline') + = f.file_field :logo, accept: 'image/png, image/jpg, image/jpeg', style: 'display:inline', disabled: @procedure.locked? %div{style:'margin-top:5px'} %i @@ -35,27 +37,27 @@ = f.fields_for :module_api_carto, @procedure.module_api_carto do |ff| %label - =ff.check_box :use_api_carto, {id: :procedure_module_api_carto_use_api_carto} + =ff.check_box :use_api_carto, disabled: @procedure.locked?, id: :procedure_module_api_carto_use_api_carto Utilisation de la cartographie %ul#modules_api_carto %li %label - = ff.check_box :quartiers_prioritaires + = ff.check_box :quartiers_prioritaires, disabled: @procedure.locked? Quartiers Prioritaires %li %label - = ff.check_box :cadastre + = ff.check_box :cadastre, disabled: @procedure.locked? Cadastre .col-xs-6 - if @procedure.cerfa_flag %h4 Formulaire de demande ou CERFA %label - =f.check_box :cerfa_flag + =f.check_box :cerfa_flag, disabled: @procedure.locked? Activer l'envoi de formulaire de demande ou CERFA %br - =f.text_field :lien_demarche, class: 'form-control', placeholder: 'URL vers le formulaire vierge (facultatif)' + =f.text_field :lien_demarche, class: 'form-control', placeholder: 'URL vers le formulaire vierge (facultatif)', disabled: @procedure.locked? %br .row @@ -63,7 +65,7 @@ %h4 Particuliers %div %label - =f.check_box :for_individual + =f.check_box :for_individual, disabled: @procedure.locked? Cette procédure s'adresse à un public qui %b ne possède pas (ou pas encore) de numéro SIRET, @@ -72,5 +74,5 @@ %ul#individual_with_siret{style:'margin-top: 8px'} %li %label - =f.check_box :individual_with_siret + =f.check_box :individual_with_siret, disabled: @procedure.locked? Donner la possibilité de renseigner un SIRET au cours de la construction du dossier. diff --git a/app/views/layouts/left_panels/_left_panel_admin_procedurescontroller_navbar.html.haml b/app/views/layouts/left_panels/_left_panel_admin_procedurescontroller_navbar.html.haml index 66ab55a3f..a78879adc 100644 --- a/app/views/layouts/left_panels/_left_panel_admin_procedurescontroller_navbar.html.haml +++ b/app/views/layouts/left_panels/_left_panel_admin_procedurescontroller_navbar.html.haml @@ -19,10 +19,9 @@ %div.procedure_list_element{class: ('active' if active == 'Accompagnateurs')} =t('dynamics.admin.procedure.onglets.accompagnateurs') - - unless @procedure.locked? - %a{:href => "#{url_for edit_admin_procedure_path(@procedure)}", id: 'onglet-description'} - %div.procedure_list_element{class: ('active' if active == 'Description')} - Description + %a{:href => "#{url_for edit_admin_procedure_path(@procedure)}", id: 'onglet-description'} + %div.procedure_list_element{class: ('active' if active == 'Description')} + Description - unless @procedure.locked? %a{:href => "#{url_for admin_procedure_types_de_champ_path(@procedure)}", id: 'onglet-champs'}