Class: TurboBoost::Elements::ToggleCommand
- Inherits:
-
ApplicationCommand
- Object
- Commands::Command
- ApplicationCommand
- TurboBoost::Elements::ToggleCommand
- Defined in:
- app/commands/turbo_boost/elements/toggle_command.rb
Instance Method Summary collapse
Instance Method Details
#hide ⇒ Object
18 19 20 21 22 |
# File 'app/commands/turbo_boost/elements/toggle_command.rb', line 18 def hide validate_element! state[element.aria.controls] = false morph id: element.morphs, html: render(element.) end |
#show ⇒ Object
6 7 8 9 10 11 12 13 14 15 16 |
# File 'app/commands/turbo_boost/elements/toggle_command.rb', line 6 def show validate_element! if element.remember? state[element.aria.controls] = true else state.now[element.aria.controls] = true end morph id: element.morphs, html: render(element.) end |
#toggle ⇒ Object
24 25 26 |
# File 'app/commands/turbo_boost/elements/toggle_command.rb', line 24 def toggle element.aria. ? hide : show end |