Log dossier archiver/desarchiver operations
This commit is contained in:
parent
58bc2ee4e3
commit
a911a71db9
3 changed files with 15 additions and 3 deletions
|
@ -97,12 +97,12 @@ module Instructeurs
|
||||||
end
|
end
|
||||||
|
|
||||||
def archive
|
def archive
|
||||||
dossier.update(archived: true)
|
dossier.archiver!(current_instructeur)
|
||||||
redirect_back(fallback_location: instructeur_procedures_url)
|
redirect_back(fallback_location: instructeur_procedures_url)
|
||||||
end
|
end
|
||||||
|
|
||||||
def unarchive
|
def unarchive
|
||||||
dossier.update(archived: false)
|
dossier.desarchiver!(current_instructeur)
|
||||||
redirect_back(fallback_location: instructeur_procedures_url)
|
redirect_back(fallback_location: instructeur_procedures_url)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -416,6 +416,16 @@ class Dossier < ApplicationRecord
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def archiver!(author)
|
||||||
|
update!(archived: true)
|
||||||
|
log_dossier_operation(author, :archiver)
|
||||||
|
end
|
||||||
|
|
||||||
|
def desarchiver!(author)
|
||||||
|
update!(archived: false)
|
||||||
|
log_dossier_operation(author, :desarchiver)
|
||||||
|
end
|
||||||
|
|
||||||
def text_summary
|
def text_summary
|
||||||
if brouillon?
|
if brouillon?
|
||||||
parts = [
|
parts = [
|
||||||
|
|
|
@ -26,7 +26,9 @@ class DossierOperationLog < ApplicationRecord
|
||||||
supprimer: 'supprimer',
|
supprimer: 'supprimer',
|
||||||
restaurer: 'restaurer',
|
restaurer: 'restaurer',
|
||||||
modifier_annotation: 'modifier_annotation',
|
modifier_annotation: 'modifier_annotation',
|
||||||
demander_un_avis: 'demander_un_avis'
|
demander_un_avis: 'demander_un_avis',
|
||||||
|
archiver: 'archiver',
|
||||||
|
desarchiver: 'desarchiver'
|
||||||
}
|
}
|
||||||
|
|
||||||
has_one_attached :serialized
|
has_one_attached :serialized
|
||||||
|
|
Loading…
Add table
Reference in a new issue