Class: ActiveAdmin::Views::StatusTag
- Defined in:
- lib/active_admin/views/components/status_tag.rb
Overview
Build a StatusTag
Instance Method Summary collapse
-
#build(*args) ⇒ ActiveAdmin::Views::StatusTag
Examples: status_tag(‘In Progress’) # => <span class=‘status in_progress’>In Progress</span>.
- #default_class_name ⇒ Object
-
#status_tag(status, type = nil, options = {}) ⇒ ActiveAdmin::Views::StatusTag
Examples: status_tag(‘In Progress’) # => <span class=‘status in_progress’>In Progress</span>.
- #tag_name ⇒ Object
Methods inherited from Component
Constructor Details
This class inherits a constructor from ActiveAdmin::Component
Instance Method Details
#build(*args) ⇒ ActiveAdmin::Views::StatusTag
Examples:
status_tag('In Progress')
# => <span class='status in_progress'>In Progress</span>
status_tag('active', :ok)
# => <span class='status active ok'>Active</span>
status_tag('active', :ok, :class => 'important', :id => 'status_123')
# => <span class='status active ok important' id='status_123'>Active</span>
33 34 35 36 37 38 39 40 41 42 43 44 45 46 |
# File 'lib/active_admin/views/components/status_tag.rb', line 33 def build(*args) = args. status = args[0] type = args[1] classes = .delete(:class) status = status.titleize if status super(status, ) add_class(status_to_class(status)) if status add_class(type.to_s) if type add_class(classes) if classes end |
#default_class_name ⇒ Object
11 12 13 |
# File 'lib/active_admin/views/components/status_tag.rb', line 11 def default_class_name 'status' end |
#status_tag(status, type = nil, options = {}) ⇒ ActiveAdmin::Views::StatusTag
Examples:
status_tag('In Progress')
# => <span class='status in_progress'>In Progress</span>
status_tag('active', :ok)
# => <span class='status active ok'>Active</span>
status_tag('active', :ok, :class => 'important', :id => 'status_123')
# => <span class='status active ok important' id='status_123'>Active</span>
33 34 35 36 37 38 39 40 41 42 43 44 45 46 |
# File 'lib/active_admin/views/components/status_tag.rb', line 33 def build(*args) = args. status = args[0] type = args[1] classes = .delete(:class) status = status.titleize if status super(status, ) add_class(status_to_class(status)) if status add_class(type.to_s) if type add_class(classes) if classes end |
#tag_name ⇒ Object
7 8 9 |
# File 'lib/active_admin/views/components/status_tag.rb', line 7 def tag_name 'span' end |