RubyApp 0.5.38 → 0.5.39

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (59) hide show
  1. data/Gemfile.lock +4 -4
  2. data/lib/ruby_app/configuration.yml +1 -1
  3. data/lib/ruby_app/element.rb +70 -9
  4. data/lib/ruby_app/elements/mobile/calendars/month.js.haml +1 -1
  5. data/lib/ruby_app/elements/mobile/calendars/month.rb +2 -2
  6. data/lib/ruby_app/elements/mobile/click.js.haml +1 -1
  7. data/lib/ruby_app/elements/mobile/default/features/buttons_page.rb +1 -1
  8. data/lib/ruby_app/elements/mobile/default/features/calendars/month_page.rb +1 -1
  9. data/lib/ruby_app/elements/mobile/default/features/default_page.css.haml +2 -1
  10. data/lib/ruby_app/elements/mobile/default/features/default_page.html.haml +2 -0
  11. data/lib/ruby_app/elements/mobile/default/features/default_page.js.haml +2 -1
  12. data/lib/ruby_app/elements/mobile/default/features/default_page.rb +5 -1
  13. data/lib/ruby_app/elements/mobile/default/features/dialogs_page.rb +6 -6
  14. data/lib/ruby_app/elements/mobile/default/features/inputs_page.rb +6 -6
  15. data/lib/ruby_app/elements/mobile/default/features/lists_page.rb +2 -2
  16. data/lib/ruby_app/elements/mobile/default/features/message_page.css.haml +2 -0
  17. data/lib/ruby_app/elements/mobile/default/features/message_page.html.haml +9 -0
  18. data/lib/ruby_app/elements/mobile/default/features/message_page.js.haml +2 -0
  19. data/lib/ruby_app/elements/mobile/default/features/message_page.rb +42 -0
  20. data/lib/ruby_app/elements/mobile/default/features/swipe_page.rb +1 -1
  21. data/lib/ruby_app/elements/mobile/default/features/trigger_page.rb +2 -2
  22. data/lib/ruby_app/elements/mobile/dialog.js.haml +2 -2
  23. data/lib/ruby_app/elements/mobile/dialog.rb +1 -1
  24. data/lib/ruby_app/elements/mobile/dialogs/acknowledgement_dialog.rb +0 -1
  25. data/lib/ruby_app/elements/mobile/dialogs/calendars/month_dialog.rb +7 -8
  26. data/lib/ruby_app/elements/mobile/dialogs/confirmation_dialog.rb +0 -2
  27. data/lib/ruby_app/elements/mobile/dialogs/exception_dialog.rb +0 -3
  28. data/lib/ruby_app/elements/mobile/dialogs/response_dialog.rb +1 -1
  29. data/lib/ruby_app/elements/mobile/document.js.haml +51 -38
  30. data/lib/ruby_app/elements/mobile/documents/mail_document.rb +2 -0
  31. data/lib/ruby_app/elements/mobile/documents/quit_document.html.haml +5 -0
  32. data/lib/ruby_app/elements/mobile/input.js.haml +1 -1
  33. data/lib/ruby_app/elements/mobile/inputs/multiline_input.js.haml +1 -1
  34. data/lib/ruby_app/elements/mobile/inputs/toggle_input.js.haml +1 -1
  35. data/lib/ruby_app/elements/mobile/list.js.haml +2 -2
  36. data/lib/ruby_app/elements/mobile/navigation/navigation_link.rb +1 -1
  37. data/lib/ruby_app/elements/mobile/page.html.haml +1 -1
  38. data/lib/ruby_app/elements/mobile/page.js.haml +4 -7
  39. data/lib/ruby_app/elements/mobile/page.rb +5 -19
  40. data/lib/ruby_app/elements/mobile/pages/information/scripts_list.css.haml +9 -0
  41. data/lib/ruby_app/elements/mobile/pages/information/scripts_list_item.html.haml +6 -2
  42. data/lib/ruby_app/elements/mobile/pages/information/scripts_page.rb +1 -1
  43. data/lib/ruby_app/exception.rb +1 -1
  44. data/lib/ruby_app/rack/application.rb +1 -6
  45. data/lib/ruby_app/rack/route.rb +3 -5
  46. data/lib/ruby_app/response.rb +7 -1
  47. data/lib/ruby_app/scripts/all_once.rb +1 -0
  48. data/lib/ruby_app/scripts/default.rb +2 -1
  49. data/lib/ruby_app/scripts/elements/dialogs.rb +4 -0
  50. data/lib/ruby_app/scripts/elements/message.rb +7 -0
  51. data/lib/ruby_app/session.rb +10 -5
  52. data/lib/ruby_app/templates/application/Gemfile +3 -2
  53. data/lib/ruby_app/templates/application/Rakefile +11 -12
  54. data/lib/ruby_app/templates/application/configuration.yml +1 -1
  55. data/lib/ruby_app/templates/application/lib/_APPLICATION_DOWNCODE_/elements/pages/default_page.rb +1 -1
  56. data/lib/ruby_app/templates/application/scripts/default.rb +1 -1
  57. data/lib/ruby_app/translations/en.yml +0 -1
  58. data/lib/ruby_app/version.rb +1 -1
  59. metadata +62 -56
