Sha256: 89a60e383848c9896c6aeee46335ddd7a18f7cea8c2bd7142939a66d162eef2a
Contents?: true
Size: 808 Bytes
Versions: 22
Compression:
Stored size: 808 Bytes
Contents
class ActiveAdmin::Views::TableFor alias_method :original_status_tag, :status_tag def row_attributes(&block) @collection.each_with_index do |item, i| tr = @tbody.children[i] attributes = block.call(item) attributes[:class] = [tr.attributes[:class], attributes[:class]].compact.join(' ') tr.attributes.merge!(attributes) end end def status_tag_column(name, texts, states) column name do |resource| value = resource.send(name) text = value ? texts.first : texts.last state = value ? states.first : states.last if state original_status_tag text, state else text end end end def boolean_status_tag_column(name, yes_state = :warning) status_tag_column(name, ['Ja', '-'], [yes_state, nil]) end end
Version data entries
22 entries across 22 versions & 1 rubygems