Sha256: 274ec8d512541c8d28f69422ef39424fe3178a424254faea12e27917eb5bcf25
Contents?: true
Size: 1.35 KB
Versions: 1
Compression:
Stored size: 1.35 KB
Contents
module Kajam::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] = Kajam::Config["pagination.param_name"].to_sym unless Kajam::Config["pagination.param_name"].blank? WillPaginate::ViewHelpers.pagination_options[:per_page_param_name] = Kajam::Config["pagination.per_page_param_name"].blank? ? :per_page : Kajam::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] = Kajam::Config["pagination.#{opt}"] unless Kajam::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]] || Kajam::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
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
kajam-1.0.3.rc2 | lib/kajam/pagination/controller.rb |