Skip to content
This repository has been archived by the owner on Apr 21, 2020. It is now read-only.

Commit

Permalink
実は will_paginate を使っていた
Browse files Browse the repository at this point in the history
  • Loading branch information
hsbt committed May 12, 2011
1 parent 9ee56ac commit 7fe4f26
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 9 deletions.
5 changes: 2 additions & 3 deletions .rspec
@@ -1,3 +1,2 @@
--colour
--format progress
--drb
--color
--format Fuubar
2 changes: 1 addition & 1 deletion app/controllers/articles_controller.rb
Expand Up @@ -2,7 +2,7 @@ class ArticlesController < ApplicationController
before_filter :login_required, :except => [:show, :index, :feed]

def index
@articles = Article.publishing.newer_first
@articles = Article.publishing.newer_first.page(params[:page])
end

def show
Expand Down
2 changes: 1 addition & 1 deletion app/controllers/welcome_controller.rb
@@ -1,6 +1,6 @@
class WelcomeController < ApplicationController
def index
@articles = Article.publishing.newer_first.all(:limit => 5)
@entries = KarekiEntry.confirmed.newer_first.paginate(:page => params[:page], :per_page => 10)
@entries = KarekiEntry.confirmed.newer_first.page(params[:page])
end
end
2 changes: 2 additions & 0 deletions app/models/kareki_entry.rb
Expand Up @@ -7,6 +7,8 @@ class KarekiEntry < ActiveRecord::Base
:author => :creator
}.freeze

paginates_per 10

belongs_to :feed, :foreign_key => :feed_id, :class_name => KarekiFeed.to_s

scope :confirmed, :conditions => {:confirmation => "confirmed"}
Expand Down
3 changes: 2 additions & 1 deletion app/views/welcome/index.html.haml
Expand Up @@ -48,4 +48,5 @@
%span.source!= link_to h(entry.feed.title), entry.feed.link
.body!~ replace_img_to_anchor entry.content

!= will_paginate @entries
.pager
= paginate(@entries)
9 changes: 6 additions & 3 deletions public/stylesheets/application.css
Expand Up @@ -436,12 +436,15 @@ table {
table td {
background: #eeeeee; }

.admin_assistant {
font-size: small; }

dl dt {
border-color: #eeeeff;
border-style: solid;
border-width: 0px 0px 1px; }
dl dd {
margin: 0 0 0 2em; }

.admin_assistant {
font-size: small; }

.pager {
text-align: center; }

0 comments on commit 7fe4f26

Please sign in to comment.