Class: Oversee::Field::Label
- Inherits:
-
Oversee::Field
- Object
- Phlex::HTML
- Base
- Oversee::Field
- Oversee::Field::Label
- Defined in:
- app/components/oversee/field/label.rb
Constant Summary collapse
- ICON_MAP =
{ boolean: Phlex::Icons::Iconoir::SwitchOn, data: Phlex::Icons::Iconoir::Page, date: Phlex::Icons::Iconoir::Calendar, datetime: Phlex::Icons::Iconoir::Calendar, integer: Phlex::Icons::Iconoir::Number0Square, json: Phlex::Icons::Iconoir::CodeBracketsSquare, jsonb: Phlex::Icons::Iconoir::CodeBracketsSquare, rich_text: Phlex::Icons::Iconoir::TextSquare, string: Phlex::Icons::Iconoir::Text, text: Phlex::Icons::Iconoir::TextSquare, }
Instance Attribute Summary
Attributes inherited from Oversee::Field
#datatype, #key, #resource, #value
Instance Method Summary collapse
Methods inherited from Oversee::Field
#__FORM__, #__INPUT__, #__LABEL__, #__SET__, #__VALUE__, #field_form_id, #field_id, #field_name, #initialize, #resource_class_name
Constructor Details
This class inherits a constructor from Oversee::Field
Instance Method Details
#icon ⇒ Object
22 23 24 |
# File 'app/components/oversee/field/label.rb', line 22 def icon ICON_MAP[datatype&.to_sym] || ICON_MAP[:data] end |
#view_template ⇒ Object
15 16 17 18 19 20 |
# File 'app/components/oversee/field/label.rb', line 15 def view_template div(id: "#{key}_label", class:"inline-flex items-center space-x-2") do div(class: "size-5 bg-gray-100 inline-flex items-center justify-center") { render icon.new(class: "size-3") } label(class: "uppercase text-xs text-gray-700 font-medium block cursor-auto", for: key) { key.to_s.humanize(keep_id_suffix: true) } end end |