Sha256: ee8ff059322f11a409cc14d8dc0e8c22ed8c3ec1bcabde52104361a76239c63d

Contents?: true

Size: 863 Bytes

Versions: 13

Compression:

Stored size: 863 Bytes

Contents

module Formtastic
  # @private
  module HtmlAttributes
    # Returns a namespace passed by option or inherited from parent builders / class configuration
    def dom_id_namespace
      namespace = options[:custom_namespace]
      parent = options[:parent_builder]

      case
        when namespace then namespace
        when parent && parent != self then parent.dom_id_namespace
        else custom_namespace
      end
    end

    protected

    def humanized_attribute_name(method)
      if @object && @object.class.respond_to?(:human_attribute_name)
        humanized_name = @object.class.human_attribute_name(method.to_s)
        if humanized_name == method.to_s.send(:humanize)
          method.to_s.send(label_str_method)
        else
          humanized_name
        end
      else
        method.to_s.send(label_str_method)
      end
    end

  end
end

Version data entries

13 entries across 13 versions & 3 rubygems

Version Path
date_n_time_picker_activeadmin-0.1.2 vendor/bundle/ruby/2.6.0/gems/formtastic-4.0.0/lib/formtastic/html_attributes.rb
date_n_time_picker_activeadmin-0.1.1 vendor/bundle/ruby/2.6.0/gems/formtastic-4.0.0/lib/formtastic/html_attributes.rb
formtastic-4.0.0 lib/formtastic/html_attributes.rb
formtastic-4.0.0.rc1 lib/formtastic/html_attributes.rb
formtastic-3.1.5 lib/formtastic/html_attributes.rb
ish_lib_manager-0.0.1 test/dummy/vendor/bundle/ruby/2.3.0/gems/formtastic-3.1.4/lib/formtastic/html_attributes.rb
formtastic-3.1.4 lib/formtastic/html_attributes.rb
formtastic-3.1.3 lib/formtastic/html_attributes.rb
formtastic-3.1.2 lib/formtastic/html_attributes.rb
formtastic-3.1.1 lib/formtastic/html_attributes.rb
formtastic-3.1.0 lib/formtastic/html_attributes.rb
formtastic-3.1.0.rc2 lib/formtastic/html_attributes.rb
formtastic-3.1.0.rc1 lib/formtastic/html_attributes.rb