Instructeur should see published drafts
This commit is contained in:
parent
eb25c7b22d
commit
23170f54c0
2 changed files with 6 additions and 1 deletions
|
@ -18,8 +18,12 @@ class Gestionnaire < ApplicationRecord
|
||||||
has_many :dossiers_from_avis, through: :avis, source: :dossier
|
has_many :dossiers_from_avis, through: :avis, source: :dossier
|
||||||
|
|
||||||
def visible_procedures
|
def visible_procedures
|
||||||
|
if Flipflop.publish_draft?
|
||||||
|
procedures.avec_lien
|
||||||
|
else
|
||||||
procedures.publiees_ou_archivees
|
procedures.publiees_ou_archivees
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
|
||||||
def can_view_dossier?(dossier_id)
|
def can_view_dossier?(dossier_id)
|
||||||
avis.where(dossier_id: dossier_id).any? ||
|
avis.where(dossier_id: dossier_id).any? ||
|
||||||
|
|
|
@ -46,6 +46,7 @@ class Procedure < ApplicationRecord
|
||||||
scope :by_libelle, -> { order(libelle: :asc) }
|
scope :by_libelle, -> { order(libelle: :asc) }
|
||||||
scope :created_during, -> (range) { where(created_at: range) }
|
scope :created_during, -> (range) { where(created_at: range) }
|
||||||
scope :cloned_from_library, -> { where(cloned_from_library: true) }
|
scope :cloned_from_library, -> { where(cloned_from_library: true) }
|
||||||
|
scope :avec_lien, -> { joins(:procedure_path) }
|
||||||
|
|
||||||
validates :libelle, presence: true, allow_blank: false, allow_nil: false
|
validates :libelle, presence: true, allow_blank: false, allow_nil: false
|
||||||
validates :description, presence: true, allow_blank: false, allow_nil: false
|
validates :description, presence: true, allow_blank: false, allow_nil: false
|
||||||
|
|
Loading…
Add table
Reference in a new issue