require_relative '../helpers/indented_grid' Coprl::Presenters.define(:snackbar) do helpers Demo::Helpers::IndentedGrid attach :top_nav attach :component_drawer page_title 'Snackbar' indented_grid do title 'On Page' body 'You can attach a snackbar on the server side and will render after load.' snackbar 'Top Level Important Information!' attach :snackbar_attached title 'As Event' button 'Show Snackbar', id: :show_snackbar do event :click do snackbar 'You clicked snackbar the button!' end end blank title 'Response from a POST' body 'You can return a string or array of strings in your CRUD response (`messages.snackbar`) and it will display after the event fires.' button 'Show Snackbar from Response' do event :click do posts '/_echo_snackbar_', snackbar_echo: 'Your operation succeeded!' end end end attach :code, file: __FILE__ end