From 649839567da1ddebf4651423721be519d8e6b40f Mon Sep 17 00:00:00 2001 From: maxwell Date: Thu, 16 Sep 2010 11:47:34 -0700 Subject: [PATCH] MS added pagination to the search page --- app/controllers/albums_controller.rb | 3 ++- app/controllers/people_controller.rb | 4 +++- app/views/people/index.html.haml | 1 + public/stylesheets/sessions.css | 3 +++ 4 files changed, 9 insertions(+), 2 deletions(-) diff --git a/app/controllers/albums_controller.rb b/app/controllers/albums_controller.rb index f4d797a46..5a75616d1 100644 --- a/app/controllers/albums_controller.rb +++ b/app/controllers/albums_controller.rb @@ -9,7 +9,8 @@ class AlbumsController < ApplicationController respond_to :json, :only => [:index, :show] def index - @albums = current_user.albums_by_aspect(@aspect).paginate + @albums = current_user.albums_by_aspect(@aspect).paginate :page => params[:page], :per_page => 9, :order => 'created_at DESC' + @aspect = :all respond_with @albums, :aspect => @aspect end diff --git a/app/controllers/people_controller.rb b/app/controllers/people_controller.rb index 78b0803c0..d85c67691 100644 --- a/app/controllers/people_controller.rb +++ b/app/controllers/people_controller.rb @@ -11,7 +11,9 @@ class PeopleController < ApplicationController def index @aspects_dropdown_array = current_user.aspects.collect{|x| [x.to_s, x.id]} - @people = Person.search params[:q] + @aspect = :all + @people = Person.search(params[:q]).paginate :page => params[:page], :per_page => 25, :order => 'created_at DESC' + respond_with @people end diff --git a/app/views/people/index.html.haml b/app/views/people/index.html.haml index 57bd5b560..c18ec5d0a 100644 --- a/app/views/people/index.html.haml +++ b/app/views/people/index.html.haml @@ -48,3 +48,4 @@ = f.select(:aspect_id, @aspects_dropdown_array) = f.hidden_field :destination_url, :value => person.diaspora_handle = f.submit "add friend" + = will_paginate @people diff --git a/public/stylesheets/sessions.css b/public/stylesheets/sessions.css index 3a59e54af..2b5199d25 100644 --- a/public/stylesheets/sessions.css +++ b/public/stylesheets/sessions.css @@ -11,8 +11,11 @@ #flash_alert { z-index: 100; top: 32px; + position: absolute; color: black; width: 400px; + margin: 0 0 0 -200px; + left: 50%; text-align: center; font-size: 14px; padding: 3px 0; }