Description page is accessible, some field are disabled if procedure is locked
This commit is contained in:
parent
a7b7c8b63f
commit
85608f18ab
3 changed files with 18 additions and 17 deletions
|
@ -3,7 +3,6 @@ class Admin::ProceduresController < AdminController
|
||||||
helper SmartListing::Helper
|
helper SmartListing::Helper
|
||||||
|
|
||||||
before_action :retrieve_procedure, only: [:show, :edit]
|
before_action :retrieve_procedure, only: [:show, :edit]
|
||||||
before_action :procedure_locked?, only: [:edit]
|
|
||||||
|
|
||||||
def index
|
def index
|
||||||
@procedures = smart_listing_create :procedures,
|
@procedures = smart_listing_create :procedures,
|
||||||
|
@ -61,7 +60,7 @@ class Admin::ProceduresController < AdminController
|
||||||
end
|
end
|
||||||
|
|
||||||
def create
|
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?
|
@procedure.module_api_carto = ModuleAPICarto.new(create_module_api_carto_params) if @procedure.valid?
|
||||||
|
|
||||||
unless @procedure.save
|
unless @procedure.save
|
||||||
|
@ -76,7 +75,7 @@ class Admin::ProceduresController < AdminController
|
||||||
def update
|
def update
|
||||||
@procedure = current_administrateur.procedures.find(params[:id])
|
@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('<br />').html_safe
|
flash.now.alert = @procedure.errors.full_messages.join('<br />').html_safe
|
||||||
return render 'edit'
|
return render 'edit'
|
||||||
end
|
end
|
||||||
|
@ -192,8 +191,9 @@ class Admin::ProceduresController < AdminController
|
||||||
|
|
||||||
private
|
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)
|
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
|
end
|
||||||
|
|
||||||
def create_module_api_carto_params
|
def create_module_api_carto_params
|
||||||
|
|
|
@ -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|
|
-{libelle: 'Libellé*', description: 'Description*', organisation: 'Organisation', direction: 'Direction', lien_site_web: 'Lien site internet', lien_notice: 'Lien notice'}.each do |key, value|
|
||||||
.form-group
|
.form-group
|
||||||
|
@ -16,7 +18,7 @@
|
||||||
%h4 Logo de la procédure
|
%h4 Logo de la procédure
|
||||||
- unless @procedure.logo.blank?
|
- unless @procedure.logo.blank?
|
||||||
= image_tag @procedure.decorate.logo_img, {style: 'height: 40px; display: inline; margin-right: 6px', id: 'preview_procedure_logo'}
|
= 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'}
|
%div{style:'margin-top:5px'}
|
||||||
%i
|
%i
|
||||||
|
@ -35,27 +37,27 @@
|
||||||
|
|
||||||
= f.fields_for :module_api_carto, @procedure.module_api_carto do |ff|
|
= f.fields_for :module_api_carto, @procedure.module_api_carto do |ff|
|
||||||
%label
|
%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
|
Utilisation de la cartographie
|
||||||
|
|
||||||
%ul#modules_api_carto
|
%ul#modules_api_carto
|
||||||
%li
|
%li
|
||||||
%label
|
%label
|
||||||
= ff.check_box :quartiers_prioritaires
|
= ff.check_box :quartiers_prioritaires, disabled: @procedure.locked?
|
||||||
Quartiers Prioritaires
|
Quartiers Prioritaires
|
||||||
%li
|
%li
|
||||||
%label
|
%label
|
||||||
= ff.check_box :cadastre
|
= ff.check_box :cadastre, disabled: @procedure.locked?
|
||||||
Cadastre
|
Cadastre
|
||||||
|
|
||||||
.col-xs-6
|
.col-xs-6
|
||||||
- if @procedure.cerfa_flag
|
- if @procedure.cerfa_flag
|
||||||
%h4 Formulaire de demande ou CERFA
|
%h4 Formulaire de demande ou CERFA
|
||||||
%label
|
%label
|
||||||
=f.check_box :cerfa_flag
|
=f.check_box :cerfa_flag, disabled: @procedure.locked?
|
||||||
Activer l'envoi de formulaire de demande ou CERFA
|
Activer l'envoi de formulaire de demande ou CERFA
|
||||||
%br
|
%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
|
%br
|
||||||
.row
|
.row
|
||||||
|
@ -63,7 +65,7 @@
|
||||||
%h4 Particuliers
|
%h4 Particuliers
|
||||||
%div
|
%div
|
||||||
%label
|
%label
|
||||||
=f.check_box :for_individual
|
=f.check_box :for_individual, disabled: @procedure.locked?
|
||||||
Cette procédure s'adresse à un public qui
|
Cette procédure s'adresse à un public qui
|
||||||
%b
|
%b
|
||||||
ne possède pas (ou pas encore) de numéro SIRET,
|
ne possède pas (ou pas encore) de numéro SIRET,
|
||||||
|
@ -72,5 +74,5 @@
|
||||||
%ul#individual_with_siret{style:'margin-top: 8px'}
|
%ul#individual_with_siret{style:'margin-top: 8px'}
|
||||||
%li
|
%li
|
||||||
%label
|
%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.
|
Donner la possibilité de renseigner un SIRET au cours de la construction du dossier.
|
||||||
|
|
|
@ -19,10 +19,9 @@
|
||||||
%div.procedure_list_element{class: ('active' if active == 'Accompagnateurs')}
|
%div.procedure_list_element{class: ('active' if active == 'Accompagnateurs')}
|
||||||
=t('dynamics.admin.procedure.onglets.accompagnateurs')
|
=t('dynamics.admin.procedure.onglets.accompagnateurs')
|
||||||
|
|
||||||
- unless @procedure.locked?
|
%a{:href => "#{url_for edit_admin_procedure_path(@procedure)}", id: 'onglet-description'}
|
||||||
%a{:href => "#{url_for edit_admin_procedure_path(@procedure)}", id: 'onglet-description'}
|
%div.procedure_list_element{class: ('active' if active == 'Description')}
|
||||||
%div.procedure_list_element{class: ('active' if active == 'Description')}
|
Description
|
||||||
Description
|
|
||||||
|
|
||||||
- unless @procedure.locked?
|
- unless @procedure.locked?
|
||||||
%a{:href => "#{url_for admin_procedure_types_de_champ_path(@procedure)}", id: 'onglet-champs'}
|
%a{:href => "#{url_for admin_procedure_types_de_champ_path(@procedure)}", id: 'onglet-champs'}
|
||||||
|
|
Loading…
Reference in a new issue