Pagination fix
This commit is contained in:
@@ -1,5 +1,11 @@
|
||||
jQuery ->
|
||||
|
||||
$ ->
|
||||
if $('#infinite-scrolling').size() > 0
|
||||
more_posts_url = $('.pagination .next_page a').attr('href')
|
||||
b=$(document).height() - $(window).height() - 60
|
||||
if more_posts_url && $(window).scrollTop() > b
|
||||
$('.pagination').html('<b> Loading...</b>')
|
||||
$.getScript more_posts_url
|
||||
$(window).on 'scroll', ->
|
||||
more_posts_url = $('.pagination .next_page a').attr('href')
|
||||
b=$(document).height() - $(window).height() - 60
|
||||
|
||||
@@ -7,7 +7,7 @@ class RubrikenController < ApplicationController
|
||||
@neuigkeiten = Neuigkeit.paginate(page: params[:page], per_page:3)
|
||||
else
|
||||
@rubriken = Rubrik.where(:public=>true)
|
||||
@neuigkeiten = Neuigkeit.public.recent
|
||||
@neuigkeiten = Neuigkeit.public.published.paginate(page: params[:page], per_page:3)
|
||||
end
|
||||
|
||||
@calentries= @rubriken.collect(&:calentries).flatten
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<% if defined?(wrap_in) && !wrap_in.blank? %>
|
||||
<%= content_tag wrap_in do %>
|
||||
www
|
||||
|
||||
<% c =[:linkbox] %>
|
||||
<% c << "color-"+neuigkeit.rubrik.color.to_s+"-dark" unless neuigkeit.rubrik.color.nil? %>
|
||||
<%= link_to [neuigkeit.rubrik,neuigkeit], {class: c} do %>
|
||||
|
||||
@@ -22,9 +22,8 @@
|
||||
<ul class="unstyled linkbox-list" style="max-width:70em" id="neuigkeiten">
|
||||
<% @neuigkeiten.each do |neuigkeit| %>
|
||||
|
||||
<li>
|
||||
<%= render neuigkeit %>
|
||||
</li>
|
||||
|
||||
<%= render neuigkeit, wrap_in: "li" %>
|
||||
<% end %>
|
||||
</ul>
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
$('#neuigkeiten').append('<%= j render @neuigkeiten, :locals => { :wrap_in => :li} %>');
|
||||
$('#neuigkeiten').append('<%= j render @neuigkeiten, :wrap_in => :li %>');
|
||||
<% if @neuigkeiten.next_page %>
|
||||
$('.pagination').replaceWith('<%= j will_paginate @neuigkeiten %>');
|
||||
<% else %>
|
||||
|
||||
Reference in New Issue
Block a user