@@ -22,7 +22,7 @@ module RubyApp
22
22
  @back_button = RubyApp::Elements::Mobile::Navigation::BackButton.new
23
23
 
24
24
  self.swiped do |element, event|
25
- RubyApp::Elements::Mobile::Default::Features::NavigatedPage.new.show(event, :transition => 'slide', :reverse => event.is_a?(RubyApp::Elements::Mobile::Page::SwipedRightEvent) ? true : false)
25
+ RubyApp::Elements::Mobile::Default::Features::NavigatedPage.new.show(event, :reverse => event.is_a?(RubyApp::Elements::Mobile::Page::SwipedRightEvent) ? true : false)
26
26
  end
27
27
 
28
28
  end
@@ -20,9 +20,9 @@ module RubyApp
20
20
  @back_button = RubyApp::Elements::Mobile::Navigation::BackButton.new
21
21
 
22
22
  self.shown do |element, event|
23
- event.create_trigger(self, 2)
23
+ event.create_trigger(self, 1)
24
24
  end
25
- self.before_hidden do |element, event|
25
+ self.hidden do |element, event|
26
26
  event.destroy_trigger(self)
27
27
  end
28
28
 
@@ -2,10 +2,10 @@
2
2
  // #{__FILE__}
3
3
  $(document).ready( function() {
4
4
  $(document).on('pageshow', 'div[data-role="dialog"]', function(event) {
5
- RubyApp.queueEvent({_class:'RubyApp::Elements::Mobile::Dialog::ShownEvent', source:$(this).attr('id')});
5
+ RubyApp.sendEvent({_class:'RubyApp::Elements::Mobile::Dialog::ShownEvent', source:$(this).attr('id')});
6
6
  });
7
7
  $(document).on('pagehide', 'div[data-role="dialog"]', function(event) {
8
- RubyApp.queueEvent({_class:'RubyApp::Elements::Mobile::Dialog::HiddenEvent', source:$(this).attr('id')});
8
+ RubyApp.sendEvent({_class:'RubyApp::Elements::Mobile::Dialog::HiddenEvent', source:$(this).attr('id')});
9
9
  });
10
10
  });
11
11
  = yield
@@ -19,7 +19,7 @@ module RubyApp
19
19
  def self.show(event, dialog, options = {})
20
20
  dialog.show(event, options)
21
21
  if block_given?
22
- dialog.hidden do |element, _event|
22
+ dialog.removed do |element, _event|
23
23
  yield _event, dialog.response
24
24
  end
25
25
  end
@@ -22,7 +22,6 @@ module RubyApp
22
22
  @ok_link = RubyApp::Elements::Mobile::Dialogs::ResponseDialog::CloseLink.new
23
23
  @ok_link.clicked do |element, event|
24
24
  @response = true
25
- self.hide(event, element.options)
26
25
  end
27
26
 
28
27
  end
@@ -20,6 +20,11 @@ module RubyApp
20
20
  def initialize(today = Date.today, value = Date.today)
21
21
  super()
22
22
 
