Sha256: 8d69fafd94b8fbe09b905445297b0d52949650f4998639ad28b770fd96474b80
Contents?: true
Size: 826 Bytes
Versions: 3
Compression:
Stored size: 826 Bytes
Contents
module ActiveAdminAddons module EnumTag class << self def tag(context, model, attribute, options) state = model.send(attribute) raise 'you need to install enumerize gem first' unless defined? Enumerize::Value raise 'you need to pass an enumerize attribute' unless state.is_a?('Enumerize::Value'.constantize) context.status_tag(state.text, state) end end end module ::ActiveAdmin module Views class TableFor def tag_column(attribute, options = {}) column(attribute) { |model| EnumTag.tag(self, model, attribute, options) } end end class AttributesTable def tag_row(attribute, options = {}) row(attribute) { |model| EnumTag.tag(self, model, attribute, options) } end end end end end
Version data entries
3 entries across 3 versions & 1 rubygems