Module: Admin::Resources::DataTypes::StringHelper

Defined in:
app/helpers/admin/resources/data_types/string_helper.rb

Instance Method Summary collapse

Instance Method Details

#display_string(item, attribute) ⇒ Object Also known as: display_decimal, display_float, display_integer, display_position, display_text, display_virtual



3
4
5
# File 'app/helpers/admin/resources/data_types/string_helper.rb', line 3

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

#string_filter(filter) ⇒ Object



14
15
16
17
18
19
20
# File 'app/helpers/admin/resources/data_types/string_helper.rb', line 14

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

#table_string_field(attribute, item) ⇒ Object Also known as: table_decimal_field, table_float_field, table_integer_field, table_virtual_field, table_password_field



22
23
24
# File 'app/helpers/admin/resources/data_types/string_helper.rb', line 22

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