[Fix #168] Sort published and archived procedures by publication_date
This commit is contained in:
parent
70acbd1ecb
commit
c464a6faba
3 changed files with 16 additions and 5 deletions
|
@ -6,7 +6,7 @@ class Admin::ProceduresController < AdminController
|
|||
|
||||
def index
|
||||
@procedures = smart_listing_create :procedures,
|
||||
current_administrateur.procedures.publiees.order(created_at: :desc),
|
||||
current_administrateur.procedures.publiees.order(published_at: :desc),
|
||||
partial: "admin/procedures/list",
|
||||
array: true
|
||||
|
||||
|
@ -15,7 +15,7 @@ class Admin::ProceduresController < AdminController
|
|||
|
||||
def archived
|
||||
@procedures = smart_listing_create :procedures,
|
||||
current_administrateur.procedures.archivees.order(created_at: :desc),
|
||||
current_administrateur.procedures.archivees.order(published_at: :desc),
|
||||
partial: "admin/procedures/list",
|
||||
array: true
|
||||
|
||||
|
|
|
@ -9,6 +9,10 @@ class ProcedureDecorator < Draper::Decorator
|
|||
created_at.localtime.strftime('%d/%m/%Y %H:%M')
|
||||
end
|
||||
|
||||
def published_at_fr
|
||||
published_at.localtime.strftime('%d/%m/%Y %H:%M')
|
||||
end
|
||||
|
||||
def logo_img
|
||||
if logo.blank?
|
||||
h.image_url(LOGO_NAME)
|
||||
|
|
|
@ -5,7 +5,10 @@
|
|||
%th#libelle= smart_listing.sortable 'Libellé', 'libelle'
|
||||
- if @active_class
|
||||
%th Lien
|
||||
%th#created_at= smart_listing.sortable 'Date création', 'created_at'
|
||||
- if @active_class || @archived_class
|
||||
%th#published_at= smart_listing.sortable 'Date publication', 'published_at'
|
||||
- else
|
||||
%th#created_at= smart_listing.sortable 'Date création', 'created_at'
|
||||
%th Actions
|
||||
|
||||
- @procedures.each do |procedure|
|
||||
|
@ -16,8 +19,12 @@
|
|||
= procedure.libelle
|
||||
- if @active_class
|
||||
%td.procedure-lien= link_to procedure.lien, procedure.lien, 'data-method' => :get
|
||||
%td
|
||||
= procedure.created_at_fr
|
||||
- if @active_class || @archived_class
|
||||
%td
|
||||
= procedure.published_at_fr
|
||||
- else
|
||||
%td
|
||||
= procedure.created_at_fr
|
||||
%td
|
||||
= link_to('Cloner', admin_procedure_clone_path(procedure.id), 'data-method' => :put, class: 'btn-sm btn-primary clone-btn')
|
||||
- unless procedure.publiee_ou_archivee?
|
||||
|
|
Loading…
Add table
Reference in a new issue