Class: RubyApp::Elements::Pages::TestPages::DialogTestPage

Inherits:
BlankPage show all
Defined in:
lib/ruby_app/elements/pages/test_pages/dialog_test_page.rb

Instance Attribute Summary

Attributes inherited from Base::BasePage

#interval

Attributes inherited from RubyApp::Element

#attributes

Instance Method Summary collapse

Methods inherited from RubyApp::Element

#element_id, get_element

Methods included from Mixins::ConfigureMixin

#configure

Methods included from Mixins::TranslateMixin

#localize, #translate

Methods included from Mixins::TemplateMixin

#exclude_parent_template, #exclude_parent_template?, #get_templates, #template_name, #template_path

Methods included from Mixins::RenderMixin

#clear_content_for, #content_for, #render, #rendered?

Constructor Details

#initializeDialogTestPage

Returns a new instance of DialogTestPage.



21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
# File 'lib/ruby_app/elements/pages/test_pages/dialog_test_page.rb', line 21

def initialize
  super

  @markdown = RubyApp::Elements::Markdown.new
  @markdown.clicked do |element, event|
    case event.name
    when 'do_busy_dialog'
      RubyApp::Session.show(event, RubyApp::Elements::Dialogs::BusyDialog.new(self.translate.busy_dialog.message)) do |_event|
        sleep 30
      end
    when 'do_confirmation_dialog'
      RubyApp::Session.show(event, RubyApp::Elements::Dialogs::ConfirmationDialog.new(self.translate.confirmation_dialog.title,
                                                                                      self.translate.confirmation_dialog.message)) do |_event, response|
        RubyApp::Session.show(_event, RubyApp::Elements::Dialogs::MessageDialog.new(self.translate.confirmation_dialog.message_dialog.title,
                                                                                    self.translate.confirmation_dialog.message_dialog.message(response)))
      end
    when 'do_exception_dialog'
      RubyApp::Elements::Dialogs::ExceptionDialog.show(event) do
        raise self.translate.exception
      end
    when 'do_unhandled_exception_dialog'
      raise self.translate.exception
    when 'do_message_dialog'
      RubyApp::Session.show(event, RubyApp::Elements::Dialogs::MessageDialog.new(self.translate.message_dialog.message.title,
                                                                                 self.translate.message_dialog.message.message))
    when 'do_month_dialog'
      RubyApp::Session.show(event, RubyApp::Elements::Dialogs::Calendars::MonthDialog.new(self.translate.month_dialog.title, event.today)) do |_event, response|
        RubyApp::Session.show(_event, RubyApp::Elements::Dialogs::MessageDialog.new(self.translate.month_dialog.message_dialog.title,
                                                                                    self.translate.month_dialog.message_dialog.message(response))) do |__event, _response|
          __event.execute("$('#last_value').text('#{response}');")
        end
      end
    end
  end

end