The pagination mechanism now relies on a jquery visible gem, which checks if/when the next link is visible

This commit is contained in:
echarp 2018-07-16 22:43:36 +02:00
parent fc3498d2cb
commit 244a0a8fce
9 changed files with 94993 additions and 8 deletions

View File

@ -119,7 +119,7 @@ group :development, :test, :assets do
# Use SASS for stylesheets # Use SASS for stylesheets
gem 'sass-rails' gem 'sass-rails'
# Use jquery as the JavaScript library # Use jquery and jquery-ui as the JavaScript library
gem 'jquery-ui-rails' gem 'jquery-ui-rails'
# Turbolinks makes following links in your web application # Turbolinks makes following links in your web application
# faster. Read more: https://github.com/rails/turbolinks # faster. Read more: https://github.com/rails/turbolinks
@ -132,9 +132,9 @@ group :development, :test, :assets do
# A superb font to use as icons # A superb font to use as icons
gem 'font-awesome-sass' gem 'font-awesome-sass'
# Carte openstreetmap
source 'https://rails-assets.org' do source 'https://rails-assets.org' do
gem 'rails-assets-jquery-sparkline' gem 'rails-assets-jquery-sparkline'
gem 'rails-assets-jquery-visible'
gem 'rails-assets-leaflet' gem 'rails-assets-leaflet'
gem 'rails-assets-leaflet.markercluster' gem 'rails-assets-leaflet.markercluster'
end end

View File

@ -302,7 +302,10 @@ GEM
bundler (>= 1.3.0) bundler (>= 1.3.0)
railties (= 5.2.0) railties (= 5.2.0)
sprockets-rails (>= 2.0.0) sprockets-rails (>= 2.0.0)
rails-assets-jquery (3.3.1)
rails-assets-jquery-sparkline (2.1.3) rails-assets-jquery-sparkline (2.1.3)
rails-assets-jquery-visible (1.2.0)
rails-assets-jquery (> 1.6.0)
rails-assets-leaflet (1.3.1) rails-assets-leaflet (1.3.1)
rails-assets-leaflet.markercluster (1.3.0) rails-assets-leaflet.markercluster (1.3.0)
rails-assets-leaflet (>= 1.0.3) rails-assets-leaflet (>= 1.0.3)
@ -491,6 +494,7 @@ DEPENDENCIES
rack-livereload rack-livereload
rails (>= 5.1.4) rails (>= 5.1.4)
rails-assets-jquery-sparkline! rails-assets-jquery-sparkline!
rails-assets-jquery-visible!
rails-assets-leaflet! rails-assets-leaflet!
rails-assets-leaflet.markercluster! rails-assets-leaflet.markercluster!
rails-controller-testing rails-controller-testing

View File

@ -15,6 +15,7 @@
# For tags input # For tags input
#= require jquery-ui/widgets/autocomplete #= require jquery-ui/widgets/autocomplete
#= require jquery.tagsinput #= require jquery.tagsinput
#= require jquery-visible
#= require turbolinks #= require turbolinks
#= require tinymce-jquery #= require tinymce-jquery
#= require modernizr #= require modernizr

View File

@ -22,8 +22,7 @@ $(document).on 'turbolinks:load', ->
return $(this).parents('.pagination').remove() return $(this).parents('.pagination').remove()
# Go to the next page when page is scrolled # Go to the next page when page is scrolled
if $('.pagination .next a').size() > 0 $(document).scroll ->
$(document).scroll -> $('.pagination .next a:visible').filter =>
if $(window).scrollTop() == $(document).height() - $(window).height() && $('.pagination .next a').is(':visible') this.visible()
# "Next" link is also hidden while pagination is done .hide().click() # "Next" link is hidden while pagination is done
$('.pagination .next a').hide().click()

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long