module JqueryUiForm module Helpers module WrapperHelper def wrapper(*args, &block) html_options = args.extract_options! html_options[:class] = "#{html_options[:class]} ui-form-#{html_options.delete(:mode) || 'wrapper'}" template.content_tag(:div, html_options) do yield end end def fieldset(*args, &block) legend = "" legend = args.shift unless args.first.is_a?(Hash) html_options = args.extract_options! html_options[:class] = "#{html_options[:class]} ui-fieldset" template.content_tag(:fieldset,html_options) do template.concat(template.content_tag(:legend, legend, html_options[:html_legend])) unless legend.blank? yield end end def column(options = {}, &block) options[:mode] = "column" wrapper(options, &block) end def row(options = {}, &block) options[:mode] = "row" wrapper(options, &block) end def buttons(options = {}, &block) options[:mode] = "buttons" wrapper(options, &block) end end end end