Class: EasyAdmin::Dashboards::CardErrorComponent

Inherits:
BaseComponent
  • Object
show all
Defined in:
app/components/easy_admin/dashboards/card_error_component.rb

Instance Method Summary collapse

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(error:) ⇒ CardErrorComponent

Returns a new instance of CardErrorComponent.



4
5
6
# File 'app/components/easy_admin/dashboards/card_error_component.rb', line 4

def initialize(error:)
  @error = error
end

Instance Method Details

#view_templateObject



8
9
10
11
12
13
14
15
16
17
18
19
20
# File 'app/components/easy_admin/dashboards/card_error_component.rb', line 8

def view_template
  div(class: "p-6 text-center") do
    div(class: "mb-4") do
      unsafe_raw "        <svg class=\"mx-auto h-12 w-12 text-red-400\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\">\n          <path stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-width=\"2\" d=\"M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-2.5L13.732 4c-.77-.833-1.732-.833-2.5 0L3.732 16.5c-.77.833.192 2.5 1.732 2.5z\" />\n        </svg>\n      SVG\n    end\n    div(class: \"text-red-600 font-medium mb-2\") { \"Error loading card\" }\n    div(class: \"text-sm text-gray-500\") { @error }\n  end\nend\n"