23
+ @today_link = RubyApp::Elements::Mobile::Dialogs::ResponseDialog::CloseLink.new
24
+ @today_link.clicked do |element, event|
25
+ @response = today
26
+ end
27
+
23
28
  @month = RubyApp::Elements::Mobile::Calendars::Month.new(today, value)
24
29
  @month.changed do |element, event|
25
30
  @response = @month.value
@@ -31,24 +36,18 @@ module RubyApp
31
36
  'data-iconpos' => 'left',
32
37
  'data-inline' => 'true')
33
38
  @previous_link.clicked do |element, event|
34
- @month.move_previous(event)
39
+ @month.move_previous!(event)
35
40
  event.update_text('div[data-role="header"] h1', RubyApp::Language.locale.strftime(@month.display, '%b %Y'))
36
41
  event.update_text("##{@previous_link.element_id} span.ui-btn-text", RubyApp::Language.locale.strftime(@month.display << 1, '%b'))
37
42
  event.update_text("##{@next_link.element_id} span.ui-btn-text", RubyApp::Language.locale.strftime(@month.display >> 1, '%b'))
38
43
  end
39
44
 
40
- @today_link = RubyApp::Elements::Mobile::Dialogs::ResponseDialog::CloseLink.new
41
- @today_link.clicked do |element, event|
42
- @response = today
43
- self.hide(event, element.options)
44
- end
45
-
46
45
  @next_link = RubyApp::Elements::Mobile::Button.new
47
46
  @next_link.attributes.merge!('data-icon' => 'arrow-r',
48
47
  'data-iconpos' => 'right',
49
48
  'data-inline' => 'true')
50
49
  @next_link.clicked do |element, event|
51
- @month.move_next(event)
50
+ @month.move_next!(event)
52
51
  event.update_text('div[data-role="header"] h1', RubyApp::Language.locale.strftime(@month.display, '%b %Y'))
53
52
  event.update_text("##{@previous_link.element_id} span.ui-btn-text", RubyApp::Language.locale.strftime(@month.display << 1, '%b'))
54
53
  event.update_text("##{@next_link.element_id} span.ui-btn-text", RubyApp::Language.locale.strftime(@month.display >> 1, '%b'))
@@ -20,13 +20,11 @@ module RubyApp
20
20
  @yes_link = RubyApp::Elements::Mobile::Dialogs::ResponseDialog::CloseLink.new
21
21
  @yes_link.clicked do |element, event|
22
22
  @response = true
23
- self.hide(event, element.options)
24
23
  end
25
24
 
26
25
  @no_link = RubyApp::Elements::Mobile::Dialogs::ResponseDialog::CloseLink.new
27
26
  @no_link.clicked do |element, event|
28
27
  @response = false
29
- self.hide(event, element.options)
30
28
  end
31
29
 
32
30
  end
@@ -17,9 +17,6 @@ module RubyApp
17
17
  @exception = exception
18
18
 
19
19
  @close_link = RubyApp::Elements::Mobile::Dialogs::ResponseDialog::CloseLink.new
20
- @close_link.clicked do |element, event|
21
- self.hide(event, element.options)
22
- end
23
20
 
24
21
  end
25
22
 
@@ -17,7 +17,7 @@ module RubyApp
17
17
  def initialize
18
18
  super
19
19
  self.attributes.merge!('data-inline' => 'true')
20
- self.options.merge!(:transition => 'pop')
20
+ self.options.merge!(:transition => 'none')
21
21
  end
22
22
 
23
23
  end
@@ -1,21 +1,23 @@
1
1
  :plain
2
2
  // #{__FILE__}
