RubyApp 0.2.8 → 0.5.0

Sign up to get free protection for your applications and to get access to all the features.
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- RubyApp (0.2.8)
4
+ RubyApp (0.5.0)
5
5
  BlueCloth
6
6
  chronic
7
7
  chronic_duration
@@ -17,8 +17,8 @@ default:
17
17
  formats:
18
18
  - :css
19
19
  - :js
20
- read?: true
21
- write?: true
20
+ read?: false
21
+ write?: false
22
22
  session:
23
23
  _class: "RubyApp::Session"
24
24
  expires: 1200
@@ -16,7 +16,7 @@
16
16
  - RubyApp::Request.query.each do |name, value|
17
17
  %meta{:name => name, :content => value}
18
18
  %meta{:name => :locale, :content => RubyApp::Language.locale.code}
19
- %meta{:name => :event_error_message, :content => RubyApp::Elements::Mobile::Document.translate.event_error_message}
19
+ %meta{:name => :error_message, :content => RubyApp::Elements::Mobile::Document.translate.error_message}
20
20
  %body
21
21
  - self.pages.reverse.each do |page|
22
22
  = page.render(:html)
@@ -5,18 +5,18 @@
5
5
  event.now = new Date().toString();
6
6
  event.session = RubyApp.getData('session', null);
7
7
  $(window).queue( function() {
8
- RubyApp.log('RubyApp.queueEvent(...) DEQUEUE event.class=' + event._class);
8
+ RubyApp.log('RubyApp.queueEvent(...) DEQUEUE event.class=' + event._class);
9
9
  request = $.ajax({type:'POST', url:location.href, data:event});
10
10
  request
11
11
  .success( function(event) {
12
12
  $.each(event.statements, function(index, statement) {
13
- RubyApp.log('RubyApp.queueEvent(...) EVAL statement="' + statement + '"')
13
+ RubyApp.log('RubyApp.queueEvent(...) EVAL statement="' + statement + '"')
14
14
  eval(statement);
15
15
  } );
16
16
  } )
17
17
  .error( function(request, message, exception) {
18
- RubyApp.log('RubyApp.queueEvent(...) ERROR event.class=' + event._class +' message=' + message);
19
- RubyApp.confirmRefreshBrowser(RubyApp.getData('event_error_message', null));
18
+ RubyApp.log('RubyApp.queueEvent(...) ERROR event.class=' + event._class +' message=' + message);
19
+ RubyApp.confirmRefreshBrowser(RubyApp.getData('error_message', null));
20
20
  } )
21
21
  .complete( function() {
22
22
  $(window).dequeue();
@@ -29,11 +29,20 @@
29
29
  $.mobile.changePage($('#' + id), options);
30
30
  else
31
31
  {
32
+ RubyApp.log('RubyApp.showPage(...) REQUEST id=' + id);
33
+ $.mobile.showPageLoadingMsg();
32
34
  request = $.ajax({type:'GET', url:'/' + RubyApp.getData('locale', 'en') + '/elements/' + id + '.html'});
33
35
  request
34
36
  .success( function(content) {
35
37
  $('body').prepend(content);
36
38
  $.mobile.changePage($('#' + id), options);
39
+ } )
40
+ .error( function(request, message, exception) {
41
+ RubyApp.log('RubyApp.showPage(...) ERROR id=' + id +' message=' + message);
42
+ RubyApp.confirmRefreshBrowser(RubyApp.getData('error_message', null));
43
+ } )
44
+ .complete( function() {
45
+ $.mobile.hidePageLoadingMsg();
37
46
  } );
38
47
  }
39
48
  },
@@ -44,11 +53,20 @@
44
53
  });
45
54
  },
46
55
  this.updateElement = function(id) {
56
+ RubyApp.log('RubyApp.updateElement(...) REQUEST id=' + id);
57
+ $.mobile.showPageLoadingMsg();
47
58
  request = $.ajax({type:'GET', url:'/' + RubyApp.getData('locale', 'en') + '/elements/' + id + '.html'});
48
59
  request
49
60
  .success( function(content) {
50
61
  $('#' + id).replaceWith(content);
51
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();
52
70
  } );
53
71
  },
