Sha256: 2d23aa3e384370366e0c44db6e674bc60a78b7d7c11d69e138052b1dce09ff09

Contents?: true

Size: 926 Bytes

Versions: 3

Compression:

Stored size: 926 Bytes

Contents

module MasterView
  module Directives

    # creates a select helper. quotes object and method if necessary, merges
    # html options specfied on element into any html options in attr_value
    class Select < MasterView::DirectiveBase
      def stag(dcs)
        #eat
      end

      def etag(dcs)
        args = parse_attr_value
        obj = args[0]
        method = args[1]
        choices = args[2]

        obj = quote_if(obj)
        method = quote_if(method)

        options = {}
        options[:size] = attrs_lck['size'].to_i if attrs_lck['size']
        options.merge! common_html_options(attrs_lck)
        remove_strings_from_attr_value!
        merge_hash_attr_value!(1, options)

        a = []
        a << 'select '+ obj
        a << method
        a << choices
        a << attr_value unless attr_value.strip.empty?

        self.content = ''
        erb_content(a.join(', '))
      end

    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
masterview-0.2.3 lib/masterview/directives/select.rb
masterview-0.2.4 lib/masterview/directives/select.rb
masterview-0.2.5 lib/masterview/directives/select.rb