This commit is contained in:
Kara Diaby 2024-01-26 09:30:16 +00:00
parent 7f37be71bd
commit 53372edd02
3 changed files with 16 additions and 1 deletions

View file

@ -120,6 +120,14 @@ module Manager
redirect_to manager_procedure_path(procedure) redirect_to manager_procedure_path(procedure)
end end
def update_template_status
if procedure.update(is_template_params)
redirect_to manager_procedure_path(procedure), notice: 'Le statut de modèle a été mis à jour.'
else
flash.alert = procedure.errors.full_messages.join(', ')
end
end
def import_data def import_data
end end
@ -176,6 +184,10 @@ module Manager
params.require(:procedure).permit(:tags) params.require(:procedure).permit(:tags)
end end
def is_template_params
params.require(:procedure).permit(:is_template)
end
def tags_csv_file def tags_csv_file
params[:tags_csv_file] params[:tags_csv_file]
end end

View file

@ -47,7 +47,8 @@ class ProcedureDashboard < Administrate::BaseDashboard
estimated_duration_visible: Field::Boolean, estimated_duration_visible: Field::Boolean,
piece_justificative_multiple: Field::Boolean, piece_justificative_multiple: Field::Boolean,
replaced_by_procedure_id: Field::String, replaced_by_procedure_id: Field::String,
tags: Field::Text tags: Field::Text,
is_template: Field::Boolean
}.freeze }.freeze
# COLLECTION_ATTRIBUTES # COLLECTION_ATTRIBUTES
@ -79,6 +80,7 @@ class ProcedureDashboard < Administrate::BaseDashboard
:libelle, :libelle,
:description, :description,
:tags, :tags,
:is_template,
:lien_site_web, :lien_site_web,
:organisation, :organisation,
:zones, :zones,

View file

@ -24,6 +24,7 @@ Rails.application.routes.draw do
post 'add_administrateur_with_confirmation', on: :member post 'add_administrateur_with_confirmation', on: :member
post 'change_piece_justificative_template', on: :member post 'change_piece_justificative_template', on: :member
patch 'add_tags', on: :member patch 'add_tags', on: :member
patch 'update_template_status', on: :member
get 'export_mail_brouillons', on: :member get 'export_mail_brouillons', on: :member
resources :confirmation_urls, only: :new resources :confirmation_urls, only: :new
resources :administrateur_confirmations, only: [:new, :create] resources :administrateur_confirmations, only: [:new, :create]