Class: ActiveAdmin::Views::AttributesTable

Inherits:
Object
  • Object
show all
Defined in:
lib/active_admin/patches/views/attributes_table.rb

Instance Method Summary collapse

Instance Method Details

#boolean_status_tag_row(name, yes_state = :warning) ⇒ Object


17
18
19
# File 'lib/active_admin/patches/views/attributes_table.rb', line 17

def boolean_status_tag_row(name, yes_state = :warning)
  status_tag_row(name, ['Ja', '-'], [yes_state, nil])
end

#status_tag_row(name, texts, states) ⇒ Object


2
3
4
5
6
7
8
9
10
11
12
13
14
15
# File 'lib/active_admin/patches/views/attributes_table.rb', line 2

def status_tag_row(name, texts, states)
  value = @record.send(name)

  row name, :class => [name.to_s.gsub(/\?$/, ''), value ? 'yes' : 'no'] * ' ' do
    text = value ? texts.first : texts.last
    state = value ? states.first : states.last

    if state
      status_tag text, state
    else
      text
    end
  end
end