Class: Uistiti::Alpha::TogglePreview
- Inherits:
-
ViewComponent::Preview
- Object
- ViewComponent::Preview
- Uistiti::Alpha::TogglePreview
- Defined in:
- app/components/previews/uistiti/alpha/toggle_preview.rb
Instance Method Summary collapse
-
#playground(checked: false, path: '/uistiti/lookbook/dummy/success', model: 'automated_ticket', field: 'active', color_on: :success, color_off: :disabled) ⇒ Object
Toggle ————— On each changes, this component makes PUT request to @path with body sent as follow {@field: value} where value is true/false for now.
Instance Method Details
#playground(checked: false, path: '/uistiti/lookbook/dummy/success', model: 'automated_ticket', field: 'active', color_on: :success, color_off: :disabled) ⇒ Object
Toggle
On each changes, this component makes PUT request to @path with body sent as follow {@field: value} where value is true/false for now. If the request retunr something else than a 2XX the toglle is reverted to its original state
16 17 18 |
# File 'app/components/previews/uistiti/alpha/toggle_preview.rb', line 16 def playground(checked: false, path: '/uistiti/lookbook/dummy/success', model: 'automated_ticket', field: 'active', color_on: :success, color_off: :disabled) render(Uistiti::Alpha::Toggle.new(checked:, path:, model:, field:, color_on:, color_off:)) end |