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)
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
end
@ -176,6 +184,10 @@ module Manager
params.require(:procedure).permit(:tags)
end
def is_template_params
params.require(:procedure).permit(:is_template)
end
def tags_csv_file
params[:tags_csv_file]
end

View file

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

View file

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