ProMotion-form 0.2.3 → 0.2.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/ProMotion-form.rb +1 -1
- data/lib/ProMotion/form/form.rb +17 -8
- data/lib/ProMotion/form/form_screen.rb +2 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b922948c52029bb1454414b2e927d91b440d6e43
|
4
|
+
data.tar.gz: e10fcd0f56e5e7c26aa9a5734becfb985d5c7829
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9d5cd76b789dff0ef1f5e0b4a3a2ac7817913bd30f84397daec58603373b50e911deefcf24506706c7654c2b014baa3704cb7b3a15342447e75a74b35b97909f
|
7
|
+
data.tar.gz: 58a88eb9ea2edf44d47c19b0e368c23d8c9afe1b6ba7f9ae666aa24b97927f0865cadfc2690066be1d3374405e1dd371f9623077bb6665568ea6f30f1f3f2529
|
data/lib/ProMotion-form.rb
CHANGED
data/lib/ProMotion/form/form.rb
CHANGED
@@ -25,11 +25,10 @@ module ProMotion
|
|
25
25
|
@fields ||= begin
|
26
26
|
header = nil
|
27
27
|
form_data.map do |section|
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
end
|
28
|
+
rows = Array(section[:cells]).map{ |input| input_data(input) }
|
29
|
+
rows.first[:header] = section[:title] if section[:title] && rows.length > 0
|
30
|
+
rows.last[:footer] = section[:footer] if section[:footer] && rows.length > 0
|
31
|
+
rows
|
33
32
|
end.flatten
|
34
33
|
end
|
35
34
|
end
|
@@ -39,16 +38,15 @@ module ProMotion
|
|
39
38
|
end
|
40
39
|
|
41
40
|
def values
|
42
|
-
fields.map{ |f| f
|
41
|
+
fields.map{ |f| get_value(f) }
|
43
42
|
end
|
44
43
|
|
45
44
|
def form_fields
|
46
45
|
fields.map{ |f| f.dup.tap{|f2| f2.delete(:value) } }
|
47
46
|
end
|
48
47
|
|
49
|
-
def input_data(input
|
48
|
+
def input_data(input)
|
50
49
|
data = {}
|
51
|
-
data[:header] = header if header
|
52
50
|
data[:key] = input[:name] || input[:title].downcase.gsub(/[^0-9a-z]/i, '_').to_sym
|
53
51
|
data[:type] = input[:type] if input[:type]
|
54
52
|
data[:title] = input[:label] || input[:title] || input[:name].to_s
|
@@ -57,8 +55,19 @@ module ProMotion
|
|
57
55
|
data[:default] = input[:default] if input[:default]
|
58
56
|
data[:value] = input[:value] if input[:value]
|
59
57
|
data[:action] = input[:action] if input[:action]
|
58
|
+
data[:cell] = input[:cell_class] if input[:cell_class]
|
60
59
|
data
|
61
60
|
end
|
61
|
+
|
62
|
+
def get_value(f)
|
63
|
+
f[:value] || begin
|
64
|
+
case f[:type]
|
65
|
+
when :date then NSDate.date
|
66
|
+
when :time then NSDate.date
|
67
|
+
else ""
|
68
|
+
end
|
69
|
+
end
|
70
|
+
end
|
62
71
|
end
|
63
72
|
end
|
64
73
|
|
@@ -5,8 +5,8 @@ module ProMotion
|
|
5
5
|
attr_reader :form_object
|
6
6
|
|
7
7
|
def viewDidLoad
|
8
|
-
update_form_data
|
9
8
|
super
|
9
|
+
update_form_data
|
10
10
|
end
|
11
11
|
|
12
12
|
def form_data
|
@@ -18,6 +18,7 @@ module ProMotion
|
|
18
18
|
@form_object = PM::Form.new(self.form_data).build
|
19
19
|
self.formController.form = @form_object
|
20
20
|
self.formController.delegate = self
|
21
|
+
self.view.reloadData
|
21
22
|
end
|
22
23
|
|
23
24
|
def dismiss_keyboard
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ProMotion-form
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jamon Holmgren
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-10-
|
11
|
+
date: 2014-10-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: ProMotion
|