Module: SimpleSearchFilter::Controller
- Extended by:
- ActiveSupport::Concern
- Included in:
- ActionController::Base
- Defined in:
- lib/simple_search_filter/controller.rb
Defined Under Namespace
Modules: ClassMethods
Instance Method Summary collapse
Instance Method Details
#init_search_data(name) ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 |
# File 'lib/simple_search_filter/controller.rb', line 11 def init_search_data(name) # input pg = params[@filter.page_param_name].to_i || 1 cmd = params[:cmd] || '' # page @filter.page = pg # input from GET @filter.fields.each do |name, f| if params.has_key? name @filter.set name, params[name] end end # post - save filter and redirect #if request.post? && params[:filter] if params[:filter] if cmd=='clear' @filter.clear_data else @filter.set_data_from_form params[:filter] end #(redirect_to url and return) if @filter.search_method_post_and_redirect? end if cmd=='order' @filter.set_order params[:orderby], params[:orderdir] (redirect_to action: name.to_sym and return) if @filter.search_method_post_and_redirect? end end |