From 37199bae1dcbfca16886d8cb00388d7891936312 Mon Sep 17 00:00:00 2001 From: Benjamin Meichsner Date: Mon, 23 Mar 2009 11:31:36 +0100 Subject: [PATCH] Implemented pagination for messages overview. --- app/controllers/messages_controller.rb | 2 +- app/views/messages/index.html.haml | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/app/controllers/messages_controller.rb b/app/controllers/messages_controller.rb index d47a6db5..8e5f38e1 100644 --- a/app/controllers/messages_controller.rb +++ b/app/controllers/messages_controller.rb @@ -2,7 +2,7 @@ class MessagesController < ApplicationController # Renders the "inbox" action. def index - @messages = Message.public.all :order => 'created_at DESC', :limit => 100 + @messages = Message.public.paginate :page => params[:page], :per_page => 20, :order => 'created_at DESC' end # Creates a new message object. diff --git a/app/views/messages/index.html.haml b/app/views/messages/index.html.haml index ec19c729..3ce8fa1e 100644 --- a/app/views/messages/index.html.haml +++ b/app/views/messages/index.html.haml @@ -2,5 +2,7 @@ %p= link_to('Neue Nachricht', :action => 'new') +%div{:style => "text-align:right"}= will_paginate @messages + #messages = render :partial => 'messages', :locals => { :subject_length => 130 } \ No newline at end of file