3
3
  var RubyApp = new function() {
4
- this.queueEvent = function(event) {
4
+ this.sendEvent = function(event) {
5
+ // RubyApp.log('ENQUEUE event.class=' + event._class);
5
6
  event.now = new Date().toString();
6
7
  event.session = RubyApp.getData('session', null);
7
8
  $(window).queue( function() {
8
- RubyApp.log('RubyApp.queueEvent(...) DEQUEUE event.class=' + event._class);
9
+ // RubyApp.log('DEQUEUE event.class=' + event._class);
9
10
  request = $.ajax({type:'POST', url:location.href, data:event});
10
11
  request
11
12
  .success( function(event) {
12
13
  $.each(event.statements, function(index, statement) {
13
- RubyApp.log('RubyApp.queueEvent(...) EVAL statement="' + statement + '"')
14
+ RubyApp.log('EVAL ' + statement)
14
15
  eval(statement);
15
16
  } );
17
+ RubyApp.log('SUCCESS event.class=' + event._class);
16
18
  } )
17
19
  .error( function(request, message, exception) {
18
- RubyApp.log('RubyApp.queueEvent(...) ERROR event.class=' + event._class +' message=' + message);
20
+ RubyApp.log('ERROR event.class=' + event._class + ' message=' + message);
19
21
  RubyApp.confirmRefreshBrowser(RubyApp.getData('error_message', null));
20
22
  } )
21
23
  .complete( function() {
@@ -24,61 +26,69 @@
24
26
  } );
25
27
  },
26
28
  this.showPage = function(id, options) {
27
- $(window).clearQueue();
28
29
  if ($('#' + id).length)
29
30
  $.mobile.changePage($('#' + id), options);
30
31
  else
31
32
  {
32
- RubyApp.log('RubyApp.showPage(...) REQUEST id=' + id);
33
+ // RubyApp.log('ENQUEUE RubyApp.showPage("' + id + '", ...)');
34
+ $(window).queue( function() {
35
+ // RubyApp.log('DEQUEUE RubyApp.showPage("' + id + '", ...)');
36
+ $.mobile.showPageLoadingMsg();
37
+ request = $.ajax({type:'GET', url:'/' + RubyApp.getData('locale', 'en') + '/elements/' + id + '.html'});
38
+ request
39
+ .success( function(content) {
40
+ $('body').prepend(content);
41
+ $.mobile.changePage($('#' + id), options);
42
+ RubyApp.log('SUCCESS RubyApp.showPage("' + id + '", ...)');
43
+ } )
44
+ .error( function(request, message, exception) {
45
+ RubyApp.log('ERROR RubyApp.showPage("' + id + '", ...) message=' + message);
46
+ RubyApp.confirmRefreshBrowser(RubyApp.getData('error_message', null));
47
+ } )
48
+ .complete( function() {
49
+ $.mobile.hidePageLoadingMsg();
50
+ $(window).dequeue();
51
+ } );
52
+ } );
53
+ }
54
+ },
55
+ this.removePage = function(id) {
56
+ $('#' + id).remove();
57
+ },
58
+ this.updateElement = function(id) {
59
+ // RubyApp.log('ENQUEUE RubyApp.updateElement("' + id + '")');
60
+ $(window).queue( function() {
61
+ // RubyApp.log('DEQUEUE RubyApp.updateElement("' + id + '")');
33
62
  $.mobile.showPageLoadingMsg();
34
63
  request = $.ajax({type:'GET', url:'/' + RubyApp.getData('locale', 'en') + '/elements/' + id + '.html'});
35
64
  request
36
65
  .success( function(content) {
37
- $('body').prepend(content);
38
- $.mobile.changePage($('#' + id), options);
66
+ $('#' + id).replaceWith(content);
67
+ $('#' + id).parent().trigger('create');
68
+ RubyApp.log('SUCCESS RubyApp.updateElement("' + id + '")');
39
69
  } )
40
70
  .error( function(request, message, exception) {
41
- RubyApp.log('RubyApp.showPage(...) ERROR id=' + id +' message=' + message);
71
+ RubyApp.log('ERROR RubyApp.updateElement("' + id + '") message=' + message);
42
72
  RubyApp.confirmRefreshBrowser(RubyApp.getData('error_message', null));
43
73
  } )
44
74
  .complete( function() {
45
75
  $.mobile.hidePageLoadingMsg();
76
+ $(window).dequeue();
46
77
  } );
47
- }
48
- },
49
- this.removePage = function(id) {
50
- $(document).on('pagehide.removePage', '#' + id, function(event) {
51
- $(document).off('pagehide.removePage', '#' + id);
52
- $(this).remove();
53
- });
54
- },
55
- this.updateElement = function(id) {
56
- RubyApp.log('RubyApp.updateElement(...) REQUEST id=' + id);
57
- $.mobile.showPageLoadingMsg();
58
- request = $.ajax({type:'GET', url:'/' + RubyApp.getData('locale', 'en') + '/elements/' + id + '.html'});
59
- request
60
- .success( function(content) {
61
- $('#' + id).replaceWith(content);
62
- $('#' + id).parent().trigger('create');
63
- } )
64
- .error( function(request, message, exception) {
65
- RubyApp.log('RubyApp.showPage(...) ERROR id=' + id +' message=' + message);
66
- RubyApp.confirmRefreshBrowser(RubyApp.getData('error_message', null));
67
- } )
68
- .complete( function() {
69
- $.mobile.hidePageLoadingMsg();
70
- } );
78
+ } );
79
+ RubyApp.sendEvent({_class:'RubyApp::Element::UpdatedEvent', source:id});
71
80
  },
72
81
  this.createTrigger = function(id, interval) {
73
82
  RubyApp.destroyTrigger(id);
74
83
  $('#' + id)[0]._trigger = window.setInterval( function() {
75
- RubyApp.queueEvent({_class:'RubyApp::Element::TriggeredEvent', source:id});
84
+ RubyApp.sendEvent({_class:'RubyApp::Element::TriggeredEvent', source:id});
76
85
  }, interval );
77
86
  },
78
87
  this.destroyTrigger = function(id) {
79
- if ($('#' + id)[0]._trigger != undefined) {
88
+ if ($('#' + id)[0]._trigger) {
80
89
  window.clearInterval($('#' + id)[0]._trigger);
81
90
  $('#' + id)[0]._trigger = undefined;
91
+ RubyApp.log('SUCCESS RubyApp.destroyTrigger("' + id + '")');
82
92
  }
83
93
  },
84
94
  this.refreshBrowser = function() {
@@ -131,6 +141,9 @@
131
141
  this.assertExists = function(selector) {
132
142
  RubyApp.assert('selector=' + selector, $(selector).length > 0);
133
143
  },
144
+ this.assertNotExists = function(selector) {
145
+ RubyApp.assert('selector=' + selector, $(selector).length <= 0);
146
+ },
134
147
  this.assertExistsFor = function(selector) {
135
148
  var _for = $(selector).attr('for');
136
149
  RubyApp.assert('selector=' + selector + ', for=' + _for, $('#' + _for).length > 0);
@@ -141,7 +154,7 @@
141
154
  RubyApp.assert('selector=' + selector + ', for=' + _for + ', value=' + value, _value == value);
142
155
  },
143
156
  this.assert = function(name, value) {
144
- RubyApp.queueEvent({_class:'RubyApp::Element::AssertedEvent', source:$('html').attr('id'), name:name, value:value});
157
+ RubyApp.sendEvent({_class:'RubyApp::Element::AssertedEvent', source:$('html').attr('id'), name:name, value:eval(value)});
145
158
  },
146
159
  this.getData = function(name, _default) {
147
160
  var value = $('meta[name="' + name + '"]').attr('content');
@@ -153,9 +166,9 @@
153
166
  };
154
167
 
155
168
  $(window).load(function() {
156
- RubyApp.queueEvent({_class:'RubyApp::Elements::Mobile::Document::LoadedEvent', source:$('html').attr('id')});
169
+ RubyApp.sendEvent({_class:'RubyApp::Elements::Mobile::Document::LoadedEvent', source:$('html').attr('id')});
157
170
  if ($('div[data-role="page"]').length)
158
- RubyApp.queueEvent({_class:'RubyApp::Elements::Mobile::Page::LoadedEvent', source:$('div[data-role="page"]').filter(':first').attr('id')});
171
+ RubyApp.sendEvent({_class:'RubyApp::Elements::Mobile::Page::LoadedEvent', source:$('div[data-role="page"]').filter(':first').attr('id')});
159
172
  });
160
173
 
161
174
  = yield
@@ -11,6 +11,8 @@ module RubyApp
11
11
 
12
12
  template_path(:all, File.dirname(__FILE__))
13
13
 
14
+ exclude_parent_template(:all)
15
+
14
16
  def initialize
15
17
  super
16
18
  end
@@ -2,3 +2,8 @@
2
2
  /
3
3
  #{__FILE__}
4
4
  %html{self.attributes}
5
+ %head
6
+ %script
7
+ :plain
8
+ // #{__FILE__}
9
+ location.assign('/');
@@ -3,7 +3,7 @@
3
3
  $(document).ready( function() {
4
4
  $(document).on('change', 'input', function(event) {
5
5
  event.preventDefault();
6
- RubyApp.queueEvent({_class:'RubyApp::Elements::Mobile::Input::ChangedEvent', source:$(this).attr('id'), value:$(this).val()});
6
+ RubyApp.sendEvent({_class:'RubyApp::Elements::Mobile::Input::ChangedEvent', source:$(this).attr('id'), value:$(this).val()});
7
7
  });
8
8
  });
9
9
  = yield
@@ -3,7 +3,7 @@
3
3
  $(document).ready( function() {
4
4
  $(document).on('change', 'textarea', function(event) {
5
5
  event.preventDefault();
6
- RubyApp.queueEvent({_class:'RubyApp::Elements::Mobile::Inputs::MultilineInput::ChangedEvent', source:$(this).attr('id'), value:$(this).val()});
6
+ RubyApp.sendEvent({_class:'RubyApp::Elements::Mobile::Inputs::MultilineInput::ChangedEvent', source:$(this).attr('id'), value:$(this).val()});
7
7
  });
8
8
  });
9
9
  = yield
@@ -3,7 +3,7 @@
3
3
  $(document).ready( function() {
4
4
  $(document).on('change', 'select[data-role="slider"]', function(event) {
5
5
  event.preventDefault();
6
- RubyApp.queueEvent({_class:'RubyApp::Elements::Mobile::Inputs::ToggleInput::ChangedEvent', source:$(this).attr('id'), value:$(this).val()});
6
+ RubyApp.sendEvent({_class:'RubyApp::Elements::Mobile::Inputs::ToggleInput::ChangedEvent', source:$(this).attr('id'), value:$(this).val()});
7
7
  });
8
8
  });
9
9
  = yield
@@ -3,11 +3,11 @@
3
3
  $(document).ready( function() {
4
4
  $(document).on('tap', 'ul.list > li.item a.item', function(event) {
5
5
  event.preventDefault();
6
- RubyApp.queueEvent({_class:'RubyApp::Elements::Mobile::List::ItemClickedEvent', source:$(this).parents('ul.list').attr('id'), item:$(this).parents('li.item').attr('id')});
6
+ RubyApp.sendEvent({_class:'RubyApp::Elements::Mobile::List::ItemClickedEvent', source:$(this).parents('ul.list').attr('id'), item:$(this).parents('li.item').attr('id')});
7
7
  });
8
8
  $(document).on('tap', 'ul.list > li.item a.link', function(event) {
9
9
  event.preventDefault();
10
- RubyApp.queueEvent({_class:'RubyApp::Elements::Mobile::List::LinkClickedEvent', source:$(this).parents('ul.list').attr('id'), item:$(this).parents('li.item').attr('id')});
10
+ RubyApp.sendEvent({_class:'RubyApp::Elements::Mobile::List::LinkClickedEvent', source:$(this).parents('ul.list').attr('id'), item:$(this).parents('li.item').attr('id')});
11
11
  });
12
12
  });
13
13
  = yield
@@ -19,7 +19,7 @@ module RubyApp
19
19
  end
20
20
 
21
21
  def self.default_options
22
- return {:transition => 'slide'}
22
+ return {:transition => 'none'}
23
23
  end
24
24
 
25
25
  end
@@ -1,2 +1,2 @@
1
- %div{self.attributes}
1
+ %div.page{self.attributes}
2
2
  = yield :page
@@ -2,19 +2,16 @@
2
2
  // #{__FILE__}
3
3
  $(document).ready( function() {
4
4
  $(document).on('pageshow', 'div[data-role="page"]', function(event) {
5
- RubyApp.queueEvent({_class:'RubyApp::Elements::Mobile::Page::ShownEvent', source:$(this).attr('id')});
6
- });
7
- $(document).on('pagebeforehide', 'div[data-role="page"]', function(event) {
8
- RubyApp.queueEvent({_class:'RubyApp::Elements::Mobile::Page::BeforeHiddenEvent', source:$(this).attr('id')});
5
+ RubyApp.sendEvent({_class:'RubyApp::Elements::Mobile::Page::ShownEvent', source:$(this).attr('id')});
9
6
  });
10
7
  $(document).on('pagehide', 'div[data-role="page"]', function(event) {
11
- RubyApp.queueEvent({_class:'RubyApp::Elements::Mobile::Page::HiddenEvent', source:$(this).attr('id')});
8
+ RubyApp.sendEvent({_class:'RubyApp::Elements::Mobile::Page::HiddenEvent', source:$(this).attr('id')});
12
9
  });
13
10
  $(document).on('swipeleft', 'div[data-role="page"]', function(event) {
14
- RubyApp.queueEvent({_class:'RubyApp::Elements::Mobile::Page::SwipedLeftEvent', source:$(this).attr('id')});
11
+ RubyApp.sendEvent({_class:'RubyApp::Elements::Mobile::Page::SwipedLeftEvent', source:$(this).attr('id')});
15
12
  });
16
13
  $(document).on('swiperight', 'div[data-role="page"]', function(event) {
17
- RubyApp.queueEvent({_class:'RubyApp::Elements::Mobile::Page::SwipedRightEvent', source:$(this).attr('id')});
14
+ RubyApp.sendEvent({_class:'RubyApp::Elements::Mobile::Page::SwipedRightEvent', source:$(this).attr('id')});
18
15
  });
19
16
  });
20
17
  = yield
@@ -28,14 +28,6 @@ module RubyApp
28
28
 
29
29
  end
30
30
 
31
- class BeforeHiddenEvent < RubyApp::Element::Event
32
-
33
- def initialize(data)
34
- super(data)
35
- end
36
-
37
- end
38
-
39
31
  class HiddenEvent < RubyApp::Element::Event
40
32
 
41
33
  def initialize(data)
@@ -88,9 +80,8 @@ module RubyApp
88
80
 
89
81
  event :loaded
90
82
  event :shown
91
- event :before_hidden
92
83
  event :hidden
93
- event :unloaded
84
+ event :removed
94
85
  event :swiped
95
86
 
96
87
  def initialize
@@ -100,11 +91,10 @@ module RubyApp
100
91
 
101
92
  def show(event, options = {})
102
93
  RubyApp::Session.document.pages.push(self)
103
- event.show_page(self, options)
94
+ event.show_page(RubyApp::Session.document.pages.last, options)
104
95
  end
105
96
 
106
97
  def hide(event, options = {})
107
- event.remove_page(self)
108
98
  event.show_page(RubyApp::Session.document.pages.second_last, options)
109
99
  end
110
100
 
@@ -113,7 +103,6 @@ module RubyApp
113
103
  def on_event(event)
114
104
  on_loaded(event) if event.is_a?(RubyApp::Elements::Mobile::Page::LoadedEvent)
115
105
  on_shown(event) if event.is_a?(RubyApp::Elements::Mobile::Page::ShownEvent)
116
- on_before_hidden(event) if event.is_a?(RubyApp::Elements::Mobile::Page::BeforeHiddenEvent)
117
106
  on_hidden(event) if event.is_a?(RubyApp::Elements::Mobile::Page::HiddenEvent)
118
107
  on_swiped(event) if event.is_a?(RubyApp::Elements::Mobile::Page::SwipedEvent)
119
108
  super(event)
@@ -127,16 +116,13 @@ module RubyApp
127
116
  shown(event)
128
117
  end
129
118
 
130
- def on_before_hidden(event)
131
- before_hidden(event)
132
- end
133
-
134
119
  def on_hidden(event)
120
+ hidden(event)
135
121
  if RubyApp::Session.document.pages.last == self
136
122
  RubyApp::Session.document.pages.pop
137
- unloaded(event)
123
+ removed(event)
124
+ event.remove_page(self)
138
125
  end
139
- hidden(event)
140
126
  end
141
127
 
142
128
  def on_swiped(event)