Add the archivees scope on Procedure

This commit is contained in:
gregoirenovel 2017-07-11 15:19:42 +02:00
parent 89feb6cdf7
commit 75aebe4f07
3 changed files with 3 additions and 2 deletions

View file

@ -15,7 +15,7 @@ class Admin::ProceduresController < AdminController
def archived def archived
@procedures = smart_listing_create :procedures, @procedures = smart_listing_create :procedures,
current_administrateur.procedures.archived.order(created_at: :desc), current_administrateur.procedures.archivees.order(created_at: :desc),
partial: "admin/procedures/list", partial: "admin/procedures/list",
array: true array: true

View file

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

View file

@ -25,7 +25,7 @@
.procedure-list-element{ class: @archived_class } .procedure-list-element{ class: @archived_class }
Archivées Archivées
.badge.progress-bar-purple .badge.progress-bar-purple
= current_administrateur.procedures.archived.count = current_administrateur.procedures.archivees.count
.split-hr-left .split-hr-left