Admin procedure sort list
This commit is contained in:
parent
24ace22245
commit
0d2bd17a9e
6 changed files with 43 additions and 25 deletions
|
@ -1,20 +1,30 @@
|
|||
class Admin::ProceduresController < AdminController
|
||||
include SmartListing::Helper::ControllerExtensions
|
||||
helper SmartListing::Helper
|
||||
|
||||
before_action :retrieve_procedure, only: [:show, :edit]
|
||||
before_action :procedure_locked?, only: [:edit]
|
||||
|
||||
def index
|
||||
@procedures = current_administrateur.procedures.where(archived: false)
|
||||
.paginate(:page => params[:page]).decorate
|
||||
@procedures = smart_listing_create :procedures,
|
||||
current_administrateur.procedures.where(archived: false),
|
||||
partial: "admin/procedures/list",
|
||||
array: true
|
||||
|
||||
@page = 'active'
|
||||
active_class
|
||||
end
|
||||
|
||||
def archived
|
||||
@procedures = current_administrateur.procedures.where(archived: true)
|
||||
.paginate(:page => params[:page]).decorate
|
||||
@procedures = smart_listing_create :procedures,
|
||||
current_administrateur.procedures.where(archived: true),
|
||||
partial: "admin/procedures/list",
|
||||
array: true
|
||||
|
||||
@page = 'archived'
|
||||
archived_class
|
||||
|
||||
render 'index'
|
||||
end
|
||||
|
||||
def show
|
||||
|
@ -22,6 +32,7 @@ class Admin::ProceduresController < AdminController
|
|||
end
|
||||
|
||||
def edit
|
||||
|
||||
end
|
||||
|
||||
def new
|
||||
|
|
|
@ -1,14 +1,21 @@
|
|||
- unless smart_listing.empty?
|
||||
%table.table
|
||||
%thead
|
||||
%th#id ID
|
||||
%th#libelle Libellé
|
||||
%th#ID= smart_listing.sortable 'ID', 'id'
|
||||
%th#libelle= smart_listing.sortable 'Libellé', 'libelle'
|
||||
%th#lien Lien
|
||||
|
||||
- @procedures.each do |procedure|
|
||||
- procedure = procedure.decorate
|
||||
%tr
|
||||
%td.col-md-1.col-lg-1= procedure.id
|
||||
%td.col-md-6.col-lg-6
|
||||
= link_to(procedure.libelle, "/admin/procedures/#{procedure.id}")
|
||||
%td= link_to procedure.lien, procedure.lien
|
||||
|
||||
.pagination
|
||||
= will_paginate @procedures, renderer: BootstrapPagination::Rails
|
||||
= smart_listing.paginate
|
||||
= smart_listing.pagination_per_page_links
|
||||
|
||||
- else
|
||||
%h4.center
|
||||
Aucune procédure
|
||||
|
|
|
@ -1,7 +0,0 @@
|
|||
= link_to("Nouvelle procédure", "/admin/procedures/new", class: 'btn btn-success', style: 'float:right; margin-top:2%;')
|
||||
%h1 Gestion des procédures
|
||||
%br
|
||||
|
||||
= render partial: 'onglets'
|
||||
|
||||
= render partial: 'list'
|
|
@ -4,4 +4,4 @@
|
|||
|
||||
= render partial: 'onglets'
|
||||
|
||||
= render partial: 'list'
|
||||
= smart_listing_render :procedures
|
||||
|
|
1
app/views/admin/procedures/index.js.erb
Normal file
1
app/views/admin/procedures/index.js.erb
Normal file
|
@ -0,0 +1 @@
|
|||
<%= smart_listing_update :procedures %>
|
|
@ -23,6 +23,12 @@ fr:
|
|||
will_paginate:
|
||||
next_label: 'Suivant'
|
||||
previous_label: 'Précédent'
|
||||
views:
|
||||
pagination:
|
||||
next: Suivant
|
||||
last: Dernier
|
||||
previous: Précédent
|
||||
first: Premier
|
||||
|
||||
number:
|
||||
currency:
|
||||
|
|
Loading…
Reference in a new issue