Class: Oversee::Field::Set
- Inherits:
-
Oversee::Field
- Object
- Phlex::HTML
- Base
- Oversee::Field
- Oversee::Field::Set
- Defined in:
- app/components/oversee/field/set.rb
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
#input_state ⇒ Object
27 28 29 |
# File 'app/components/oversee/field/set.rb', line 27 def input_state render Oversee::Field::Form.new(resource: @resource, datatype:, key:, value:) end |
#value_state ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'app/components/oversee/field/set.rb', line 14 def value_state render Oversee::Field::Display.new(resource:, key:, value:, datatype:, **@options) div(id: dom_id(@resource, :"#{key}_actions")) do ( class: "bg-gray-100 hover:bg-gray-200 text-gray-400 hover:text-blue-500 size-10 aspect-square inline-flex items-center justify-center transition-colors", data: { controller: "clipboard", action: "click->clipboard#copy", clipboard_content_value: value.to_s } ) do span(class: "hidden", data: { clipboard_target: "successIcon"}) { render Phlex::Icons::Iconoir::Check.new(class: "size-4 text-emerald-500", stroke_width: 1.75) } span(data: { clipboard_target: "copyIcon"}) { render Phlex::Icons::Iconoir::Copy.new(class: "size-4", stroke_width: 1.75) } end end end |
#view_template ⇒ Object
4 5 6 7 8 9 10 11 12 |
# File 'app/components/oversee/field/set.rb', line 4 def view_template div(id: dom_id(resource, key), class:"flex flex-col gap-2") do div(class:"flex items-center justify-between h-10 gap-4") do render Oversee::Field::Label.new(key:, datatype:) (type: :submit, class: "bg-black text-white text-xs font-medium px-6 py-2 hover:opacity-75 transition-opacity", form: field_form_id) { "Save" } if state == :input end div(class: "flex items-center justify-between gap-2") { send("#{state}_state") } end end |