Class: Avo::EmptyStateComponent
- Inherits:
-
ViewComponent::Base
- Object
- ViewComponent::Base
- Avo::EmptyStateComponent
- Defined in:
- app/components/avo/empty_state_component.rb
Instance Method Summary collapse
-
#initialize(message: nil, resource_name: nil, related_name: nil, view_type: :table, add_background: false) ⇒ EmptyStateComponent
constructor
A new instance of EmptyStateComponent.
- #message ⇒ Object
- #view_type_svg ⇒ Object
Constructor Details
#initialize(message: nil, resource_name: nil, related_name: nil, view_type: :table, add_background: false) ⇒ EmptyStateComponent
Returns a new instance of EmptyStateComponent.
4 5 6 7 8 9 10 |
# File 'app/components/avo/empty_state_component.rb', line 4 def initialize(message: nil, resource_name: nil, related_name: nil, view_type: :table, add_background: false) @message = @view_type = view_type @related_name = @resource_name = resource_name @add_background = add_background end |
Instance Method Details
#message ⇒ Object
12 13 14 15 16 17 |
# File 'app/components/avo/empty_state_component.rb', line 12 def return @message if @message.present? translation_tag = @related_name.present? ? 'avo.no_related_item_found' : 'avo.no_item_found' helpers.t translation_tag, item: @resource_name end |
#view_type_svg ⇒ Object
19 20 21 22 23 |
# File 'app/components/avo/empty_state_component.rb', line 19 def view_type_svg return "grid-empty-state" if @view_type.to_sym == :grid "table-empty-state" end |