class ActiveAdmin::Views::StatusTag
Build a StatusTag
def build(*args)
-
(ActiveAdmin::Views::StatusTag)
-
Parameters:
-
options
(Hash
) -- such as :class, :id and :label to override the default label -
type
(Symbol
) -- type of status. Will become a class of the span. ActiveAdmin provide style for :ok, :warning and :error. -
status
(String
) -- the status to display. One of the span classes will be an underscored version of the status.
def build(*args) options = args.extract_options! status = args[0] type = args[1] label = options.delete(:label) classes = options.delete(:class) content = label || status.titleize if status super(content, options) add_class(status_to_class(status)) if status add_class(type.to_s) if type add_class(classes) if classes end
def default_class_name
def default_class_name 'status' end
def status_to_class(status)
def status_to_class(status) status.titleize.gsub(/\s/, '').underscore end
def tag_name
def tag_name 'span' end