Sha256: e7c2fe116cc7c9741c3a55b2746007ab7b3fb8262d452f383ae25e81a6020cc2

Contents?: true

Size: 1.07 KB

Versions: 5

Compression:

Stored size: 1.07 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 CollectionSelect < MasterView::DirectiveBase

      metadata :priority => :default,
        :category => 'form',
        :description => 'Replaces the element with a Rails collection_select form helper.',
        :element_usage => 'select'

      attr_arg :object_name, :quote => true
      attr_arg :method, :quote => true
      attr_arg :collection , :quote => true
      attr_arg :value_method, :quote => true
      attr_arg :text_method, :quote => true
      attr_arg :options, :default => {}
      attr_arg :html_options, :append_element_attrs => [:common_html]

      event :element do
        render erb_content( 'collection_select', :object_name, :method, :collection, :value_method, :text_method, :options, :html_options)
      end

    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
masterview-0.3.0 lib/masterview/directives/collection_select.rb
masterview-0.3.2 lib/masterview/directives/collection_select.rb
masterview-0.3.3 lib/masterview/directives/collection_select.rb
masterview-0.3.4 lib/masterview/directives/collection_select.rb
masterview-0.3.1 lib/masterview/directives/collection_select.rb