Class: EasyAdmin::Fields::Form::NumberComponent
- Inherits:
-
BaseComponent
- Object
- Phlex::HTML
- BaseComponent
- EasyAdmin::Fields::Form::NumberComponent
- Defined in:
- app/components/easy_admin/fields/form/number_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 24 25 26 27 |
# File 'app/components/easy_admin/fields/form/number_component.rb', line 5 def view_template div(class: "mb-4") do label(for: field_id, class: label_classes) do plain field_label if required? span(class: "text-red-500 ml-1") { "*" } end end input( type: "number", name: form_field_name, id: field_id, value: current_value, class: input_classes, required: required?, placeholder: field[:placeholder] || "Enter #{field_label.downcase}" ) render_field_errors if field[:help_text] p(class: "mt-1 text-sm text-gray-500") { field[:help_text] } end end end |