feat(manager): display procedure state and unpublished date

This commit is contained in:
Paul Chavard 2023-04-19 18:29:18 +02:00
parent 623628212c
commit ce466d072a
7 changed files with 26 additions and 2 deletions

View file

@ -11,6 +11,7 @@ class ProcedureDashboard < Administrate::BaseDashboard
published_types_de_champ_public: TypesDeChampCollectionField,
published_types_de_champ_private: TypesDeChampCollectionField,
path: ProcedureLinkField,
aasm_state: ProcedureStateField,
dossiers: Field::HasMany,
administrateurs: Field::HasMany,
id: Field::Number.with_options(searchable: true),
@ -56,7 +57,7 @@ class ProcedureDashboard < Administrate::BaseDashboard
:service,
:dossiers,
:published_at,
:unpublished_at
:aasm_state
].freeze
# SHOW_PAGE_ATTRIBUTES
@ -64,6 +65,7 @@ class ProcedureDashboard < Administrate::BaseDashboard
SHOW_PAGE_ATTRIBUTES = [
:id,
:path,
:aasm_state,
:administrateurs,
:libelle,
:description,
@ -78,6 +80,7 @@ class ProcedureDashboard < Administrate::BaseDashboard
:whitelisted_at,
:hidden_at,
:closed_at,
:unpublished_at,
:published_types_de_champ_public,
:published_types_de_champ_private,
:for_individual,

View file

@ -0,0 +1,7 @@
require "administrate/field/base"
class ProcedureStateField < Administrate::Field::String
def name
"Statut"
end
end

View file

@ -1070,7 +1070,7 @@ enum DemarcheState {
close
"""
Depubliee
Dépubliée
"""
depubliee

View file

@ -917,4 +917,13 @@ class Procedure < ApplicationRecord
def stable_ids_used_by_routing_rules
@stable_ids_used_by_routing_rules ||= groupe_instructeurs.flat_map { _1.routing_rule&.sources }.compact
end
# We need this to unfuck administrate + aasm
def self.human_attribute_name(attribute, options = {})
if attribute == :aasm_state
'Statut'
else
super
end
end
end

View file

@ -0,0 +1,2 @@
- if field.data.present?
= t field.data, scope: 'activerecord.attributes.procedure.aasm_state'

View file

@ -0,0 +1,2 @@
- if field.data.present?
= t field.data, scope: 'activerecord.attributes.procedure.aasm_state'

View file

@ -20,6 +20,7 @@ fr:
publiee: Publiée
close: Close
hidden: Supprimée
depubliee: Dépubliée
declarative_with_state/en_instruction: En instruction
declarative_with_state/accepte: Accepté
api_particulier_token: Jeton API Particulier