Class: ActiveAdminAddons::StateBuilder

Inherits:
CustomBuilder show all
Defined in:
lib/activeadmin_addons/addons/state_builder.rb

Constant Summary collapse

DEFAULT_CLASS_BINDINGS =
{
  accepted: "ok",
  confirmed: "ok",
  ready: "ok",
  rejected: "error",
  canceled: "error"
}

Instance Attribute Summary

Attributes inherited from CustomBuilder

#args, #block, #context, #model

Instance Method Summary collapse

Methods inherited from CustomBuilder

builder_method_name, create_view_methods, #initialize

Constructor Details

This class inherits a constructor from ActiveAdminAddons::CustomBuilder

Instance Method Details

#renderObject



11
12
13
14
15
# File 'lib/activeadmin_addons/addons/state_builder.rb', line 11

def render
  raise "you need to install AASM gem first" unless defined? AASM
  raise "the #{attribute} is not an AASM state" unless state_attribute?
  context.status_tag(model.aasm(machine_name).human_state, class: status_class_for_model)
end