ProMotion-XLForm 0.0.3 → 0.0.4

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
  SHA1:
3
- metadata.gz: 55924720d004b7e0a3e9bf60576b3803ef96cfbb
4
- data.tar.gz: abf8c29c048a7db559d0decee91fdde5adaaf616
3
+ metadata.gz: 16f266fe44d16f2b3dbba9d3a854e57b61096782
4
+ data.tar.gz: b392bad7840ec083954aeb5938c7f508cd7a3252
5
5
  SHA512:
6
- metadata.gz: 89a3c12aa9d571911681e0b54a85a91602218c5534c3c7fceaea08d4dadddf691957478cfd6a4dad4af0eb826556118f328b75c88b19f109b7b015393aac4ff5
7
- data.tar.gz: fe7a80cedbebf1ecfcf1c540744f2bb5519ae978ea136c5d4e659d72a2df18c0a15c661abd399cd86faedf011d332a01b429dd66cfd0fa7cc14bc9c792991bd7
6
+ metadata.gz: 2e2cec121337790d06be52097d7cc6df47b6a9c5afdbb204d559d17b38a6a0d0cfc52ff9d751e88c5ac7d80ce5330cee3aaab0c7f8c37ca37f69c4a3a3c5b588
7
+ data.tar.gz: 7c7135483141be1e1f1285568c0095301b7208e0fa7c15d8b607836f1f79a29b8972b59693d1505b8a417abbe6d5464fe3cfa298d115b78a28f2386df9a3775a
@@ -9,6 +9,7 @@ module ProMotion
9
9
  end
10
10
 
11
11
  def transformedValue(value)
12
+ return self.transformed_value(value) if self.respond_to?(:transformed_value)
12
13
  return nil if value.nil?
13
14
 
14
15
  # best effort
@@ -112,12 +112,11 @@ module ProMotion
112
112
  add_proc cell, :on_remove, cell_data[:on_remove] if cell_data[:on_remove]
113
113
 
114
114
  cell.selectorTitle = cell_data[:selector_title] if cell_data[:selector_title]
115
- options = parse_options(cell_data[:options])
116
- cell.selectorOptions = options
115
+ cell.options = cell_data[:options]
117
116
 
118
117
  value = cell_data[:value]
119
- if value and options
120
- options.each do |opt|
118
+ if value and cell.selectorOptions
119
+ cell.selectorOptions.each do |opt|
121
120
  if opt.formValue == value
122
121
  value = opt
123
122
  break
@@ -190,18 +189,6 @@ module ProMotion
190
189
  @blocks[tag][event] = block.respond_to?('weak!') ? block.weak! : block
191
190
  end
192
191
 
193
- def parse_options(options)
194
- return nil if options.nil? or options.empty?
195
-
196
- options.map do |key, text|
197
- val = key
198
- if val.is_a? Symbol
199
- val = val.to_s
200
- end
201
- XLFormOptionsObject.formOptionsObjectWithValue(val, displayText: text)
202
- end
203
- end
204
-
205
192
  def parse_section_options(options)
206
193
  return section_options(:none) if options.nil?
207
194
 
@@ -26,4 +26,20 @@ class XLFormRowDescriptor
26
26
  row_descriptor_copy
27
27
  end
28
28
 
29
- end
29
+ def options=(options)
30
+ self.selectorOptions = parse_options(options)
31
+ end
32
+
33
+ def parse_options(options)
34
+ return nil if options.nil? or options.empty?
35
+
36
+ options.map do |key, text|
37
+ val = key
38
+ if val.is_a? Symbol
39
+ val = val.to_s
40
+ end
41
+ XLFormOptionsObject.formOptionsObjectWithValue(val, displayText: text)
42
+ end
43
+ end
44
+
45
+ end
@@ -225,8 +225,17 @@ module ProMotion
225
225
 
226
226
  def formRowDescriptorValueHasChanged(row, oldValue: old_value, newValue: new_value)
227
227
  super
228
+
228
229
  callback = @form_builder.get_callback(row, :on_change)
229
- callback.call(old_value, new_value) if callback
230
+ if callback
231
+ if old_value.is_a? XLFormOptionsObject
232
+ old_value = old_value.formValue
233
+ end
234
+ if new_value.is_a? XLFormOptionsObject
235
+ new_value = new_value.formValue
236
+ end
237
+ callback.call(old_value, new_value)
238
+ end
230
239
  end
231
240
 
232
241
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ProMotion-XLForm
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Benjamin Michotte
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-07-25 00:00:00.000000000 Z
11
+ date: 2015-07-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: ProMotion