Continuous pagination. Refs #24
This commit is contained in:
parent
3a5df0b521
commit
bede2ce5e1
|
@ -0,0 +1,24 @@
|
||||||
|
# Automatic ajax pagination
|
||||||
|
$(document).ready ->
|
||||||
|
$('.pagination .next a')
|
||||||
|
.attr('data-remote', true)
|
||||||
|
.click ->
|
||||||
|
$('#loading').fadeIn()
|
||||||
|
|
||||||
|
$(document).on 'ajax:success', '.pagination .next a', (event, data, status, xhr) ->
|
||||||
|
$('#loading').fadeOut()
|
||||||
|
elts = $('tbody tr', data)
|
||||||
|
$(this).parents('tfoot').prev().append(elts)
|
||||||
|
|
||||||
|
next = $('.pagination .next a', data).attr('href')
|
||||||
|
if next?
|
||||||
|
return $(this).show().data('remote', true).attr('href', next)
|
||||||
|
else
|
||||||
|
return $(this).parents('.pagination').remove()
|
||||||
|
|
||||||
|
# Go to the next page when page is scrolled
|
||||||
|
if $('.pagination .next a').size() > 0
|
||||||
|
$(document).scroll ->
|
||||||
|
if $(window).scrollTop() == $(document).height() - $(window).height() && $('.pagination .next a').is(':visible')
|
||||||
|
# "Next" link is also hidden while pagination is done
|
||||||
|
$('.pagination .next a').hide().click()
|
|
@ -268,6 +268,12 @@ footer.bottom nav
|
||||||
vertical-align: baseline
|
vertical-align: baseline
|
||||||
+text-shadow(0 0 4px gray)
|
+text-shadow(0 0 4px gray)
|
||||||
|
|
||||||
|
.pagination
|
||||||
|
span
|
||||||
|
display: none
|
||||||
|
span.next
|
||||||
|
display: block
|
||||||
|
|
||||||
.select2-container ul
|
.select2-container ul
|
||||||
min-width: 46em
|
min-width: 46em
|
||||||
.select2-container-multi.select2-container-active .select2-choices, .select2-drop
|
.select2-container-multi.select2-container-active .select2-choices, .select2-drop
|
||||||
|
|
|
@ -59,4 +59,6 @@
|
||||||
= link_to edit_orga_path orga do
|
= link_to edit_orga_path orga do
|
||||||
%em.fa.fa-pencil
|
%em.fa.fa-pencil
|
||||||
|
|
||||||
= paginate @orgas
|
%tfoot
|
||||||
|
%tr
|
||||||
|
%th(colspan='12')= paginate @orgas
|
||||||
|
|
|
@ -39,13 +39,15 @@
|
||||||
%td{ title: changes }= t ".#{version.event}_html"
|
%td{ title: changes }= t ".#{version.event}_html"
|
||||||
%td= User.find version.whodunnit if version.whodunnit
|
%td= User.find version.whodunnit if version.whodunnit
|
||||||
%td= object
|
%td= object
|
||||||
%td= l version.created_at
|
%td= l version.created_at, format: :short
|
||||||
%td
|
%td
|
||||||
%a{ href: polymorphic_path(version.item_type.tableize.singularize,
|
%a{ href: polymorphic_path(version.item_type.tableize.singularize,
|
||||||
id: version.item_id) }
|
id: version.item_id) }
|
||||||
%em.fa.fa-eye
|
%em.fa.fa-eye
|
||||||
|
|
||||||
= paginate @versions
|
%tfoot
|
||||||
|
%tr
|
||||||
|
%th(colspan='5')= paginate @versions
|
||||||
|
|
||||||
.formats
|
.formats
|
||||||
= link_to versions_path(format: :rss) do
|
= link_to versions_path(format: :rss) do
|
||||||
|
|
|
@ -4,6 +4,5 @@ fr:
|
||||||
first: '«'
|
first: '«'
|
||||||
last: '»'
|
last: '»'
|
||||||
previous: '‹'
|
previous: '‹'
|
||||||
next: '›'
|
next: Suivant
|
||||||
truncate: '...'
|
truncate: '...'
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue