Instructeur should see published drafts

This commit is contained in:
Paul Chavard 2018-09-07 11:20:16 +01:00
parent eb25c7b22d
commit 23170f54c0
2 changed files with 6 additions and 1 deletions

View file

@ -18,7 +18,11 @@ class Gestionnaire < ApplicationRecord
has_many :dossiers_from_avis, through: :avis, source: :dossier
def visible_procedures
procedures.publiees_ou_archivees
if Flipflop.publish_draft?
procedures.avec_lien
else
procedures.publiees_ou_archivees
end
end
def can_view_dossier?(dossier_id)

View file

@ -46,6 +46,7 @@ class Procedure < ApplicationRecord
scope :by_libelle, -> { order(libelle: :asc) }
scope :created_during, -> (range) { where(created_at: range) }
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 :description, presence: true, allow_blank: false, allow_nil: false