Rhodes provides System Alert methods, which helps to show a custom popup. You may call on system alert methods to show popup, vibrate, or play audio files from your controller.
The most used method is show_popup
, which brings the app upfront and shows the specified message. The simple syntax of showing a popup looks like:
Alert.show_popup "Some message"
This will show an alert with the message Some message.
We can customize the popup title, icon, buttons, and specify callback to be called on any button click. This is the basic syntax:
Alert.show_popup( { :message => 'Some message', :title => 'Custom title', :icon => '/public/images/icon.png', :buttons => ["Yes", "No", {:id => 'cancel', :title => 'Cancel all'}], :callback => url_for(:action => :on_dissmiss_popup) } )
This command will show a popup with the message Some message, title as Custom title, an icon, and two buttons, and will call a callback on_dissmiss_popup
. The popup window...