Class: EasyAdmin::Dashboards::BaseCardComponent
- Inherits:
-
BaseComponent
- Object
- Phlex::HTML
- BaseComponent
- EasyAdmin::Dashboards::BaseCardComponent
- Defined in:
- app/components/easy_admin/dashboards/base_card_component.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#card ⇒ Object
readonly
Returns the value of attribute card.
-
#dashboard_class ⇒ Object
readonly
Returns the value of attribute dashboard_class.
-
#data ⇒ Object
readonly
Returns the value of attribute data.
-
#request_params ⇒ Object
readonly
Returns the value of attribute request_params.
Instance Method Summary collapse
-
#initialize(card:, dashboard_class:, data: nil, request_params: nil) ⇒ BaseCardComponent
constructor
A new instance of BaseCardComponent.
- #view_template ⇒ Object
Methods inherited from BaseComponent
#easy_admin_url_helpers, #helpers, #rails_url_helpers
Methods included from Permissions::Component
#current_user_can?, #current_user_has_role?, #if_can, #if_has_role, #permission_attrs, #permission_button, #permission_case, #permission_classes, #permission_field, #permission_link, #unless_can, #unless_has_role
Methods included from FieldsHelper
#field_component, #render_field
Methods included from EasyAdmin::DashboardsHelper
#delta_badge_classes, #metric_value_classes, #render_card, #sparkline_color, #sparkline_points, #trend_direction, #trend_icon, #trend_indicator_classes
Constructor Details
#initialize(card:, dashboard_class:, data: nil, request_params: nil) ⇒ BaseCardComponent
Returns a new instance of BaseCardComponent.
6 7 8 9 10 11 |
# File 'app/components/easy_admin/dashboards/base_card_component.rb', line 6 def initialize(card:, dashboard_class:, data: nil, request_params: nil) @card = card @dashboard_class = dashboard_class @data = data @request_params = request_params || ActionController::Parameters.new.permit! end |
Instance Attribute Details
#card ⇒ Object (readonly)
Returns the value of attribute card.
4 5 6 |
# File 'app/components/easy_admin/dashboards/base_card_component.rb', line 4 def card @card end |
#dashboard_class ⇒ Object (readonly)
Returns the value of attribute dashboard_class.
4 5 6 |
# File 'app/components/easy_admin/dashboards/base_card_component.rb', line 4 def dashboard_class @dashboard_class end |
#data ⇒ Object (readonly)
Returns the value of attribute data.
4 5 6 |
# File 'app/components/easy_admin/dashboards/base_card_component.rb', line 4 def data @data end |
#request_params ⇒ Object (readonly)
Returns the value of attribute request_params.
4 5 6 |
# File 'app/components/easy_admin/dashboards/base_card_component.rb', line 4 def request_params @request_params end |
Instance Method Details
#view_template ⇒ Object
13 14 15 16 17 18 19 20 21 22 23 |
# File 'app/components/easy_admin/dashboards/base_card_component.rb', line 13 def view_template div( class: card_classes, role: "region", "aria-labelledby": card_title_id ) do render_card_header render_card_body if card[:footer] end end |