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

View File

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

View File

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

View File

@ -22,8 +22,7 @@ $(document).on 'turbolinks:load', ->
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()
$('.pagination .next a:visible').filter =>
this.visible()
.hide().click() # "Next" link is hidden while pagination is done

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