Skip to content

Instantly share code, notes, and snippets.

@rx
Last active November 11, 2019 19:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rx/57f94f0609b9d244153d77bca25f9263 to your computer and use it in GitHub Desktop.
Save rx/57f94f0609b9d244153d77bca25f9263 to your computer and use it in GitHub Desktop.
Voom::Presenters.define(:test_page) do # Registers the presenter named `test_page`
content id: :hello_world do # Provides a content block wrapper with id :hello_world
heading6 "Hello World! #{Time.now}" # Displays the text as a level 6 heading
end
button :click_me do # Defines a button `CLICK ME`
event :click do # Listens for a `click` event on the button
snackbar 'hello world again!' # Displays the text in the snackbar at the bottom of the screen
inserts :hello_world, presenters_url(:hello_world2) # Inserts the contents of the presenter named `hello_world2` into the content block with id: `hello_world`
end
end
end
Voom::Presenters.define(:hello_world2) do # Registers the presenter named `hello_world2`
heading1 "I said Hello World!! #{Time.now}" # Display the text as a level 1 (big) heading
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment