Class: EasyAdmin::Fields::Show::JsonComponent
- Inherits:
-
BaseComponent
- Object
- Phlex::HTML
- BaseComponent
- EasyAdmin::Fields::Show::JsonComponent
- Defined in:
- app/components/easy_admin/fields/show/json_component.rb
Instance Attribute Summary
Attributes inherited from BaseComponent
#field, #form, #record, #value
Instance Method Summary collapse
Methods inherited from BaseComponent
#easy_admin_url_helpers, #helpers, #initialize, #rails_url_helpers
Methods included from EasyAdmin::FieldsHelper
#field_component, #render_field
Methods included from DashboardsHelper
#delta_badge_classes, #metric_value_classes, #render_card, #sparkline_color, #sparkline_points, #trend_direction, #trend_icon, #trend_indicator_classes
Constructor Details
This class inherits a constructor from EasyAdmin::Fields::BaseComponent
Instance Method Details
#view_template ⇒ Object
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'app/components/easy_admin/fields/show/json_component.rb', line 5 def view_template div(class: "space-y-2") do div(class: "text-sm font-medium text-gray-700") { field_label } div(class: "bg-white border rounded-lg overflow-hidden") do if json_value.present? div( data: { controller: "jsoneditor", jsoneditor_mode_value: "view", jsoneditor_data_value: parsed_json_data.to_json }, style: "height: 300px;" ) else div(class: "p-4 text-center text-gray-400 italic") { "No data" } end end end end |