Add the brouillons scope on Procedure

This commit is contained in:
gregoirenovel 2017-07-11 15:16:06 +02:00
parent fc2540649f
commit 89feb6cdf7
3 changed files with 3 additions and 2 deletions

View file

@ -26,7 +26,7 @@ class Admin::ProceduresController < AdminController
def draft
@procedures = smart_listing_create :procedures,
current_administrateur.procedures.not_published.not_archived.order(created_at: :desc),
current_administrateur.procedures.brouillons.order(created_at: :desc),
partial: "admin/procedures/list",
array: true

View file

@ -32,6 +32,7 @@ class Procedure < ActiveRecord::Base
mount_uploader :logo, ProcedureLogoUploader
default_scope { where(hidden_at: nil) }
scope :brouillons, -> { not_published.not_archived }
scope :publiees, -> { where.not(published_at: nil).where(archived_at: nil) }
scope :publiee_ou_archivee, -> { where.not(published_at: nil) }
scope :not_published, -> { where(published_at: nil) }

View file

@ -13,7 +13,7 @@
.procedure-list-element{ class: @draft_class }
Brouillons
.badge.progress-bar-default
= current_administrateur.procedures.not_published.not_archived.count
= current_administrateur.procedures.brouillons.count
%a#active-procedures{ :href => "#{url_for :admin_procedures}" }
.procedure-list-element{ class: @active_class }