Method: Kiss::Form#opening_html

Defined in:
lib/kiss/form.rb

#opening_htmlObject Also known as: html_open

Renders beginning of form (form open tag and form/field/error styles).



755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
# File 'lib/kiss/form.rb', line 755

def opening_html
  @_error_class ||= 'kiss_form_error_message'
  @_field_error_class ||= @_error_class
  
  # form tag
  form_attrs = ['id', 'method', 'enctype', 'class', 'style'].map do |attr|
    next if (value = send attr).blank?
    "#{attr}=\"#{send attr}\""
  end
  if @_html
    @_html.each_pair do |k, v|
      form_attrs.push("#{k}=\"#{v}\"")
    end
  end
  form_tag = %Q(<form action="#{@_action}" #{form_attrs.join(' ')}>#{form_name_hidden_tag_html})
  
  # combine
  [
    style_html,
    @_prepend_html,
    form_tag,
    '<div class="kiss_form">',
    errors_html
  ].join
end