Sha256: bf552fffb2b949a6ccb44f842582f82cd37f520f2c65ee275e958bd724f644c6

Contents?: true

Size: 941 Bytes

Versions: 16

Compression:

Stored size: 941 Bytes

Contents

module JqueryUiForm 
  module Helpers
    module LabelHelper
      # include ActionView::Helpers::FormHelper
      
      def label(method, text = nil, options = {})
        
        text, options = label_text(method, text, options)
        super(method,"#{text}:".html_safe, options)
        
      end
      
      def label_text(method, text, options={})
        if text.is_a?(Hash)
          options.merge!(text)
          text = nil
        end
        text = options.delete(:label) if text.blank?
        if text.blank?
          if use_i18n
            text = I18n.t("#{@object_name.to_s.downcase}.#{method.to_s.downcase}",:scope => [:activerecord, :attributes])
          else
            text = method.to_s.humanize
          end
        end
        if options.delete(:required)
          text << (required_string.is_a?(Proc) ? required_string.call : required_string)
        end
        [text, options]
      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/label_helper.rb
jquery-ui-form-0.2.7 lib/jquery_ui_form/helpers/label_helper.rb
jquery-ui-form-0.2.6 lib/jquery_ui_form/helpers/label_helper.rb
jquery-ui-form-0.2.5 lib/jquery_ui_form/helpers/label_helper.rb
jquery-ui-form-0.2.4 lib/jquery_ui_form/helpers/label_helper.rb
jquery-ui-form-0.2.3 lib/jquery_ui_form/helpers/label_helper.rb
jquery-ui-form-0.2.2 lib/jquery_ui_form/helpers/label_helper.rb
jquery-ui-form-0.2.1 lib/jquery_ui_form/helpers/label_helper.rb
jquery-ui-form-0.2.0 lib/jquery_ui_form/helpers/label_helper.rb
jquery-ui-form-0.1.6 lib/jquery_ui_form/helpers/label_helper.rb
jquery-ui-form-0.1.5 lib/jquery_ui_form/helpers/label_helper.rb
jquery-ui-form-0.1.4 lib/jquery_ui_form/helpers/label_helper.rb
jquery-ui-form-0.1.3 lib/jquery_ui_form/helpers/label_helper.rb
jquery-ui-form-0.1.2 lib/jquery_ui_form/helpers/label_helper.rb
jquery-ui-form-0.1.1 lib/jquery_ui_form/helpers/label_helper.rb
jquery-ui-form-0.1.0 lib/jquery_ui_form/helpers/label_helper.rb