Class: Components::EditableSpan
- Inherits:
-
Base
- Object
- Base
- Components::EditableSpan
- Defined in:
- app/components/editable_span.rb
Instance Method Summary collapse
-
#initialize(fieldname:, path:, text:) ⇒ EditableSpan
constructor
A new instance of EditableSpan.
- #view_template ⇒ Object
Constructor Details
#initialize(fieldname:, path:, text:) ⇒ EditableSpan
Returns a new instance of EditableSpan.
4 5 6 7 8 |
# File 'app/components/editable_span.rb', line 4 def initialize(fieldname:, path:, text:) @fieldname = fieldname @path = path @text = text end |
Instance Method Details
#view_template ⇒ Object
10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'app/components/editable_span.rb', line 10 def view_template span( class: "editable p-1", contenteditable: "plaintext-only", data: { editable_field: @fieldname, editable_path: @path, controller: "editable", action: "focus->editable#onFocus blur->editable#onBlur keypress->editable#onKeypress" } ) do @text end end |