module MasterView module Directives # creates form_tag block and ending form tag from values in form # class Form < MasterView::DirectiveBase metadata :priority => :default, :category => 'form', :description => 'Replaces the start and end tags of the element using the Rails form_tag helper and an ending form tag', :element_usage => 'form' attr_arg :url_for_options attr_arg :options, :append_element_attrs => [:common_html, :method] do |value, args, dir| value = dir.merge_hash_into_str({:multipart => true}, value) if dir.element_attrs[:enctype] =~ /multipart\/form-data/i #add multipart => true ? value end attr_arg :parameters_for_url, :varargs => true event :stag do merge_hash_into_str( {:multipart => true}, @options ) if element_attrs.get_lowercase_str_value('enctype') == 'multipart/form-data' render erb_content( 'form_tag', :url_for_options, :options, :parameters_for_url ) end event :etag do render '' end end end end =begin module MasterView module Directives # once rails 1.2 is released we can use the form_tag block method of the helper but this does not work prior to rails 1.2 # creates form_tag block from values in form # class Form < MasterView::DirectiveBase metadata :priority => :default, :category => 'form', :description => 'Replaces the start and end tags of the element using the Rails form_tag block helper', :element_usage => 'form' attr_arg :url_for_options attr_arg :options, :append_element_attrs => [:common_html, :method] attr_arg :parameters_for_url, :varargs => true event :stag do merge_hash_into_str( {:multipart => true}, @options ) if element_attrs.get_lowercase_str_value('enctype') == 'multipart/form-data' render erb_eval( prepare_output('form_tag', :url_for_options, :options, :parameters_for_url)+' do' ) # call prepare_output directly so do won't be embedded in method call end event :etag do render erb_eval( 'end' ) end end end end =end