jsajax_wizard 0.2.0 → 0.2.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 2e5f24b2ebcacd9a7ee478e85a59a75c2c35beec64d73b9a8760d8619a348dcf
4
- data.tar.gz: 76c372f959a84223e54aead55212874516f7cf1f6d16bf751f592d5eef15ce28
3
+ metadata.gz: 4238870adbe4854914ad49fa84eb800431c57897f12022b9e5f8c16806e03c80
4
+ data.tar.gz: 46604e0fce9e1c6343e0f07f67ec4508bc606d730830cb84340414b69cfbcfc3
5
5
  SHA512:
6
- metadata.gz: 395c6ec4bb623457c154fd7bde1190f7e3bd6e9e31db65c814fb1db36e9974672652c67dea78c1582afb22a5d5aed8de4ce2415dcbdfe3a0d60f3132c921711c
7
- data.tar.gz: c4b783ec09d4b5bb2e574b03f9c9f11f2e2de1bfa91a436da9e78a30131ed946e64aa48574892986e6eb43a3f1b5420248fdb0ef70067a56b3e60a440387dacf
6
+ metadata.gz: b2daebf40564434ceb951a70328ed57b5a7fa4c1cc952b977937f1bfeb24e4b8ad8a26b95718ede4c2b9e8e15913061283e78984c404e9f3e00f2617c8f097d7
7
+ data.tar.gz: 957f30ca97421af559736cc1d22ece748d160fea34a36f5870133df9b13f0d2e68f5aa3029fd3a41a02df387c384cafc3e1e4df7ac8fdff7e32f6acf46c75148
checksums.yaml.gz.sig CHANGED
Binary file
data/lib/jsajax_wizard.rb CHANGED
@@ -4,6 +4,24 @@
4
4
 
5
5
  # description: Makes building an AJAX web page easier than
6
6
  # copying and pasting an example.
7
+ # examples:
8
+ #
9
+ # jaw = JsAjaxWizard.new
10
+ #
11
+ #
12
+ # AJAX triggered from a button press
13
+ # jaw.add_request server: 'hello', element: {type: 'button',
14
+ # event: 'onclick'}, target_element: {id: 'demo', property: :innerHTML}
15
+ #
16
+ # AJAX triggered from an onkeyup event
17
+ # jaw.add_request server: 'hello', element: {type: 'text'},
18
+ # target_element: {id: 'demo', property: :innerHTML}
19
+ #
20
+ # AJAX triggered from a timer event
21
+ # jaw.add_request server: 'hello', element: {type: 'timer',
22
+ # interval: '5000'}, target_element: {id: 'demo', property: :innerHTML}
23
+
24
+
7
25
 
8
26
  require 'rexle'
9
27
  require 'rexle-builder'
@@ -56,6 +74,7 @@ class JsAjaxWizard
56
74
  end
57
75
 
58
76
  e = doc.at_css(selector)
77
+ next unless e
59
78
  puts ('e: ' + e.inspect).debug if @debug
60
79
 
61
80
  func = 'ajaxCall' + (i+1).to_s
@@ -101,7 +120,7 @@ class JsAjaxWizard
101
120
  ["<input type='text'/>"]
102
121
 
103
122
  else
104
- ''
123
+ ['']
105
124
  end
106
125
 
107
126
  a << "<div id='%s'></div>" % [e2[:id]]
@@ -163,8 +182,7 @@ function ajaxCall#{i+1}(keyCode, e) {
163
182
 
164
183
  if (keyCode==13){
165
184
  ajaxRequest('#{server}' + e.value, ajaxResponse#{i+1})
166
- }
167
-
185
+ }
168
186
 
169
187
  }
170
188
  "
@@ -176,6 +194,13 @@ function ajaxCall#{i+1}(e) {
176
194
  "
177
195
  end
178
196
 
197
+ elsif element[:type] == 'timer'
198
+ "
199
+ setInterval(
200
+ function() {
201
+ ajaxRequest('#{server}', ajaxResponse#{i+1})
202
+ }, #{element[:interval]});
203
+ "
179
204
  else
180
205
  "
181
206
  function ajaxCall#{i+1}() {
data.tar.gz.sig CHANGED
Binary file
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jsajax_wizard
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - James Robertson
@@ -35,7 +35,7 @@ cert_chain:
35
35
  pZTsghadsRxoGiI7mehrgxkeLLA7q3Zpafsvw3mLrERdifNsVFNBUDMjfE/OnJq8
36
36
  EOz+UVQEw8EJ9wHqaJYIbHBq
37
37
  -----END CERTIFICATE-----
38
- date: 2019-08-09 00:00:00.000000000 Z
38
+ date: 2019-08-24 00:00:00.000000000 Z
39
39
  dependencies:
40
40
  - !ruby/object:Gem::Dependency
41
41
  name: rexle
metadata.gz.sig CHANGED
Binary file