ProMotion-XLForm 0.0.15 → 0.0.17

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: bdb1986018fcffdf8c45322d5d9efc70d9a47ef1
4
- data.tar.gz: fbc2a8ac3073bb74bf6fedd1e26e0fc96dc7d906
3
+ metadata.gz: 05c859ed838fdd140e797b1dcbe49c572398a592
4
+ data.tar.gz: 6c48299595d9d3324c4495169245c6339cb5adbb
5
5
  SHA512:
6
- metadata.gz: 4f2f6064a0d9cb7aabf0da03a97d6e0b5e6ded73dcba949d66b9ce254786d49cc71bb021f6d1c158792dfd63a5c50a716de375005afb1abbee6e88986636605d
7
- data.tar.gz: 52db2a4bc3ee8507ef7cf7e05363595440d86e46bf02eb7f1e482b52a7759cc523677960fb46b316cfd433b281ad4014213cfe2db59ceb47ca2e09bd12e546e7
6
+ metadata.gz: '0885792527bcbd81684b5bc5f9505c447a011fd3e27c9f14700c9d83cfd11522709a54b25a975bc71cc645f253baa71c6363d1f7df0e4a37350bb3d089933811'
7
+ data.tar.gz: 897df3976ae5e677566390e7370602eebf954bdd37769f54bfc21816c0640d2e532b0d9cd89a966169a589af18e5c5873fa6c2203fce256941e926674ce65d21
data/README.md CHANGED
@@ -77,6 +77,7 @@ end
77
77
  * :integer
78
78
  * :decimal
79
79
  * :textview
80
+ * :zip_code
80
81
  * :selector_push
81
82
  * :selector_popover
82
83
  * :selector_action_sheet
@@ -26,7 +26,7 @@ Motion::Project::App.setup do |app|
26
26
  app.files << File.join(lib_dir_path, "ProMotion/XLForm/ui_alert_controller.rb")
27
27
 
28
28
  app.pods do
29
- pod 'XLForm', git: 'https://github.com/xmartlabs/XLForm.git'
29
+ pod 'XLForm', '3.1.1'
30
30
  pod 'RSColorPicker'
31
31
  end
32
32
  end
@@ -60,6 +60,7 @@ module ProMotion
60
60
  integer: XLFormRowDescriptorTypeInteger,
61
61
  decimal: XLFormRowDescriptorTypeDecimal,
62
62
  textview: XLFormRowDescriptorTypeTextView,
63
+ zip_code: XLFormRowDescriptorTypeZipCode,
63
64
  selector_push: XLFormRowDescriptorTypeSelectorPush,
64
65
  selector_popover: XLFormRowDescriptorTypeSelectorPopover,
65
66
  selector_action_sheet: XLFormRowDescriptorTypeSelectorActionSheet,
@@ -44,7 +44,7 @@ module ProMotion
44
44
  cell.cellConfigAtConfigure.setObject(true, forKey: "stepControl.wraps")
45
45
  cell.cellConfigAtConfigure.setObject(min, forKey: "stepControl.minimumValue") if min
46
46
  cell.cellConfigAtConfigure.setObject(max, forKey: "stepControl.maximumValue") if max
47
- cell.cellConfigAtConfigure.setObject(step, forKey: "stepControl.maximumValue") if step
47
+ cell.cellConfigAtConfigure.setObject(step, forKey: "stepControl.stepValue") if step
48
48
  end
49
49
 
50
50
  # slider
@@ -11,36 +11,15 @@ module ProMotion
11
11
 
12
12
  form_options = self.class.get_form_options
13
13
 
14
- if form_options[:on_cancel]
15
- on_cancel = form_options[:on_cancel]
16
- title = NSLocalizedString('Cancel', nil)
17
- item = :cancel
18
- if on_cancel.is_a? Hash
19
- title = on_cancel[:title] if on_cancel[:title]
20
- item = on_cancel[:item] if on_cancel[:item]
21
- end
14
+ on_cancel = form_options[:on_cancel]
15
+ on_save = form_options[:on_save]
22
16
 
23
- set_nav_bar_button :left, {
24
- system_item: item,
25
- title: title,
26
- action: 'on_cancel:'
27
- }
17
+ if on_cancel
18
+ set_nav_bar_button :left, button_config(on_cancel, default_item: :cancel, action: 'on_cancel:')
28
19
  end
29
20
 
30
- if form_options[:on_save]
31
- on_cancel = form_options[:on_save]
32
- title = NSLocalizedString('Save', nil)
33
- item = :save
34
- if on_cancel.is_a? Hash
35
- title = on_cancel[:title] if on_cancel[:title]
36
- item = on_cancel[:item] if on_cancel[:item]
37
- end
38
-
39
- set_nav_bar_button :right, {
40
- system_item: item,
41
- title: title,
42
- action: 'on_save:'
43
- }
21
+ if on_save
22
+ set_nav_bar_button :right, button_config(on_save, default_item: :save, action: 'on_save:')
44
23
  end
45
24
 
46
25
  # support for RMQ stylesheet using `form_view`
@@ -53,6 +32,23 @@ module ProMotion
53
32
  self.form_added if self.respond_to?(:form_added)
54
33
  end
55
34
 
35
+ def button_config(user_config, opts = {})
36
+ button_config = { action: opts[:action] } # always call internal method before calling user-defined method
37
+
38
+ if user_config.is_a? Hash
39
+ title = user_config[:title]
40
+ item = user_config[:item] || user_config[:system_item]
41
+ end
42
+
43
+ if title
44
+ button_config[:title] = title
45
+ else
46
+ button_config[:system_item] = item || opts[:default_item]
47
+ end
48
+
49
+ set_nav_bar_button :right, button_config
50
+ end
51
+
56
52
  def form_data
57
53
  PM.logger.info "You need to implement a `form_data` method in #{self.class.to_s}."
58
54
  []
@@ -203,6 +199,7 @@ module ProMotion
203
199
  end
204
200
 
205
201
  protected
202
+
206
203
  def on_cancel(_)
207
204
  form_options = self.class.get_form_options
208
205
  if form_options[:on_cancel]
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.15
4
+ version: 0.0.17
5
5
  platform: ruby
6
6
  authors:
7
7
  - Benjamin Michotte
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-03-08 00:00:00.000000000 Z
11
+ date: 2018-03-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: ProMotion
@@ -126,7 +126,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
126
126
  version: '0'
127
127
  requirements: []
128
128
  rubyforge_project:
129
- rubygems_version: 2.4.5.1
129
+ rubygems_version: 2.6.13
130
130
  signing_key:
131
131
  specification_version: 4
132
132
  summary: Adds PM::XLFormScreen support to ProMotion, similar to ProMotion-form.