Class: EasyAdmin::LazyChartCardComponent
- Inherits:
-
Phlex::HTML
- Object
- Phlex::HTML
- EasyAdmin::LazyChartCardComponent
- Defined in:
- app/components/easy_admin/lazy_chart_card_component.rb
Instance Method Summary collapse
-
#initialize(chart_config:, record:) ⇒ LazyChartCardComponent
constructor
A new instance of LazyChartCardComponent.
- #view_template ⇒ Object
Constructor Details
#initialize(chart_config:, record:) ⇒ LazyChartCardComponent
Returns a new instance of LazyChartCardComponent.
3 4 5 6 |
# File 'app/components/easy_admin/lazy_chart_card_component.rb', line 3 def initialize(chart_config:, record:) @chart_config = chart_config @record = record end |
Instance Method Details
#view_template ⇒ Object
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'app/components/easy_admin/lazy_chart_card_component.rb', line 8 def view_template div(class: @chart_config[:css_classes]) do if @chart_config[:title] div(class: "card-header") do h5(class: "card-title") { @chart_config[:title] } end end div(class: "card-body") do div( id: chart_id, data: { controller: "chart", chart_type_value: @chart_config[:chart_type], chart_height_value: @chart_config[:height], chart_config_value: chart_data.to_json, chart_data_source_value: @chart_config[:data_source] } ) end end end |