Sha256: 73c2e9e0a602b2cb52520af4bef90d0b1edaf8a4791094caa3a94e079475581d

Contents?: true

Size: 1.1 KB

Versions: 23

Compression:

Stored size: 1.1 KB

Contents

module Admin::Resources::DataTypes::StringHelper

  def display_string(item, attribute)
    item.send(attribute)
  end

  alias_method :display_decimal, :display_string
  alias_method :display_float, :display_string
  alias_method :display_integer, :display_string
  alias_method :display_position, :display_string
  alias_method :display_text, :display_string
  alias_method :display_virtual, :display_string

  def string_filter(filter)
    values = set_context.send(filter.to_s.pluralize).to_a

    items = [[Typus::I18n.t("Show by %{attribute}", :attribute => @resource.human_attribute_name(filter).downcase), ""]]
    array = values.first.is_a?(Array) ? values : values.map { |i| [i, i] }
    items += array
  end

  def table_string_field(attribute, item)
    (raw_content = item.send(attribute)).present? ? raw_content : mdash
  end

  alias_method :table_decimal_field, :table_string_field
  alias_method :table_float_field, :table_string_field
  alias_method :table_integer_field, :table_string_field
  alias_method :table_virtual_field, :table_string_field
  alias_method :table_password_field, :table_string_field

end

Version data entries

23 entries across 23 versions & 2 rubygems

Version Path
brainsome_typus-4.0.0.beta13 app/helpers/admin/resources/data_types/string_helper.rb
brainsome_typus-4.0.0.beta12 app/helpers/admin/resources/data_types/string_helper.rb
brainsome_typus-4.0.0.beta11 app/helpers/admin/resources/data_types/string_helper.rb
brainsome_typus-4.0.0.beta10 app/helpers/admin/resources/data_types/string_helper.rb
brainsome_typus-4.0.0.beta9 app/helpers/admin/resources/data_types/string_helper.rb
brainsome_typus-4.0.0.beta8 app/helpers/admin/resources/data_types/string_helper.rb
brainsome_typus-4.0.0.beta7 app/helpers/admin/resources/data_types/string_helper.rb
brainsome_typus-4.0.0.beta6 app/helpers/admin/resources/data_types/string_helper.rb
brainsome_typus-4.0.0.beta5 app/helpers/admin/resources/data_types/string_helper.rb
brainsome_typus-4.0.0.beta4 app/helpers/admin/resources/data_types/string_helper.rb
brainsome_typus-4.0.0.beta3 app/helpers/admin/resources/data_types/string_helper.rb
brainsome_typus-4.0.0.beta2 app/helpers/admin/resources/data_types/string_helper.rb
brainsome_typus-4.0.0.beta1 app/helpers/admin/resources/data_types/string_helper.rb
typus-3.1.10 app/helpers/admin/resources/data_types/string_helper.rb
typus-3.1.9 app/helpers/admin/resources/data_types/string_helper.rb
typus-3.1.8 app/helpers/admin/resources/data_types/string_helper.rb
typus-3.1.7 app/helpers/admin/resources/data_types/string_helper.rb
typus-3.1.6 app/helpers/admin/resources/data_types/string_helper.rb
typus-3.1.5 app/helpers/admin/resources/data_types/string_helper.rb
typus-3.1.4 app/helpers/admin/resources/data_types/string_helper.rb