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