NewDesign: procedure show only header

This commit is contained in:
Simon Lehericey 2017-07-11 16:09:03 +02:00 committed by Mathieu Magnin
parent 0528b83fcc
commit b48af51ee9
7 changed files with 231 additions and 13 deletions

View file

@ -17,6 +17,7 @@ class Dossier < ActiveRecord::Base
WAITING_FOR_USER = %w(replied)
EN_CONSTRUCTION = %w(initiated updated replied)
EN_INSTRUCTION = %w(received)
EN_CONSTRUCTION_OU_INSTRUCTION = EN_CONSTRUCTION + EN_INSTRUCTION
A_INSTRUIRE = %w(received)
TERMINE = %w(closed refused without_continuation)
@ -43,16 +44,17 @@ class Dossier < ActiveRecord::Base
belongs_to :user
default_scope { where(hidden_at: nil) }
scope :state_brouillon, -> { where(state: BROUILLON) }
scope :state_not_brouillon, -> { where.not(state: BROUILLON) }
scope :state_nouveaux, -> { where(state: NOUVEAUX) }
scope :state_ouvert, -> { where(state: OUVERT) }
scope :state_waiting_for_gestionnaire, -> { where(state: WAITING_FOR_GESTIONNAIRE) }
scope :state_waiting_for_user, -> { where(state: WAITING_FOR_USER) }
scope :state_en_construction, -> { where(state: EN_CONSTRUCTION) }
scope :state_en_instruction, -> { where(state: EN_INSTRUCTION) }
scope :state_a_instruire, -> { where(state: A_INSTRUIRE) }
scope :state_termine, -> { where(state: TERMINE) }
scope :state_brouillon, -> { where(state: BROUILLON) }
scope :state_not_brouillon, -> { where.not(state: BROUILLON) }
scope :state_nouveaux, -> { where(state: NOUVEAUX) }
scope :state_ouvert, -> { where(state: OUVERT) }
scope :state_waiting_for_gestionnaire, -> { where(state: WAITING_FOR_GESTIONNAIRE) }
scope :state_waiting_for_user, -> { where(state: WAITING_FOR_USER) }
scope :state_en_construction, -> { where(state: EN_CONSTRUCTION) }
scope :state_en_instruction, -> { where(state: EN_INSTRUCTION) }
scope :state_en_construction_ou_instruction, -> { where(state: EN_CONSTRUCTION_OU_INSTRUCTION) }
scope :state_a_instruire, -> { where(state: A_INSTRUIRE) }
scope :state_termine, -> { where(state: TERMINE) }
scope :archived, -> { where(archived: true) }
scope :not_archived, -> { where(archived: false) }
@ -67,6 +69,8 @@ class Dossier < ActiveRecord::Base
scope :a_instruire, -> { not_archived.state_a_instruire.order_by_updated_at(:asc) }
scope :termine, -> { not_archived.state_termine.order_by_updated_at(:asc) }
scope :downloadable, -> { state_not_brouillon.order_by_updated_at(:asc) }
scope :en_cours, -> { not_archived.state_en_construction_ou_instruction.order_by_updated_at(:asc) }
scope :without_followers, -> { includes(:follows).where(follows: { id: nil }) }
accepts_nested_attributes_for :individual