Add sort list on demo page
This commit is contained in:
parent
afd6d443f3
commit
47932890cc
7 changed files with 47 additions and 22 deletions
2
Gemfile
2
Gemfile
|
@ -72,6 +72,8 @@ gem 'hashie'
|
||||||
|
|
||||||
gem 'mailjet'
|
gem 'mailjet'
|
||||||
|
|
||||||
|
gem "smart_listing"
|
||||||
|
|
||||||
group :test do
|
group :test do
|
||||||
gem 'capybara'
|
gem 'capybara'
|
||||||
gem 'factory_girl'
|
gem 'factory_girl'
|
||||||
|
|
|
@ -178,6 +178,9 @@ GEM
|
||||||
multi_json (>= 1.3)
|
multi_json (>= 1.3)
|
||||||
securecompare
|
securecompare
|
||||||
url_safe_base64
|
url_safe_base64
|
||||||
|
kaminari (0.16.3)
|
||||||
|
actionpack (>= 3.0.0)
|
||||||
|
activesupport (>= 3.0.0)
|
||||||
kgio (2.9.3)
|
kgio (2.9.3)
|
||||||
leaflet-draw-rails (0.1.0)
|
leaflet-draw-rails (0.1.0)
|
||||||
leaflet-markercluster-rails (0.7.0)
|
leaflet-markercluster-rails (0.7.0)
|
||||||
|
@ -363,6 +366,11 @@ GEM
|
||||||
simplecov-html (~> 0.8.0)
|
simplecov-html (~> 0.8.0)
|
||||||
simplecov-html (0.8.0)
|
simplecov-html (0.8.0)
|
||||||
slop (3.6.0)
|
slop (3.6.0)
|
||||||
|
smart_listing (1.1.2)
|
||||||
|
coffee-rails
|
||||||
|
jquery-rails
|
||||||
|
kaminari (~> 0.16.1)
|
||||||
|
rails (>= 3.2)
|
||||||
spring (1.3.6)
|
spring (1.3.6)
|
||||||
spring-commands-rspec (1.0.4)
|
spring-commands-rspec (1.0.4)
|
||||||
spring (>= 0.9.1)
|
spring (>= 0.9.1)
|
||||||
|
@ -482,6 +490,7 @@ DEPENDENCIES
|
||||||
sentry-raven
|
sentry-raven
|
||||||
shoulda-matchers
|
shoulda-matchers
|
||||||
simplecov
|
simplecov
|
||||||
|
smart_listing
|
||||||
spring
|
spring
|
||||||
spring-commands-rspec
|
spring-commands-rspec
|
||||||
terminal-notifier
|
terminal-notifier
|
||||||
|
|
|
@ -24,3 +24,4 @@
|
||||||
//= require concavehull.min
|
//= require concavehull.min
|
||||||
//= require graham_scan.min
|
//= require graham_scan.min
|
||||||
//= require leaflet.freedraw
|
//= require leaflet.freedraw
|
||||||
|
//= require smart_listing
|
|
@ -1,7 +1,11 @@
|
||||||
class DemoController < ApplicationController
|
class DemoController < ApplicationController
|
||||||
|
include SmartListing::Helper::ControllerExtensions
|
||||||
|
helper SmartListing::Helper
|
||||||
|
|
||||||
def index
|
def index
|
||||||
@procedures = Procedure.where(archived: false).order('libelle ASC').decorate
|
smart_listing_create :procedures,
|
||||||
|
Procedure.where(archived: false),
|
||||||
|
partial: "demo/list",
|
||||||
|
array: true
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
27
app/views/demo/_list.html.haml
Normal file
27
app/views/demo/_list.html.haml
Normal file
|
@ -0,0 +1,27 @@
|
||||||
|
- unless smart_listing.empty?
|
||||||
|
%table.table
|
||||||
|
%tr
|
||||||
|
%th{colspan: 4}
|
||||||
|
%h4 Lien vers les procédures TPS
|
||||||
|
%tr
|
||||||
|
%th= smart_listing.sortable 'ID', 'id'
|
||||||
|
%th= smart_listing.sortable 'Titre', 'libelle'
|
||||||
|
%th Description
|
||||||
|
%th= smart_listing.sortable 'Organisation', 'organisation'
|
||||||
|
|
||||||
|
- smart_listing.collection.each do |procedure|
|
||||||
|
- procedure = procedure.decorate
|
||||||
|
%tr
|
||||||
|
%td
|
||||||
|
= procedure.id
|
||||||
|
%td.col-md-4.col-lg-4
|
||||||
|
= link_to procedure.libelle, procedure.lien
|
||||||
|
%td
|
||||||
|
= procedure.description
|
||||||
|
%td.col-md-3.col-lg-3
|
||||||
|
= procedure.organisation
|
||||||
|
|
||||||
|
= smart_listing.paginate
|
||||||
|
= smart_listing.pagination_per_page_links
|
||||||
|
- else
|
||||||
|
%p Aucune procédure trouvée
|
|
@ -1,20 +1 @@
|
||||||
%table.table
|
= smart_listing_render :procedures
|
||||||
%tr
|
|
||||||
%th{colspan: 4}
|
|
||||||
%h4 Lien vers les procédures TPS
|
|
||||||
%tr
|
|
||||||
%th ID
|
|
||||||
%th Titre
|
|
||||||
%th Description
|
|
||||||
%th Organisation
|
|
||||||
|
|
||||||
- @procedures.each do |procedure|
|
|
||||||
%tr
|
|
||||||
%td
|
|
||||||
= procedure.id
|
|
||||||
%td.col-md-4.col-lg-4
|
|
||||||
= link_to procedure.libelle, procedure.lien
|
|
||||||
%td
|
|
||||||
= procedure.description
|
|
||||||
%td.col-md-3.col-lg-3
|
|
||||||
= procedure.organisation
|
|
1
app/views/demo/index.js.erb
Normal file
1
app/views/demo/index.js.erb
Normal file
|
@ -0,0 +1 @@
|
||||||
|
<%= smart_listing_update :procedures %>
|
Loading…
Reference in a new issue