54
72
  this.createTrigger = function(id, interval) {
@@ -26,7 +26,7 @@
26
26
  - RubyApp::Request.query.each do |name, value|
27
27
  %meta{:name => name, :content => value}
28
28
  %meta{:name => :locale, :content => RubyApp::Language.locale.code}
29
- %meta{:name => :event_error_message, :content => RubyApp::Elements::Mobile::Document.translate.event_error_message}
29
+ %meta{:name => :error_message, :content => RubyApp::Elements::Mobile::Document.translate.error_message}
30
30
  %body
31
31
  - self.pages.reverse.each do |page|
32
32
  = page.render(:html)
@@ -18,8 +18,8 @@ default:
18
18
  formats:
19
19
  - :css
20
20
  - :js
21
- read?: true
22
- write?: true
21
+ read?: false
22
+ write?: false
23
23
  session:
24
24
  _class: "_APPLICATION_UPCODE_::Session"
25
25
  expires: 900
@@ -14,7 +14,7 @@ ruby_app:
14
14
  exception_dialog:
15
15
  close: "Close"
16
16
  document:
17
- event_error_message: "An error occurred sending the event. The page will refresh so you can try again."
17
+ error_message: "An error occurred exchanging data with the server. The page will refresh so you can try again."
18
18
  inputs:
19
19
  toggle_input:
20
20
  _on: "ON"
@@ -1,4 +1,4 @@
1
1
  module RubyApp
2
- VERSION = "0.2.8"
2
+ VERSION = "0.5.0"
3
3
  ROOT = File.expand_path(File.dirname(__FILE__))
4
4
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: RubyApp
3
3
  version: !ruby/object:Gem::Version
4
- hash: 7
4
+ hash: 11
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
- - 2
9
- - 8
10
- version: 0.2.8
8
+ - 5
9
+ - 0
10
+ version: 0.5.0
11
11
  platform: ruby
12
12
  authors:
13
13
  - Frank G. Ficnar
@@ -18,6 +18,8 @@ cert_chain: []
18
18
  date: 2012-04-11 00:00:00 Z
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
21
+ prerelease: false
22
+ name: BlueCloth
21
23
  version_requirements: &id001 !ruby/object:Gem::Requirement
22
24
  none: false
23
25
  requirements:
@@ -27,11 +29,11 @@ dependencies:
27
29
  segments:
28
30
  - 0
29
31
  version: "0"
30
- requirement: *id001
31
32
  type: :runtime
32
- prerelease: false
33
- name: BlueCloth
33
+ requirement: *id001
34
34
  - !ruby/object:Gem::Dependency
35
+ prerelease: false
36
+ name: chronic
35
37
  version_requirements: &id002 !ruby/object:Gem::Requirement
36
38
  none: false
37
39
  requirements:
@@ -41,11 +43,11 @@ dependencies:
41
43
  segments:
42
44
  - 0
43
45
  version: "0"
44
- requirement: *id002
45
46
  type: :runtime
46
- prerelease: false
47
- name: chronic
47
+ requirement: *id002
48
48
  - !ruby/object:Gem::Dependency
49
+ prerelease: false
50
+ name: chronic_duration
49
51
  version_requirements: &id003 !ruby/object:Gem::Requirement
50
52
  none: false
51
53
  requirements:
@@ -55,11 +57,11 @@ dependencies:
55
57
  segments:
56
58
  - 0
57
59
  version: "0"
58
- requirement: *id003
59
60
  type: :runtime
60
- prerelease: false
61
- name: chronic_duration
61
+ requirement: *id003
62
62
  - !ruby/object:Gem::Dependency
63
+ prerelease: false
64
+ name: facets
63
65
  version_requirements: &id004 !ruby/object:Gem::Requirement
64
66
  none: false
65
67
  requirements:
@@ -69,11 +71,11 @@ dependencies:
69
71
  segments:
70
72
  - 0
71
73
  version: "0"
72
- requirement: *id004
73
74
  type: :runtime
74
- prerelease: false
75
- name: facets
75
+ requirement: *id004
76
76
  - !ruby/object:Gem::Dependency
77
+ prerelease: false
78
+ name: fileutils
77
79
  version_requirements: &id005 !ruby/object:Gem::Requirement
78
80
  none: false
79
81
  requirements:
@@ -83,11 +85,11 @@ dependencies:
83
85
  segments:
84
86
  - 0
85
87
  version: "0"
86
- requirement: *id005
87
88
  type: :runtime
88
- prerelease: false
89
- name: fileutils
89
+ requirement: *id005
90
90
  - !ruby/object:Gem::Dependency
91
+ prerelease: false
92
+ name: haml
91
93
  version_requirements: &id006 !ruby/object:Gem::Requirement
92
94
  none: false
93
95
  requirements:
@@ -97,11 +99,11 @@ dependencies:
97
99
  segments:
98
100
  - 0
99
101
  version: "0"
100
- requirement: *id006
101
102
  type: :runtime
102
- prerelease: false
103
- name: haml
103
+ requirement: *id006
104
104
  - !ruby/object:Gem::Dependency
105
+ prerelease: false
106
+ name: json
105
107
  version_requirements: &id007 !ruby/object:Gem::Requirement
106
108
  none: false
107
109
  requirements:
@@ -111,11 +113,11 @@ dependencies:
111
113
  segments:
112
114
  - 0
113
115
  version: "0"
114
- requirement: *id007
115
116
  type: :runtime
116
- prerelease: false
117
- name: json
117
+ requirement: *id007
118
118
  - !ruby/object:Gem::Dependency
119
+ prerelease: false
120
+ name: mime-types
119
121
  version_requirements: &id008 !ruby/object:Gem::Requirement
120
122
  none: false
121
123
  requirements:
@@ -125,11 +127,11 @@ dependencies:
125
127
  segments:
126
128
  - 0
127
129
  version: "0"
128
- requirement: *id008
129
130
  type: :runtime
130
- prerelease: false
131
- name: mime-types
131
+ requirement: *id008
132
132
  - !ruby/object:Gem::Dependency
133
+ prerelease: false
134
+ name: r18n-core
133
135
  version_requirements: &id009 !ruby/object:Gem::Requirement
134
136
  none: false
135
137
  requirements:
@@ -139,11 +141,11 @@ dependencies:
139
141
  segments:
140
142
  - 0
141
143
  version: "0"
142
- requirement: *id009
143
144
  type: :runtime
144
- prerelease: false
145
- name: r18n-core
145
+ requirement: *id009
146
146
  - !ruby/object:Gem::Dependency
147
+ prerelease: false
148
+ name: rack
147
149
  version_requirements: &id010 !ruby/object:Gem::Requirement
148
150
  none: false
149
151
  requirements:
@@ -153,11 +155,11 @@ dependencies:
153
155
  segments:
154
156
  - 0
155
157
  version: "0"
156
- requirement: *id010
157
158
  type: :runtime
158
- prerelease: false
159
- name: rack
159
+ requirement: *id010
160
160
  - !ruby/object:Gem::Dependency
161
+ prerelease: false
162
+ name: ruby-event
161
163
  version_requirements: &id011 !ruby/object:Gem::Requirement
162
164
  none: false
163
165
  requirements:
@@ -167,11 +169,11 @@ dependencies:
167
169
  segments:
168
170
  - 0
169
171
  version: "0"
170
- requirement: *id011
171
172
  type: :runtime
172
- prerelease: false
173
- name: ruby-event
173
+ requirement: *id011
174
174
  - !ruby/object:Gem::Dependency
175
+ prerelease: false
176
+ name: ruby-openid
175
177
  version_requirements: &id012 !ruby/object:Gem::Requirement
176
178
  none: false
177
179
  requirements:
@@ -181,11 +183,11 @@ dependencies:
181
183
  segments:
182
184
  - 0
183
185
  version: "0"
184
- requirement: *id012
185
186
  type: :runtime
186
- prerelease: false
187
- name: ruby-openid
187
+ requirement: *id012
188
188
  - !ruby/object:Gem::Dependency
189
+ prerelease: false
190
+ name: sass
189
191
  version_requirements: &id013 !ruby/object:Gem::Requirement
190
192
  none: false
191
193
  requirements:
@@ -195,11 +197,11 @@ dependencies:
195
197
  segments:
196
198
  - 0
197
199
  version: "0"
198
- requirement: *id013
199
200
  type: :runtime
200
- prerelease: false
201
- name: sass
201
+ requirement: *id013
202
202
  - !ruby/object:Gem::Dependency
203
+ prerelease: false
204
+ name: term-ansicolor
203
205
  version_requirements: &id014 !ruby/object:Gem::Requirement
204
206
  none: false
205
207
  requirements:
@@ -209,11 +211,11 @@ dependencies:
209
211
  segments:
210
212
  - 0
211
213
  version: "0"
212
- requirement: *id014
213
214
  type: :runtime
214
- prerelease: false
215
- name: term-ansicolor
215
+ requirement: *id014
216
216
  - !ruby/object:Gem::Dependency
217
+ prerelease: false
218
+ name: terminal-table
217
219
  version_requirements: &id015 !ruby/object:Gem::Requirement
218
220
  none: false
219
221
  requirements:
@@ -223,11 +225,11 @@ dependencies:
223
225
  segments:
224
226
  - 0
225
227
  version: "0"
226
- requirement: *id015
227
228
  type: :runtime
228
- prerelease: false
229
- name: terminal-table
229
+ requirement: *id015
230
230
  - !ruby/object:Gem::Dependency
231
+ prerelease: false
232
+ name: yajl-ruby
231
233
  version_requirements: &id016 !ruby/object:Gem::Requirement
232
234
  none: false
233
235
  requirements:
@@ -237,11 +239,11 @@ dependencies:
237
239
  segments:
238
240
  - 0
239
241
  version: "0"
240
- requirement: *id016
241
242
  type: :runtime
242
- prerelease: false
243
- name: yajl-ruby
243
+ requirement: *id016
244
244
  - !ruby/object:Gem::Dependency
245
+ prerelease: false
246
+ name: rake
245
247
  version_requirements: &id017 !ruby/object:Gem::Requirement
246
248
  none: false
247
249
  requirements:
@@ -251,10 +253,8 @@ dependencies:
251
253
  segments:
252
254
  - 0
253
255
  version: "0"
254
- requirement: *id017
255
256
  type: :development
256
- prerelease: false
257
- name: rake
257
+ requirement: *id017
258
258
  description: A mobile web application framework in Ruby
259
259
  email:
260
260
  - frank.ficnar@gmail.com
@@ -283,8 +283,6 @@ files:
283
283
  - lib/ruby_app/elements/mobile/button.rb
284
284
  - lib/ruby_app/elements/mobile/click.js.haml
285
285
  - lib/ruby_app/elements/mobile/click.rb
286
- - lib/ruby_app/elements/mobile/default/.cache/default_document.css
287
- - lib/ruby_app/elements/mobile/default/.cache/default_document.js
288
286
  - lib/ruby_app/elements/mobile/default/default_document.css.haml
289
287
  - lib/ruby_app/elements/mobile/default/default_document.js.haml
290
288
  - lib/ruby_app/elements/mobile/default/default_document.rb
@@ -339,12 +337,6 @@ files:
339
337
  - lib/ruby_app/elements/mobile/document.html.haml
340
338
  - lib/ruby_app/elements/mobile/document.js.haml
341
339
  - lib/ruby_app/elements/mobile/document.rb
342
- - lib/ruby_app/elements/mobile/documents/authentication/open_id/.cache/google_authentication_document.css
343
- - lib/ruby_app/elements/mobile/documents/authentication/open_id/.cache/google_authentication_document.js
344
- - lib/ruby_app/elements/mobile/documents/authentication/open_id/.cache/my_open_id_authentication_document.css
345
- - lib/ruby_app/elements/mobile/documents/authentication/open_id/.cache/my_open_id_authentication_document.js
346
- - lib/ruby_app/elements/mobile/documents/authentication/open_id/.cache/yahoo_authentication_document.css
347
- - lib/ruby_app/elements/mobile/documents/authentication/open_id/.cache/yahoo_authentication_document.js
348
340
  - lib/ruby_app/elements/mobile/documents/authentication/open_id/authentication_document.rb
349
341
  - lib/ruby_app/elements/mobile/documents/authentication/open_id/ax_authentication_document.rb
350
342
  - lib/ruby_app/elements/mobile/documents/authentication/open_id/email_authentication_document.rb
@@ -527,7 +519,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
527
519
  requirements: []
528
520
 
529
521
  rubyforge_project:
530
- rubygems_version: 1.8.10
522
+ rubygems_version: 1.8.13
531
523
  signing_key:
532
524
  specification_version: 3
533
525
  summary: A mobile web application framework in Ruby
@@ -1,33 +0,0 @@
1
- /* /Users/frank.ficnar/Dropbox/Projects/gems/ruby_app/lib/ruby_app/elements/mobile/page.css.haml */
2
- div.ui-header a.ui-btn-left {
3
- margin-left: 0px; }
4
- div.ui-header a.ui-btn-right {
5
- margin-right: 0px; }
6
-
7
-
8
- /* /Users/frank.ficnar/Dropbox/Projects/gems/ruby_app/lib/ruby_app/elements/mobile/dialog.css.haml */
9
- a.ui-corner-top.ui-btn-left.ui-btn.ui-btn-up-a.ui-btn-icon-notext.ui-btn-corner-all.ui-shadow {
10
- display: none; }
11
- /* /Users/frank.ficnar/Dropbox/Projects/gems/ruby_app/lib/ruby_app/elements/mobile/dialogs/response_dialog.css.haml */
12
- div.ui-dialog div.buttons {
13
- padding-top: 15px;
14
- text-align: right; }
15
- div.ui-dialog div.buttons a.ui-btn {
16
- margin-bottom: 0px;
17
- margin-left: 5px;
18
- margin-right: 0px;
19
- margin-top: 0px; }
20
-
21
-
22
-
23
-
24
-
25
- /* /Users/frank.ficnar/Dropbox/Projects/gems/ruby_app/lib/ruby_app/elements/mobile/pages/information/information_list.css.haml */
26
- li.ui-li-static {
27
- font-size: inherit; }
28
- li.ui-li-static span.ui-li-aside {
29
- font-size: 10pt;
30
- font-weight: normal;
31
- margin-bottom: 0px;
32
- margin-top: 2px; }
33
-
@@ -1,191 +0,0 @@
1
- // /Users/frank.ficnar/Dropbox/Projects/gems/ruby_app/lib/ruby_app/elements/mobile/document.js.haml
2
- var RubyApp = new function() {
3
- this.queueEvent = function(event) {
4
- event.now = new Date().toString();
5
- event.session = RubyApp.getData('session', null);
6
- $(window).queue( function() {
7
- RubyApp.log('RubyApp.queueEvent(...) DEQUEUE event.class=' + event._class);
8
- request = $.ajax({type:'POST', url:location.href, data:event});
9
- request
10
- .success( function(event) {
11
- $.each(event.statements, function(index, statement) {
12
- RubyApp.log('RubyApp.queueEvent(...) EVAL statement="' + statement + '"')
13
- eval(statement);
14
- } );
15
- } )
16
- .error( function(request, message, exception) {
17
- RubyApp.log('RubyApp.queueEvent(...) ERROR event.class=' + event._class +' message=' + message);
18
- RubyApp.confirmRefreshBrowser(RubyApp.getData('event_error_message', null));
19
- } )
20
- .complete( function() {
21
- $(window).dequeue();
22
- } )
23
- } );
24
- },
25
- this.showPage = function(id, options) {
26
- $(window).clearQueue();
27
- if ($('#' + id).length)
28
- $.mobile.changePage($('#' + id), options);
29
- else
30
- {
31
- request = $.ajax({type:'GET', url:'/' + RubyApp.getData('locale', 'en') + '/elements/' + id + '.html'});
32
- request
33
- .success( function(content) {
34
- $('body').prepend(content);
35
- $.mobile.changePage($('#' + id), options);
36
- } );
37
- }
38
- },
39
- this.removePage = function(id) {
40
- $(document).on('pagehide.removePage', '#' + id, function(event) {
41
- $(document).off('pagehide.removePage', '#' + id);
42
- $(this).remove();
43
- });
44
- },
45
- this.updateElement = function(id) {
46
- request = $.ajax({type:'GET', url:'/' + RubyApp.getData('locale', 'en') + '/elements/' + id + '.html'});
47
- request
48
- .success( function(content) {
49
- $('#' + id).replaceWith(content);
50
- $('#' + id).parent().trigger('create');
51
- } );
52
- },
53
- this.createTrigger = function(id, interval) {
54
- RubyApp.destroyTrigger(id);
55
- $('#' + id)[0]._trigger = window.setInterval( function() {
56
- RubyApp.queueEvent({_class:'RubyApp::Element::TriggeredEvent', source:id});
57
- }, interval );
58
- },
59
- this.destroyTrigger = function(id) {
60
- if ($('#' + id)[0]._trigger != undefined) {
61
- window.clearInterval($('#' + id)[0]._trigger);
62
- $('#' + id)[0]._trigger = undefined;
63
- }
64
- },
65
- this.refreshBrowser = function() {
66
- $(window).clearQueue();
67
- location.assign(location.href);
68
- },
69
- this.confirmRefreshBrowser = function(message) {
70
- if (confirm(message))
71
- RubyApp.refreshBrowser();
72
- },
73
- this.go = function(url) {
74
- location.assign(url);
75
- },
76
- this.addClass = function(selector, _class) {
77
- $(selector).addClass(_class);
78
- },
79
- this.removeClass = function(selector, _class) {
80
- $(selector).removeClass(_class);
81
- },
82
- this.updateText = function(selector, value) {
83
- $(selector).text(value);
84
- },
85
- this.updateValue = function(selector, value) {
86
- $(selector).val(value);
87
- },
88
- this.updateValueFor = function(selector, value) {
89
- var _for = $(selector).attr('for');
90
- RubyApp.updateValue('#' + _for, value);
91
- RubyApp.change('#' + _for, value);
92
- },
93
- this.setCookie = function(name, value, expires) {
94
- document.cookie = name + '=' + value + '; expires=' + expires.toUTCString();
95
- },
96
- this.tap = function(selector) {
97
- $(selector).tap();
98
- },
99
- this.change = function(selector) {
100
- $(selector).change();
101
- },
102
- this.assertExists = function(selector) {
103
- RubyApp.assert('selector=' + selector, $(selector).length > 0);
104
- },
105
- this.assertExistsFor = function(selector) {
106
- var _for = $(selector).attr('for');
107
- RubyApp.assert('selector=' + selector + ', for=' + _for, $('#' + _for).length > 0);
108
- },
109
- this.assertExistsValueFor = function(selector, value) {
110
- var _for = $(selector).attr('for');
111
- var _value = $('#' + _for).val();
112
- RubyApp.assert('selector=' + selector + ', for=' + _for + ', value=' + value, _value == value);
113
- },
114
- this.assert = function(name, value) {
115
- RubyApp.queueEvent({_class:'RubyApp::Element::AssertedEvent', source:$('html').attr('id'), name:name, value:value});
116
- },
117
- this.getData = function(name, _default) {
118
- var value = $('meta[name="' + name + '"]').attr('content');
119
- return value == undefined ? _default : value;
120
- },
121
- this.log = function(message) {
122
- console.log(message);
123
- }
124
- };
125
-
126
- $(window).load(function() {
127
- RubyApp.queueEvent({_class:'RubyApp::Elements::Mobile::Document::LoadedEvent', source:$('html').attr('id')});
128
- });
129
- // /Users/frank.ficnar/Dropbox/Projects/gems/ruby_app/lib/ruby_app/elements/mobile/page.js.haml
130
- $(document).ready( function() {
131
- $(document).on('pageshow', 'div[data-role="page"]', function(event) {
132
- RubyApp.queueEvent({_class:'RubyApp::Elements::Mobile::Page::ShownEvent', source:$(this).attr('id')});
133
- });
134
- $(document).on('pagebeforehide', 'div[data-role="page"]', function(event) {
135
- RubyApp.queueEvent({_class:'RubyApp::Elements::Mobile::Page::BeforeHiddenEvent', source:$(this).attr('id')});
136
- });
137
- $(document).on('pagehide', 'div[data-role="page"]', function(event) {
138
- RubyApp.queueEvent({_class:'RubyApp::Elements::Mobile::Page::HiddenEvent', source:$(this).attr('id')});
139
- });
140
- });
141
- // /Users/frank.ficnar/Dropbox/Projects/gems/ruby_app/lib/ruby_app/elements/mobile/click.js.haml
142
- $(document).ready( function() {
143
- $(document).on('tap', '.click', function(event) {
144
- event.preventDefault();
145
- RubyApp.queueEvent({_class:'RubyApp::Elements::Mobile::Click::ClickedEvent', source:$(this).attr('id')});
146
- });
147
- });
148
-
149
-
150
- // /Users/frank.ficnar/Dropbox/Projects/gems/ruby_app/lib/ruby_app/elements/mobile/dialog.js.haml
151
- $(document).ready( function() {
152
- $(document).on('pageshow', 'div[data-role="dialog"]', function(event) {
153
- RubyApp.queueEvent({_class:'RubyApp::Elements::Mobile::Dialog::ShownEvent', source:$(this).attr('id')});
154
- });
155
- $(document).on('pagehide', 'div[data-role="dialog"]', function(event) {
156
- RubyApp.queueEvent({_class:'RubyApp::Elements::Mobile::Dialog::HiddenEvent', source:$(this).attr('id')});
157
- });
158
- });
159
-
160
- // /Users/frank.ficnar/Dropbox/Projects/gems/ruby_app/lib/ruby_app/elements/mobile/input.js.haml
161
- $(document).ready( function() {
162
- $(document).on('change', 'input', function(event) {
163
- event.preventDefault();
164
- RubyApp.queueEvent({_class:'RubyApp::Elements::Mobile::Input::ChangedEvent', source:$(this).attr('id'), value:$(this).val()});
165
- });
166
- });
167
-
168
-
169
- // /Users/frank.ficnar/Dropbox/Projects/gems/ruby_app/lib/ruby_app/elements/mobile/inputs/multiline_input.js.haml
170
- $(document).ready( function() {
171
- $(document).on('change', 'textarea', function(event) {
172
- event.preventDefault();
173
- RubyApp.queueEvent({_class:'RubyApp::Elements::Mobile::Inputs::MultilineInput::ChangedEvent', source:$(this).attr('id'), value:$(this).val()});
174
- });
175
- });
176
- // /Users/frank.ficnar/Dropbox/Projects/gems/ruby_app/lib/ruby_app/elements/mobile/inputs/toggle_input.js.haml
177
- $(document).ready( function() {
178
- $(document).on('change', 'select[data-role="slider"]', function(event) {
179
- event.preventDefault();
180
- RubyApp.queueEvent({_class:'RubyApp::Elements::Mobile::Inputs::ToggleInput::ChangedEvent', source:$(this).attr('id'), value:$(this).val()});
181
- });
182
- });
183
-
184
-
185
- // /Users/frank.ficnar/Dropbox/Projects/gems/ruby_app/lib/ruby_app/elements/mobile/list.js.haml
186
- $(document).ready( function() {
187
- $(document).on('tap', 'ul.list > li.item a.item', function(event) {
188
- event.preventDefault();
189
- RubyApp.queueEvent({_class:'RubyApp::Elements::Mobile::List::ClickedEvent', source:$(this).parents('ul.list').attr('id'), index:$(this).attr('index')});
190
- });
191
- });
@@ -1,129 +0,0 @@
1
- // /Users/frank.ficnar/Dropbox/Projects/gems/ruby_app/lib/ruby_app/elements/mobile/document.js.haml
2
- var RubyApp = new function() {
3
- this.queueEvent = function(event) {
4
- event.now = new Date().toString();
5
- event.session = RubyApp.getData('session', null);
6
- $(window).queue( function() {
7
- RubyApp.log('RubyApp.queueEvent(...) DEQUEUE event.class=' + event._class);
8
- request = $.ajax({type:'POST', url:location.href, data:event});
9
- request
10
- .success( function(event) {
11
- $.each(event.statements, function(index, statement) {
12
- RubyApp.log('RubyApp.queueEvent(...) EVAL statement="' + statement + '"')
13
- eval(statement);
14
- } );
15
- } )
16
- .error( function(request, message, exception) {
17
- RubyApp.log('RubyApp.queueEvent(...) ERROR event.class=' + event._class +' message=' + message);
18
- RubyApp.confirmRefreshBrowser(RubyApp.getData('event_error_message', null));
19
- } )
20
- .complete( function() {
21
- $(window).dequeue();
22
- } )
23
- } );
24
- },
25
- this.showPage = function(id, options) {
26
- $(window).clearQueue();
27
- if ($('#' + id).length)
28
- $.mobile.changePage($('#' + id), options);
29
- else
30
- {
31
- request = $.ajax({type:'GET', url:'/' + RubyApp.getData('locale', 'en') + '/elements/' + id + '.html'});
32
- request
33
- .success( function(content) {
34
- $('body').prepend(content);
35
- $.mobile.changePage($('#' + id), options);
36
- } );
37
- }
38
- },
39
- this.removePage = function(id) {
40
- $(document).on('pagehide.removePage', '#' + id, function(event) {
41
- $(document).off('pagehide.removePage', '#' + id);
42
- $(this).remove();
43
- });
44
- },
45
- this.updateElement = function(id) {
46
- request = $.ajax({type:'GET', url:'/' + RubyApp.getData('locale', 'en') + '/elements/' + id + '.html'});
47
- request
48
- .success( function(content) {
49
- $('#' + id).replaceWith(content);
50
- $('#' + id).parent().trigger('create');
51
- } );
52
- },
53
- this.createTrigger = function(id, interval) {
54
- RubyApp.destroyTrigger(id);
55
- $('#' + id)[0]._trigger = window.setInterval( function() {
56
- RubyApp.queueEvent({_class:'RubyApp::Element::TriggeredEvent', source:id});
57
- }, interval );
58
- },
59
- this.destroyTrigger = function(id) {
60
- if ($('#' + id)[0]._trigger != undefined) {
61
- window.clearInterval($('#' + id)[0]._trigger);
62
- $('#' + id)[0]._trigger = undefined;
63
- }
64
- },
65
- this.refreshBrowser = function() {
66
- $(window).clearQueue();
67
- location.assign(location.href);
68
- },
69
- this.confirmRefreshBrowser = function(message) {
70
- if (confirm(message))
71
- RubyApp.refreshBrowser();
72
- },
73
- this.go = function(url) {
74
- location.assign(url);
75
- },
76
- this.addClass = function(selector, _class) {
77
- $(selector).addClass(_class);
78
- },
79
- this.removeClass = function(selector, _class) {
80
- $(selector).removeClass(_class);
81
- },
82
- this.updateText = function(selector, value) {
83
- $(selector).text(value);
84
- },
85
- this.updateValue = function(selector, value) {
86
- $(selector).val(value);
87
- },
88
- this.updateValueFor = function(selector, value) {
89
- var _for = $(selector).attr('for');
90
- RubyApp.updateValue('#' + _for, value);
91
- RubyApp.change('#' + _for, value);
92
- },
93
- this.setCookie = function(name, value, expires) {
94
- document.cookie = name + '=' + value + '; expires=' + expires.toUTCString();
95
- },
96
- this.tap = function(selector) {
97
- $(selector).tap();
98
- },
99
- this.change = function(selector) {
100
- $(selector).change();
101
- },
102
- this.assertExists = function(selector) {
103
- RubyApp.assert('selector=' + selector, $(selector).length > 0);
104
- },
105
- this.assertExistsFor = function(selector) {
106
- var _for = $(selector).attr('for');
107
- RubyApp.assert('selector=' + selector + ', for=' + _for, $('#' + _for).length > 0);
108
- },
109
- this.assertExistsValueFor = function(selector, value) {
110
- var _for = $(selector).attr('for');
111
- var _value = $('#' + _for).val();
112
- RubyApp.assert('selector=' + selector + ', for=' + _for + ', value=' + value, _value == value);
113
- },
114
- this.assert = function(name, value) {
115
- RubyApp.queueEvent({_class:'RubyApp::Element::AssertedEvent', source:$('html').attr('id'), name:name, value:value});
116
- },
117
- this.getData = function(name, _default) {
118
- var value = $('meta[name="' + name + '"]').attr('content');
119
- return value == undefined ? _default : value;
120
- },
121
- this.log = function(message) {
122
- console.log(message);
123
- }
124
- };
125
-
126
- $(window).load(function() {
127
- RubyApp.queueEvent({_class:'RubyApp::Elements::Mobile::Document::LoadedEvent', source:$('html').attr('id')});
128
- });
129
-
@@ -1,129 +0,0 @@
1
- // /Users/frank.ficnar/Dropbox/Projects/gems/ruby_app/lib/ruby_app/elements/mobile/document.js.haml
2
- var RubyApp = new function() {
3
- this.queueEvent = function(event) {
4
- event.now = new Date().toString();
5
- event.session = RubyApp.getData('session', null);
6
- $(window).queue( function() {
7
- RubyApp.log('RubyApp.queueEvent(...) DEQUEUE event.class=' + event._class);
8
- request = $.ajax({type:'POST', url:location.href, data:event});
9
- request
10
- .success( function(event) {
11
- $.each(event.statements, function(index, statement) {
12
- RubyApp.log('RubyApp.queueEvent(...) EVAL statement="' + statement + '"')
13
- eval(statement);
14
- } );
15
- } )
16
- .error( function(request, message, exception) {
17
- RubyApp.log('RubyApp.queueEvent(...) ERROR event.class=' + event._class +' message=' + message);
18
- RubyApp.confirmRefreshBrowser(RubyApp.getData('event_error_message', null));
19
- } )
20
- .complete( function() {
21
- $(window).dequeue();
22
- } )
23
- } );
24
- },
25
- this.showPage = function(id, options) {
26
- $(window).clearQueue();
27
- if ($('#' + id).length)
28
- $.mobile.changePage($('#' + id), options);
29
- else
30
- {
31
- request = $.ajax({type:'GET', url:'/' + RubyApp.getData('locale', 'en') + '/elements/' + id + '.html'});
32
- request
33
- .success( function(content) {
34
- $('body').prepend(content);
35
- $.mobile.changePage($('#' + id), options);
36
- } );
37
- }
38
- },
39
- this.removePage = function(id) {
40
- $(document).on('pagehide.removePage', '#' + id, function(event) {
41
- $(document).off('pagehide.removePage', '#' + id);
42
- $(this).remove();
43
- });
44
- },
45
- this.updateElement = function(id) {
46
- request = $.ajax({type:'GET', url:'/' + RubyApp.getData('locale', 'en') + '/elements/' + id + '.html'});
47
- request
48
- .success( function(content) {
49
- $('#' + id).replaceWith(content);
50
- $('#' + id).parent().trigger('create');
51
- } );
52
- },
53
- this.createTrigger = function(id, interval) {
54
- RubyApp.destroyTrigger(id);
55
- $('#' + id)[0]._trigger = window.setInterval( function() {
56
- RubyApp.queueEvent({_class:'RubyApp::Element::TriggeredEvent', source:id});
57
- }, interval );
58
- },
59
- this.destroyTrigger = function(id) {
60
- if ($('#' + id)[0]._trigger != undefined) {
61
- window.clearInterval($('#' + id)[0]._trigger);
62
- $('#' + id)[0]._trigger = undefined;
63
- }
64
- },
65
- this.refreshBrowser = function() {
66
- $(window).clearQueue();
67
- location.assign(location.href);
68
- },
69
- this.confirmRefreshBrowser = function(message) {
70
- if (confirm(message))
71
- RubyApp.refreshBrowser();
72
- },
73
- this.go = function(url) {
74
- location.assign(url);
75
- },
76
- this.addClass = function(selector, _class) {
77
- $(selector).addClass(_class);
78
- },
79
- this.removeClass = function(selector, _class) {
80
- $(selector).removeClass(_class);
81
- },
82
- this.updateText = function(selector, value) {
83
- $(selector).text(value);
84
- },
85
- this.updateValue = function(selector, value) {
86
- $(selector).val(value);
87
- },
88
- this.updateValueFor = function(selector, value) {
89
- var _for = $(selector).attr('for');
90
- RubyApp.updateValue('#' + _for, value);
91
- RubyApp.change('#' + _for, value);
92
- },
93
- this.setCookie = function(name, value, expires) {
94
- document.cookie = name + '=' + value + '; expires=' + expires.toUTCString();
95
- },
96
- this.tap = function(selector) {
97
- $(selector).tap();
98
- },
99
- this.change = function(selector) {
100
- $(selector).change();
101
- },
102
- this.assertExists = function(selector) {
103
- RubyApp.assert('selector=' + selector, $(selector).length > 0);
104
- },
105
- this.assertExistsFor = function(selector) {
106
- var _for = $(selector).attr('for');
107
- RubyApp.assert('selector=' + selector + ', for=' + _for, $('#' + _for).length > 0);
108
- },
109
- this.assertExistsValueFor = function(selector, value) {
110
- var _for = $(selector).attr('for');
111
- var _value = $('#' + _for).val();
112
- RubyApp.assert('selector=' + selector + ', for=' + _for + ', value=' + value, _value == value);
113
- },
114
- this.assert = function(name, value) {
115
- RubyApp.queueEvent({_class:'RubyApp::Element::AssertedEvent', source:$('html').attr('id'), name:name, value:value});
116
- },
117
- this.getData = function(name, _default) {
118
- var value = $('meta[name="' + name + '"]').attr('content');
119
- return value == undefined ? _default : value;
120
- },
121
- this.log = function(message) {
122
- console.log(message);
123
- }
124
- };
125
-
126
- $(window).load(function() {
127
- RubyApp.queueEvent({_class:'RubyApp::Elements::Mobile::Document::LoadedEvent', source:$('html').attr('id')});
128
- });
129
-
@@ -1,129 +0,0 @@
1
- // /Users/frank.ficnar/Dropbox/Projects/gems/ruby_app/lib/ruby_app/elements/mobile/document.js.haml
2
- var RubyApp = new function() {
3
- this.queueEvent = function(event) {
4
- event.now = new Date().toString();
5
- event.session = RubyApp.getData('session', null);
6
- $(window).queue( function() {
7
- RubyApp.log('RubyApp.queueEvent(...) DEQUEUE event.class=' + event._class);
8
- request = $.ajax({type:'POST', url:location.href, data:event});
9
- request
10
- .success( function(event) {
11
- $.each(event.statements, function(index, statement) {
12
- RubyApp.log('RubyApp.queueEvent(...) EVAL statement="' + statement + '"')
13
- eval(statement);
14
- } );
15
- } )
16
- .error( function(request, message, exception) {
17
- RubyApp.log('RubyApp.queueEvent(...) ERROR event.class=' + event._class +' message=' + message);
18
- RubyApp.confirmRefreshBrowser(RubyApp.getData('event_error_message', null));
19
- } )
20
- .complete( function() {
21
- $(window).dequeue();
22
- } )
23
- } );
24
- },
25
- this.showPage = function(id, options) {
26
- $(window).clearQueue();
27
- if ($('#' + id).length)
28
- $.mobile.changePage($('#' + id), options);
29
- else
30
- {
31
- request = $.ajax({type:'GET', url:'/' + RubyApp.getData('locale', 'en') + '/elements/' + id + '.html'});
32
- request
33
- .success( function(content) {
34
- $('body').prepend(content);
35
- $.mobile.changePage($('#' + id), options);
36
- } );
37
- }
38
- },
39
- this.removePage = function(id) {
40
- $(document).on('pagehide.removePage', '#' + id, function(event) {
41
- $(document).off('pagehide.removePage', '#' + id);
42
- $(this).remove();
43
- });
44
- },
45
- this.updateElement = function(id) {
46
- request = $.ajax({type:'GET', url:'/' + RubyApp.getData('locale', 'en') + '/elements/' + id + '.html'});
47
- request
48
- .success( function(content) {
49
- $('#' + id).replaceWith(content);
50
- $('#' + id).parent().trigger('create');
51
- } );
52
- },
53
- this.createTrigger = function(id, interval) {
54
- RubyApp.destroyTrigger(id);
55
- $('#' + id)[0]._trigger = window.setInterval( function() {
56
- RubyApp.queueEvent({_class:'RubyApp::Element::TriggeredEvent', source:id});
57
- }, interval );
58
- },
59
- this.destroyTrigger = function(id) {
60
- if ($('#' + id)[0]._trigger != undefined) {
61
- window.clearInterval($('#' + id)[0]._trigger);
62
- $('#' + id)[0]._trigger = undefined;
63
- }
64
- },
65
- this.refreshBrowser = function() {
66
- $(window).clearQueue();
67
- location.assign(location.href);
68
- },
69
- this.confirmRefreshBrowser = function(message) {
70
- if (confirm(message))
71
- RubyApp.refreshBrowser();
72
- },
73
- this.go = function(url) {
74
- location.assign(url);
75
- },
76
- this.addClass = function(selector, _class) {
77
- $(selector).addClass(_class);
78
- },
79
- this.removeClass = function(selector, _class) {
80
- $(selector).removeClass(_class);
81
- },
82
- this.updateText = function(selector, value) {
83
- $(selector).text(value);
84
- },
85
- this.updateValue = function(selector, value) {
86
- $(selector).val(value);
87
- },
88
- this.updateValueFor = function(selector, value) {
89
- var _for = $(selector).attr('for');
90
- RubyApp.updateValue('#' + _for, value);
91
- RubyApp.change('#' + _for, value);
92
- },
93
- this.setCookie = function(name, value, expires) {
94
- document.cookie = name + '=' + value + '; expires=' + expires.toUTCString();
95
- },
96
- this.tap = function(selector) {
97
- $(selector).tap();
98
- },
99
- this.change = function(selector) {
100
- $(selector).change();
101
- },
102
- this.assertExists = function(selector) {
103
- RubyApp.assert('selector=' + selector, $(selector).length > 0);
104
- },
105
- this.assertExistsFor = function(selector) {
106
- var _for = $(selector).attr('for');
107
- RubyApp.assert('selector=' + selector + ', for=' + _for, $('#' + _for).length > 0);
108
- },
109
- this.assertExistsValueFor = function(selector, value) {
110
- var _for = $(selector).attr('for');
111
- var _value = $('#' + _for).val();
112
- RubyApp.assert('selector=' + selector + ', for=' + _for + ', value=' + value, _value == value);
113
- },
114
- this.assert = function(name, value) {
115
- RubyApp.queueEvent({_class:'RubyApp::Element::AssertedEvent', source:$('html').attr('id'), name:name, value:value});
116
- },
117
- this.getData = function(name, _default) {
118
- var value = $('meta[name="' + name + '"]').attr('content');
119
- return value == undefined ? _default : value;
120
- },
121
- this.log = function(message) {
122
- console.log(message);
123
- }
124
- };
125
-
126
- $(window).load(function() {
127
- RubyApp.queueEvent({_class:'RubyApp::Elements::Mobile::Document::LoadedEvent', source:$('html').attr('id')});
128
- });
129
-