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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: dcb416dc082b4d3f8cabffafa1022c91388d41ef
4
- data.tar.gz: 53d0c17cbcf4153f7ac2a03db88b635d281dd5de
3
+ metadata.gz: b922948c52029bb1454414b2e927d91b440d6e43
4
+ data.tar.gz: e10fcd0f56e5e7c26aa9a5734becfb985d5c7829
5
5
  SHA512:
6
- metadata.gz: 578b3ea509bfa6d463f1e928e2756977d51639563f47d652855640cd3829ffd307af758983d9fc49e0640942e5529f2180f5efe0ad60370111008ecd994aed41
7
- data.tar.gz: 84e44e8082b035e25d68ed4a7310a56cbb37442b5479475251d56b42e8f17915f3566b6b7a7336cb6dfc259a8dea0807a7df3c88eaafb87fee8549ef625f0687
6
+ metadata.gz: 9d5cd76b789dff0ef1f5e0b4a3a2ac7817913bd30f84397daec58603373b50e911deefcf24506706c7654c2b014baa3704cb7b3a15342447e75a74b35b97909f
7
+ data.tar.gz: 58a88eb9ea2edf44d47c19b0e368c23d8c9afe1b6ba7f9ae666aa24b97927f0865cadfc2690066be1d3374405e1dd371f9623077bb6665568ea6f30f1f3f2529
@@ -11,6 +11,6 @@ Motion::Project::App.setup do |app|
11
11
  app.files << File.join(lib_dir_path, "ProMotion/form/form_screen.rb")
12
12
 
13
13
  app.pods do
14
- pod "FXForms"
14
+ pod "FXForms", "~> 1.2"
15
15
  end
16
16
  end
@@ -25,11 +25,10 @@ module ProMotion
25
25
  @fields ||= begin
26
26
  header = nil
27
27
  form_data.map do |section|
28
- header = section[:title]
29
- footer = section[:footer]
30
- Array(section[:cells]).map do |input|
31
- input_data(input, header, footer).tap{|i| header = nil; footer = nil }
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[:value] }
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, header, footer)
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.3
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-25 00:00:00.000000000 Z
11
+ date: 2014-10-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: ProMotion