Use the not_archived Procedure scope

This commit is contained in:
gregoirenovel 2017-07-10 16:48:32 +02:00
parent 31b23ac74e
commit 411c5791c8
4 changed files with 6 additions and 6 deletions

View file

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

View file

@ -6,7 +6,7 @@ class DemoController < ApplicationController
return redirect_to root_path if Rails.env.production?
smart_listing_create :procedures,
Procedure.published.where(archived: false).order("id DESC"),
Procedure.published.not_archived.order("id DESC"),
partial: "demo/list",
array: true
end

View file

@ -60,7 +60,7 @@ class Users::DossiersController < UsersController
end
def new
procedure = Procedure.where(archived: false).published.find(params[:procedure_id])
procedure = Procedure.not_archived.published.find(params[:procedure_id])
dossier = Dossier.create(procedure: procedure, user: current_user, state: 'draft')
siret = params[:siret] || current_user.siret

View file

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