Sha256: 919f5c7d2132729e63355455c8c63a1b9b03ce4c2de8054aef5918e510aa90c6
Contents?: true
Size: 1.36 KB
Versions: 8
Compression:
Stored size: 1.36 KB
Contents
class Ussd::Menus::<%= menu_name.camelcase %>Menu < JoyUssdEngine::Menu def before_render # Implement before call backs @field_name="<%= menu_name.underscore %>" # title = "Welcome to the <%= menu_name.camelcase %> menu" # Put menu routes in the @menu_items array # @menu_items = [ # {title: 'Make Payments', route: Ussd::Menus::SendMenu}, # {title: 'View Transactions', route: Ussd::Menus::RequestMenu}, # {title: 'Books', route: Ussd::Menus::Books} # ] # Render the menu out with show_menu and pass the title as a parameter to the `show_menu` method # @menu_text = show_menu(title) end def on_validate # User input validation # if @context.get_state[:<%= menu_name.underscore %>] == "Hello" # @field_error = true # @error_text = "Sorry! Make sure you entered `Hello`." # end end def on_error # Render error and wait for new user input # @menu_text = "#{@error_text}\n#{@menu_text }" # OR Render Error and Terminate App Session # return raise_error(@error_text) end def after_render # Implement after call backs end def render # Render ussd menu and process to the selected menu when the user selects a menu. # load_menu(get_selected_item) end end
Version data entries
8 entries across 8 versions & 1 rubygems