Sha256: 392b4d81fbec71b36a1417b5a2ef0123e5288a9c2f5327bcf3d9035fc026a98b

Contents?: true

Size: 666 Bytes

Versions: 33

Compression:

Stored size: 666 Bytes

Contents

module HoboTypeHelper
  extend HoboHelperBase
  protected
    def type_id(type=nil)
      type ||= (this.is_a?(Class) && this) || this_type || this.class
      HoboFields.to_name(type) || type.name.to_s.underscore.gsub("/", "__")
    end


    def type_and_field(*args)
      type, field = args.empty? ? [this_parent.class, this_field] : args
      "#{type.typed_id}_#{field}" if type.respond_to?(:typed_id)
    end


    def model_id_class(object=this, attribute=nil)
      object.respond_to?(:typed_id) ? "model::#{typed_id(object, attribute).to_s.dasherize}" : ""
    end


    def css_data(name, *args)
      "#{name.to_s.dasherize}::#{args * '::'}"
    end
end

Version data entries

33 entries across 33 versions & 1 rubygems

Version Path
hobo-2.2.6 app/helpers/hobo_type_helper.rb
hobo-2.2.5 app/helpers/hobo_type_helper.rb
hobo-2.2.4 app/helpers/hobo_type_helper.rb
hobo-2.2.3 app/helpers/hobo_type_helper.rb
hobo-2.2.2 app/helpers/hobo_type_helper.rb
hobo-2.2.1 app/helpers/hobo_type_helper.rb
hobo-2.2.0 app/helpers/hobo_type_helper.rb
hobo-2.1.2 app/helpers/hobo_type_helper.rb
hobo-2.1.1 app/helpers/hobo_type_helper.rb
hobo-2.1.0 app/helpers/hobo_type_helper.rb
hobo-2.1.0.pre4 app/helpers/hobo_type_helper.rb
hobo-2.1.0.pre3 app/helpers/hobo_type_helper.rb
hobo-2.1.0.pre2 app/helpers/hobo_type_helper.rb
hobo-2.1.0.pre1 app/helpers/hobo_type_helper.rb
hobo-2.0.1 app/helpers/hobo_type_helper.rb
hobo-2.0.0 app/helpers/hobo_type_helper.rb
hobo-2.0.0.pre10 app/helpers/hobo_type_helper.rb
hobo-2.0.0.pre9 app/helpers/hobo_type_helper.rb
hobo-2.0.0.pre8 app/helpers/hobo_type_helper.rb
hobo-2.0.0.pre7 app/helpers/hobo_type_helper.rb