Module: SmartListing::Helper::ControllerExtensions

Defined in:
app/helpers/smart_listing/helper.rb

Instance Method Summary collapse

Instance Method Details

#_prefixesObject



29
30
31
# File 'app/helpers/smart_listing/helper.rb', line 29

def _prefixes
  super << 'smart_listing'
end

#smart_listing(name) ⇒ Object



25
26
27
# File 'app/helpers/smart_listing/helper.rb', line 25

def smart_listing name
  @smart_listings[name.to_sym]
end

#smart_listing_create(*args) ⇒ Object

Creates new smart listing

Possible calls: smart_listing_create name, collection, options = {} smart_listing_create options = {}



9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'app/helpers/smart_listing/helper.rb', line 9

def smart_listing_create *args
  options = args.extract_options!
  name = (args[0] || options[:name] || controller_name).to_sym
  collection = args[1] || options[:collection] || smart_listing_collection

  options = {:config_profile => view_context.smart_listing_config_profile}.merge(options)

  list = SmartListing::Base.new(name, collection, options)
  list.setup(params, cookies)

  @smart_listings ||= {}
  @smart_listings[name] = list

  list.collection
end