Add the not_published Procedure scope

This commit is contained in:
gregoirenovel 2017-07-10 16:46:37 +02:00
parent 811723e5fb
commit 31b23ac74e
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.where(published: false, archived: false).order(created_at: :desc),
current_administrateur.procedures.not_published.where(archived: false).order(created_at: :desc),
partial: "admin/procedures/list",
array: true

View file

@ -33,6 +33,7 @@ class Procedure < ActiveRecord::Base
default_scope { where(hidden_at: nil) }
scope :published, -> { where(published: true) }
scope :not_published, -> { where(published: false) }
scope :not_archived, -> { where(archived: false) }
scope :by_libelle, -> { order(libelle: :asc) }

View file

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