diff options
author | re4k <re4k@re4k.info> | 2013-04-03 16:57:33 +0900 |
---|---|---|
committer | re4k <re4k@re4k.info> | 2013-04-03 16:57:33 +0900 |
commit | 1b49426b0c935a44262384acb526e5fbb86598c7 (patch) | |
tree | fe38323a2ffb7c7a4d381df37291dfa71d66e78d | |
parent | 532f0445a5812259a547cda32ac78ebd79d2bc77 (diff) | |
download | aclog-1b49426b0c935a44262384acb526e5fbb86598c7.tar.gz |
fix pager
-rw-r--r-- | app/assets/javascripts/tweets.js | 2 | ||||
-rw-r--r-- | app/controllers/application_controller.rb | 4 | ||||
-rw-r--r-- | app/views/shared/tweets.html.haml | 2 |
3 files changed, 4 insertions, 4 deletions
diff --git a/app/assets/javascripts/tweets.js b/app/assets/javascripts/tweets.js index 24ce366..55972bf 100644 --- a/app/assets/javascripts/tweets.js +++ b/app/assets/javascripts/tweets.js @@ -10,7 +10,7 @@ $(function() { $(".loading").hide(); } }); - $("a[rel=next]").click(function() { + $("a[rel=next]").hide().click(function() { $.autopager("load"); return false; }); diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index 1379b19..25c9e2b 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -33,11 +33,11 @@ class ApplicationController < ActionController::Base @items = a || blk.call if max_id - @items = @items.where("id <= ?", max_id) + @items = @items.where("tweets.id <= ?", max_id) end if since_id - @items = @items.where("id > ?", since_id) + @items = @items.where("tweets.id > ?", since_id) end @items = @items.page(page || 1).per(count) diff --git a/app/views/shared/tweets.html.haml b/app/views/shared/tweets.html.haml index 4437cab..bce37c4 100644 --- a/app/views/shared/tweets.html.haml +++ b/app/views/shared/tweets.html.haml @@ -7,5 +7,5 @@ - if @items - if params[:page] = link_to_next_page @items, raw("Next ›") - - else + - elsif @items.last = link_to raw("Next ›"), params.merge(:max_id => @items.last.id - 1), :rel => :next |