Files

Class Index [+]

Quicksearch

Ubiquo::Filters

Public Instance Methods

build_filter_info(*info_and_fields) click to toggle source

Return the pretty filter info string

info_and_fields: array of [info_string, fields_for_that_filter]

     # File vendor/plugins/ubiquo_core/lib/ubiquo/filters.rb, line 149
149:     def build_filter_info(*info_and_fields)
150:       deprecation_message
151:       model = self.controller_name.classify
152:       fs = FilterSetBuilder.new(model, self)
153:       fs.build_filter_info(info_and_fields)
154:     end
filter_info(filter_name, params, options = {}) click to toggle source

Return the informative string about a filter process

filter_name (symbol). Currently implemented: :date_filter, :string_filter, :select_filter params: current ‘params’ controller object (hash) options_for_filter: specific options needed to build the filter string (hash)

Return array [info_string, fields_used_by_this_filter]

     # File vendor/plugins/ubiquo_core/lib/ubiquo/filters.rb, line 140
140:     def filter_info(filter_name, params, options = {})
141:       deprecation_message
142:       filter = select_filter(filter_name, options)
143:       filter.message
144:     end
filters_for(model) {|filter_set| ...} click to toggle source

Defines a filter set. For example:

 # app/helpers/ubiquo/articles_helper.rb
 module Ubiquo::ArticlesHelper
   def article_filters
      filters_for 'Article' do |f|
        f.text
        f.locale
        f.date
        f.select :name, @collection
        f.boolean :status
      end
   end
 end
     # File vendor/plugins/ubiquo_core/lib/ubiquo/filters.rb, line 98
 98:     def filters_for(model,&block)
 99:       raise ArgumentError, "Missing block" unless block
100:       filter_set = FilterSetBuilder.new(model, self)
101:       yield filter_set
102:       @filter_set = filter_set
103:     end
render_filter(filter_name, url_for_options, options = {}) click to toggle source

Render a lateral filter

filter_name (symbol): currently implemented: :date_filter, :string_filter, :select_filter url_for_options: route used by the form (string or hash) options_for_filter: options for a filter (see each *_filter_info helpers for details)

     # File vendor/plugins/ubiquo_core/lib/ubiquo/filters.rb, line 125
125:     def render_filter(filter_name, url_for_options, options = {})
126:       deprecation_message
127:       options[:url_for_options] = url_for_options
128:       filter_name = :boolean if options[:boolean]
129:       filter = select_filter(filter_name, options)
130:       filter.render
131:     end
show_filter_info() click to toggle source

Render a filter set human message

     # File vendor/plugins/ubiquo_core/lib/ubiquo/filters.rb, line 112
112:     def show_filter_info
113:       initialize_filter_set_if_needed
114:       @filter_set.message
115:     end
show_filters() click to toggle source

Render a filter set

     # File vendor/plugins/ubiquo_core/lib/ubiquo/filters.rb, line 106
106:     def show_filters
107:       initialize_filter_set_if_needed
108:       @filter_set.render
109:     end

Disabled; run with $DEBUG to generate this.

[Validate]

Generated with the Darkfish Rdoc Generator 1.1.6.