per page helper method
git-svn-id: http://svn.barleysodas.com/barleysodas/trunk@95 0f7b21a7-9e3a-4941-bbeb-ce5c7c368fa7master
parent
0ff7cf8172
commit
f14fcf5d78
|
@ -5,7 +5,7 @@ class ApplicationController < ActionController::Base
|
|||
append_before_filter :authorized?
|
||||
append_before_filter :set_current_people_id
|
||||
|
||||
helper_method :logged_in?, :has_permission_for_action?
|
||||
helper_method :logged_in?, :has_permission_for_action?, :per_page
|
||||
|
||||
cattr_accessor :current_people_id
|
||||
|
||||
|
@ -73,6 +73,14 @@ class ApplicationController < ActionController::Base
|
|||
@page.allow_discussions = true
|
||||
end
|
||||
|
||||
##
|
||||
# This will eventually figure out what the People has configured for a per
|
||||
# page limit of objects.
|
||||
#
|
||||
def per_page
|
||||
50
|
||||
end
|
||||
|
||||
protected
|
||||
|
||||
##
|
||||
|
|
|
@ -7,7 +7,7 @@ class BeersController < ApplicationController
|
|||
def index
|
||||
@content_title = 'The Beers'
|
||||
@secondary_title = 'Browsing all beers'
|
||||
@pages, @beers = paginate :beers, :include => 'page', :per_page => 50,
|
||||
@pages, @beers = paginate :beers, :include => 'page', :per_page => per_page,
|
||||
:order => 'beers.title ASC'
|
||||
@tags = Page.tags(:limit => 25, :order => "name DESC",
|
||||
:owner_type => 'Beer')
|
||||
|
|
|
@ -8,7 +8,7 @@ class BreweriesController < ApplicationController
|
|||
@content_title = 'The Breweries'
|
||||
@secondary_title = 'Browsing all breweries'
|
||||
@pages, @breweries = paginate :breweries, :include => 'page',
|
||||
:order => 'breweries.title ASC', :per_page => 50
|
||||
:order => 'breweries.title ASC', :per_page => per_page
|
||||
|
||||
@tags = Page.tags(:limit => 25, :order => "name DESC",
|
||||
:owner_type => 'Beer')
|
||||
|
|
|
@ -8,7 +8,7 @@ class DiscussionsController < ApplicationController
|
|||
@content_title = 'Discussion Topics'
|
||||
@secondary_title = 'All discussion topics'
|
||||
@pages, @wiki_pages = paginate :pages, :order => 'title ASC',
|
||||
:conditions => [ 'allow_discussions = ?', true ], :per_page => 25,
|
||||
:conditions => [ 'allow_discussions = ?', true ], :per_page => per_page,
|
||||
:include => [ 'discussions' ]
|
||||
respond_to do |format|
|
||||
format.html # index.rhtml
|
||||
|
@ -21,7 +21,7 @@ class DiscussionsController < ApplicationController
|
|||
@page = Page.find(params[:id], :include => [ 'discussions' ])
|
||||
@secondary_title = @page.title
|
||||
@pages, @discussions = paginate :discussion, :order => 'created_at ASC',
|
||||
:conditions => [ 'page_id = ?', @page.id ], :per_page => 25
|
||||
:conditions => [ 'page_id = ?', @page.id ], :per_page => per_page
|
||||
respond_to do |format|
|
||||
format.html # show.rhtml
|
||||
format.xml { render :xml => @discussions.to_xml }
|
||||
|
|
|
@ -13,7 +13,7 @@ class PagesController < ApplicationController
|
|||
|
||||
cond_ary = [ 'owner_id IS NULL' ]
|
||||
cond_ary << "title <> 'HomePage'"
|
||||
@pages, @wiki_pages = paginate :page, :per_page => 25,
|
||||
@pages, @wiki_pages = paginate :page, :per_page => per_page,
|
||||
:order => 'title ASC', :conditions => [ cond_ary.join(' AND ') ]
|
||||
|
||||
@tags = Page.tags(:limit => 25, :order => "name ASC")
|
||||
|
|
|
@ -6,8 +6,8 @@ class PeoplesController < ApplicationController
|
|||
# GET /peoples.xml
|
||||
def index
|
||||
@secondary_title = 'Browsing all Peoples'
|
||||
@pages, @peoples = paginate :people, :per_page => 25, :order => 'title ASC',
|
||||
:singular_name => 'people'
|
||||
@pages, @peoples = paginate :people, :per_page => per_page,
|
||||
:order => 'title ASC', :singular_name => 'people'
|
||||
@tags = Page.tags(:limit => 25, :order => "name DESC",
|
||||
:owner_type => 'People')
|
||||
respond_to do |format|
|
||||
|
|
|
@ -5,7 +5,8 @@ class RolesController < ApplicationController
|
|||
# GET /roles.xml
|
||||
def index
|
||||
@secondary_title = 'Role Administration'
|
||||
@pages, @roles = paginate :roles, :order => 'name ASC', :per_page => 25
|
||||
@pages, @roles = paginate :roles, :order => 'name ASC',
|
||||
:per_page => per_page
|
||||
respond_to do |format|
|
||||
format.html # index.rhtml
|
||||
format.xml { render :xml => @roles.to_xml }
|
||||
|
|
Reference in New Issue