Class: ActiveAdmin::Views::IndexAsTable

Inherits:
Component
  • Object
show all
Defined in:
lib/active_admin_simple_life/extensions.rb

Instance Method Summary collapse

Instance Method Details

#fetch_path(field) ⇒ Object



33
34
35
# File 'lib/active_admin_simple_life/extensions.rb', line 33

def fetch_path(field)
  "edit_admin_#{field.class.to_s.underscore}_path"
end

#gendersObject



23
24
25
26
# File 'lib/active_admin_simple_life/extensions.rb', line 23

def genders
  [[I18n.t("active_admin.genders.male"), true],
   [I18n.t("active_admin.genders.female"), false]]
end

#span_falseObject



19
20
21
# File 'lib/active_admin_simple_life/extensions.rb', line 19

def span_false
  Arbre::Context.new { span(class: "status_tag no") { I18n.t "boolean.not_active" } }
end

#span_trueObject



15
16
17
# File 'lib/active_admin_simple_life/extensions.rb', line 15

def span_true
  Arbre::Context.new { span(class: "status_tag yes") { I18n.t("boolean.active") } }
end

#truncate_field(field, max_length = 50) ⇒ Object



28
29
30
31
# File 'lib/active_admin_simple_life/extensions.rb', line 28

def truncate_field(field, max_length = 50)
  length = max_length || 50
  truncate(field.to_s, length: length)
end