Module: ActiveScaffold::Actions::AdvancedSearch

Includes:
Finder
Defined in:
lib/six-updater-web/vendor/plugins/activescaffold_advanced_search/lib/actions/advanced_search.rb

Constant Summary

Constants included from Finder

Finder::NumericComparators, Finder::StringComparators

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.included(base) ⇒ Object



7
8
9
10
# File 'lib/six-updater-web/vendor/plugins/activescaffold_advanced_search/lib/actions/advanced_search.rb', line 7

def self.included(base)
  base.before_filter :advanced_search_authorized?, :only => :show_advanced_search
  base.before_filter :do_advanced_search
end

Instance Method Details

#show_advanced_searchObject



12
13
14
15
16
17
18
19
20
21
# File 'lib/six-updater-web/vendor/plugins/activescaffold_advanced_search/lib/actions/advanced_search.rb', line 12

def show_advanced_search
  options = active_scaffold_config.advanced_search.columns.map { |c| "<option value='#{c.name}'>#{c.label}</option>" }.join
  type_map = "{" + active_scaffold_config.advanced_search.column_objects.map do |c|
    "#{c.name.to_s.inspect}: #{(c.column.text? ? "'text'" : c.column.type == :integer ? "'integer'" : "'boolean'")}"
  end.join(', ') + "}"
  respond_to do |type|
    type.html { render(:partial => "advanced_search", :layout => false, :locals => { :options => options, :type_map => type_map }) }
    type.js { render(:partial => "advanced_search", :layout => false, :locals => { :options => options, :type_map => type_map }) }
  end
end