Sha256: a5ddaf0f6b7486cd0543b26c84b16c87dce31d7f5ff3c7e9791fb8d091852476
Contents?: true
Size: 1.37 KB
Versions: 15
Compression:
Stored size: 1.37 KB
Contents
module Radiant::Pagination::Controller # for inclusion into public-facing controllers def configure_pagination # unconfigured parameters remain at will_paginate defaults # will_paginate controller options are not overridden by tag attribetus WillPaginate::ViewHelpers.pagination_options[:param_name] = Radiant::Config["pagination.param_name"].to_sym unless Radiant::Config["pagination.param_name"].blank? WillPaginate::ViewHelpers.pagination_options[:per_page_param_name] = Radiant::Config["pagination.per_page_param_name"].blank? ? :per_page : Radiant::Config["pagination.per_page_param_name"].to_sym # will_paginate view options can be overridden by tag attributes [:class, :previous_label, :next_label, :inner_window, :outer_window, :separator, :container].each do |opt| WillPaginate::ViewHelpers.pagination_options[opt] = Radiant::Config["pagination.#{opt}"] unless Radiant::Config["pagination.#{opt}"].blank? end end def pagination_parameters { :page => params[WillPaginate::ViewHelpers.pagination_options[:param_name]] || 1, :per_page => params[WillPaginate::ViewHelpers.pagination_options[:per_page_param_name]] || Radiant::Config['pagination.per_page'] || 20 } end def self.included(base) base.class_eval { helper_method :pagination_parameters before_filter :configure_pagination } end end
Version data entries
15 entries across 15 versions & 1 rubygems