Sha256: 27f4c3d6f22794c1a0652a6e7db661f11793bd5d8f4be5b7f8c38ad202f5c5c7
Contents?: true
Size: 1.38 KB
Versions: 3
Compression:
Stored size: 1.38 KB
Contents
module MasterView module Directives # creates a collection_select helper. quotes object and method if necessary, merges # html options specfied on element into any html options in attr_value # attr_value syntax: # object, method, collection, value_method, text_method, options = {}, html_options = {} class Collection_select < MasterView::DirectiveBase def stag(dcs) #eat end def etag(dcs) args = parse_attr_value obj = quote_if(args[0]) method = quote_if(args[1]) collection = quote_if(args[2]) value_method = quote_if(args[3]) text_method = quote_if(args[4]) options = args[5] html_options = args[6] opt = {} opt[:size] = attrs_lck['size'].to_i if attrs_lck['size'] opt.merge! common_html_options(attrs_lck) html_options = merge_into_embedded_hash(html_options, 0, opt) options = '{}' if options.to_s.empty? && !html_options.to_s.empty? # if we have html_options but no options, still need empty hash a = [] a << 'collection_select '+ obj a << method a << collection a << value_method a << text_method a << options unless options.to_s.strip.empty? a << html_options unless html_options.to_s.strip.empty? self.content = '' erb_content(a.join(', ')) end end end end
Version data entries
3 entries across 3 versions & 1 rubygems