Sha256: 3131f78af77b30c1c315fcd471f882a468ec227842733c7bd8659719033d75e0

Contents?: true

Size: 1.15 KB

Versions: 16

Compression:

Stored size: 1.15 KB

Contents

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

Version data entries

16 entries across 16 versions & 1 rubygems

Version Path
jquery-ui-form-0.2.8 lib/jquery_ui_form/helpers/wrapper_helper.rb
jquery-ui-form-0.2.7 lib/jquery_ui_form/helpers/wrapper_helper.rb
jquery-ui-form-0.2.6 lib/jquery_ui_form/helpers/wrapper_helper.rb
jquery-ui-form-0.2.5 lib/jquery_ui_form/helpers/wrapper_helper.rb
jquery-ui-form-0.2.4 lib/jquery_ui_form/helpers/wrapper_helper.rb
jquery-ui-form-0.2.3 lib/jquery_ui_form/helpers/wrapper_helper.rb
jquery-ui-form-0.2.2 lib/jquery_ui_form/helpers/wrapper_helper.rb
jquery-ui-form-0.2.1 lib/jquery_ui_form/helpers/wrapper_helper.rb
jquery-ui-form-0.2.0 lib/jquery_ui_form/helpers/wrapper_helper.rb
jquery-ui-form-0.1.6 lib/jquery_ui_form/helpers/wrapper_helper.rb
jquery-ui-form-0.1.5 lib/jquery_ui_form/helpers/wrapper_helper.rb
jquery-ui-form-0.1.4 lib/jquery_ui_form/helpers/wrapper_helper.rb
jquery-ui-form-0.1.3 lib/jquery_ui_form/helpers/wrapper_helper.rb
jquery-ui-form-0.1.2 lib/jquery_ui_form/helpers/wrapper_helper.rb
jquery-ui-form-0.1.1 lib/jquery_ui_form/helpers/wrapper_helper.rb
jquery-ui-form-0.1.0 lib/jquery_ui_form/helpers/wrapper_helper.rb