Module: SmartListing::Helper::ControllerExtensions
- Defined in:
- app/helpers/smart_listing/helper.rb
Instance Method Summary collapse
- #_prefixes ⇒ Object
- #smart_listing(name) ⇒ Object
-
#smart_listing_create(*args) ⇒ Object
Creates new smart listing.
Instance Method Details
#_prefixes ⇒ Object
30 31 32 |
# File 'app/helpers/smart_listing/helper.rb', line 30 def _prefixes super << 'smart_listing' end |
#smart_listing(name) ⇒ Object
26 27 28 |
# File 'app/helpers/smart_listing/helper.rb', line 26 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 24 |
# File 'app/helpers/smart_listing/helper.rb', line 9 def smart_listing_create *args = args. name = (args[0] || [:name] || controller_name).to_sym collection = args[1] || [:collection] || smart_listing_collection view_context = self.respond_to?(:controller) ? controller.view_context : self.view_context = {:config_profile => view_context.smart_listing_config_profile}.merge() list = SmartListing::Base.new(name, collection, ) list.setup(params, ) @smart_listings ||= {} @smart_listings[name] = list list.collection end |