ProMotion-form 0.1.0 → 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +11 -9
  3. data/lib/ProMotion/form/form.rb +3 -80
  4. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 249ed0437919e6d2e6009b22b9fd5d8f0308e90d
4
- data.tar.gz: 7aab1a9d1f85b7fbc1915991ac961700f6701778
3
+ metadata.gz: 81b4b3d375ca469f74c535c14dacef688d57ee6d
4
+ data.tar.gz: eec689e725e021133138431980aa7f8c7120b34e
5
5
  SHA512:
6
- metadata.gz: 24382d8bfb44a856369711a19655f931d0fe09b6d49fba189e585eb17faee13d1d449c3900a8de2625643e5b35b02280ee92026735b1c4465ddff6cfb268ac73
7
- data.tar.gz: f8ec1bf1e37cd5305be0fa663be32d8dd3fa428e7cda04d205ea8dd610b80eed030600479b633d148abcfcc5f2f4a1aeb9a35ff8c1f38422bf1d9b1c87661d00
6
+ metadata.gz: a0e009a06a0a400f591d1eb8a46dc6579b367fdff285458af0782a555ad8c293b64d7d684906050d1201458f4b3d5f0a7fbb5e16e58802509b0cff2bf6beab09
7
+ data.tar.gz: c6f4fef2bf42a1e8f27749a4947840a2ee7df345b4e27c21d7064cfe395ff20a9a84f0382a894a55f6fe36fb96d7c126bbf311140a3bf0c7f25e32204904e36b
data/README.md CHANGED
@@ -33,6 +33,7 @@ class MyFormScreen < PM::FormScreen
33
33
  def form_data
34
34
  [{
35
35
  title: "Account Information",
36
+ footer: "Some help text",
36
37
  cells: [{
37
38
  name: "email",
38
39
  title: "ID",
@@ -50,9 +51,9 @@ class MyFormScreen < PM::FormScreen
50
51
  end
51
52
  ```
52
53
 
53
- ### Why not Formotion?
54
+ ### What about Formotion?
54
55
 
55
- We've used and like Formotion for some form-heavy apps, but it's a rather bulky gem. ProMotion-form works better with ProMotion and is a lot lighter.
56
+ We have used and like Formotion for some form-heavy apps, but it's a rather bulky gem. ProMotion-form works better with ProMotion and is a lot smaller.
56
57
 
57
58
  ---
58
59
 
@@ -69,6 +70,7 @@ class AccountScreen < PM::FormScreen
69
70
  def form_data
70
71
  [{
71
72
  title: "Account Information",
73
+ footer: "Help text here",
72
74
  cells: [{
73
75
  name: "email",
74
76
  title: "ID",
@@ -94,18 +96,18 @@ class AccountScreen < PM::FormScreen
94
96
  end
95
97
  ```
96
98
 
97
- All possible properties:
99
+ All possible form field properties:
98
100
 
99
101
  ```ruby
100
102
  {
101
103
  label: "Name", # or title:
102
104
  name: :name, # required
103
- type: :string, # :default is default...
104
- options: [ "Water", "Fire", "Wind" ], # for :option type
105
+ type: :string, # :default is default...like a button
106
+ options: [ "Water", "Fire", "Wind" ], # for a subform select (`type` can be anything)
105
107
  placeholder: "Your name",
106
- default: "Jamon",
108
+ default: "Jamon", # Coming soon
107
109
  value: "Jamon Holmgren",
108
- action: :"my_action:" # use symbol literal with trailing colon
110
+ action: :"my_action:" # use symbol literal with trailing colon due to Obj-C semantics
109
111
  }
110
112
  ```
111
113
 
@@ -117,11 +119,11 @@ All possible properties:
117
119
  * `:longtext`
118
120
  * `:url`
119
121
  * `:email`
120
- * `:phone`
122
+ * `:phone` - Coming soon
121
123
  * `:password`
122
124
  * `:number`
123
125
  * `:integer`
124
- * `:unsigned`
126
+ * `:unsigned` - Coming soon
125
127
  * `:float`
126
128
  * `:bitfield`
127
129
  * `:boolean`
@@ -26,8 +26,9 @@ module ProMotion
26
26
  header = nil
27
27
  form_data.map do |section|
28
28
  header = section[:title]
29
+ footer = section[:footer]
29
30
  Array(section[:cells]).map do |input|
30
- input_data(input, header).tap{|i| header = nil }
31
+ input_data(input, header, footer).tap{|i| header = nil; footer = nil }
31
32
  end
32
33
  end.flatten
33
34
  end
@@ -45,7 +46,7 @@ module ProMotion
45
46
  fields.map{ |f| f.dup.tap{|f2| f2.delete(:value) } }
46
47
  end
47
48
 
48
- def input_data(input, header)
49
+ def input_data(input, header, footer)
49
50
  data = {}
50
51
  data[:header] = header if header
51
52
  data[:key] = input.fetch(:name)
@@ -58,84 +59,6 @@ module ProMotion
58
59
  data[:action] = input[:action] if input[:action]
59
60
  data
60
61
  end
61
-
62
- def example_fields
63
- [
64
- {
65
- key: "email",
66
- header: "Account",
67
- type: :email
68
- },
69
- {
70
- key: "password",
71
- type: :password
72
- },
73
- "repeatPassword",
74
- {
75
- key: "name",
76
- header: "Details",
77
- # "textField.autocapitalizationType" => UITextAutocapitalizationTypeWords
78
- },
79
- {
80
- key: "gender",
81
- options: [ "Male", "Female", "It's Complicated" ]
82
- },
83
- "dateOfBirth",
84
- "profilePhoto",
85
- "phone",
86
- {
87
- key: "country",
88
- options: [ "us", "ca", "gb", "sa", "be"],
89
- # default: "us",
90
- # valueTransformer: ISO3166CountryValueTransformer.alloc.init
91
- },
92
- {
93
- key: "language",
94
- options: [ "English", "Spanish", "French", "Dutch" ],
95
- # default: "English",
96
- # cell: FXFormOptionPickerCell
97
- },
98
- {
99
- key: "interests",
100
- # default: "Videogames",
101
- options: [ "Videogames", "Animals", "Cooking" ]
102
- },
103
- {
104
- key: "otherInterests",
105
- type: :bitfield,
106
- # default: "InterestComputers",
107
- options: [ "Computers", "Socializing", "Sports" ]
108
- },
109
- {
110
- key: "about",
111
- type: :longtext,
112
- placeholder: "Text..."
113
- },
114
- {
115
- header: "Plan",
116
- key: "plan",
117
- title: "",
118
- placeholder: "Free",
119
- options: [ "Micro", "Normal", "Maxi" ],
120
- # cell: FXFormOptionSegmentsCell
121
- },
122
- {
123
- key: "termsAndConditions",
124
- header: "Legal"
125
- },
126
- "privacyPolicy",
127
- {
128
- key: "agreedToTerms",
129
- title: "I Agree To These Terms",
130
- type: :option
131
- },
132
- {
133
- title: "Submit",
134
- header: "",
135
- action: "submitRegistrationForm:"
136
- },
137
- ]
138
- end
139
62
  end
140
63
  end
141
64
 
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.1.0
4
+ version: 0.1.1
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-08-30 00:00:00.000000000 Z
11
+ date: 2014-09-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: ProMotion