ProMotion-form 0.3.0 → 0.3.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +18 -5
  3. data/lib/ProMotion/form/form.rb +11 -0
  4. metadata +3 -3
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: a9e98a207439d8f6f934f0cf7e0ad64b0b856158
4
- data.tar.gz: 35513b987a9c722aa6c4df7de95d5c0dbf5cd66e
3
+ metadata.gz: 8a5e782943d995a200866bab9067db1a937cbb69
4
+ data.tar.gz: b9a0527f77ced2d3eb4a0072e27b5d83016c23fc
5
5
  SHA512:
6
- metadata.gz: 2dc1a5e2e9fd723142c4fbd53de5412669a36a963b7a68fe758f2e21cf319f64d2f0138fffedd85830814ca7adba7ac9557cb3e14937321d7133abed1f4a4bf7
7
- data.tar.gz: 57e88697ef4ce65a8d8b7b5df6023056dc89562223c7f8269f1222a2eda683b3fc349b674271e3b000058687d76c4a40063e6a333f296a96c1d18a301e74a7d5
6
+ metadata.gz: 9bf7baa4f40e171f977a97e7d65db23599ae94178ec8dfe939679d48f888de578d325200fefee00d46804ad66d56ccc8f8263582aacce1178b3db37b24a6d034
7
+ data.tar.gz: 07ceb43547db03ba16c15231c404546de764458d7f687ee8fd5fa47145bd215ac9a9743a842917e48b322e71558d23a6b943f0290ddebbfd6d80512a13d46d2a
data/README.md CHANGED
@@ -39,11 +39,13 @@ class MyFormScreen < PM::FormScreen
39
39
  title: "ID",
40
40
  type: :email,
41
41
  value: current_user.email,
42
+ image: UIImage.imageNamed('email_icon')
42
43
  }, {
43
44
  name: "password",
44
45
  title: "New Password",
45
46
  type: :password,
46
- value: ""
47
+ value: "",
48
+ image: UIImage.imageNamed('key_icon')
47
49
  }]
48
50
  }]
49
51
  end
@@ -80,6 +82,16 @@ class MyFormScreen < PM::FormScreen
80
82
  end
81
83
  ```
82
84
 
85
+ #### Parity with ProMotion::TableScreen
86
+
87
+ Ongoing work is being done to bring ProMotion-form cell hashes in-line with what you can do with [PM::TableScreen](https://github.com/clearsightstudio/ProMotion/wiki/Reference%3A-All-available-table_data-options).
88
+
89
+ Currently you can set:
90
+
91
+ ```ruby
92
+ image: '' # An instance of UIImage or a string of the name of the image in your /resources folder
93
+ ```
94
+
83
95
  ### What about Formotion?
84
96
 
85
97
  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.
@@ -132,8 +144,6 @@ Additional "helper" field properties have been started, and are listed below:
132
144
  * `name` - a convenience alias to FXForms `key`. If no name is provided, title is converted to a symbol and used as the key.
133
145
  * `title` - when no title is provided, label and then name are used respectively.
134
146
  * `cell_class` - a convenience alias to FXForms `cell`, but with the ProMotion naming scheme.
135
- }
136
- ```
137
147
 
138
148
  Here are sample form fields with some explanation
139
149
 
@@ -141,12 +151,15 @@ Here are sample form fields with some explanation
141
151
  {
142
152
  label: "Name", # or title
143
153
  name: :name, # defaults to symbol of snake_cased label/title
144
- type: :string, # :default is default...like a button
154
+ type: :text, # :default is default...like a button
145
155
  options: [ "Water", "Fire", "Wind" ], # for a subform select (`type` can be anything)
146
156
  placeholder: "Your name",
147
157
  default: "Jamon", # Coming soon
148
158
  value: "Jamon Holmgren",
149
- action: :"my_action:" # use symbol literal with trailing colon due to Obj-C semantics
159
+ action: :"my_action:", # use symbol literal with trailing colon due to Obj-C semantics,
160
+ class: NSArray, # explicitly set the class of the field value
161
+ template: { type: :image }, # set the field types of a collection (`class` must be NSArray or NSOrderedSet)
162
+ sortable: true, # make the field sortable (`class` must be NSArray or NSOrderedSet)
150
163
  }
151
164
  ```
152
165
 
@@ -48,6 +48,16 @@ module ProMotion
48
48
  def input_data(input)
49
49
  data = {}
50
50
 
51
+ # check for ProMotion helpers
52
+ if input[:image]
53
+ input[:properties] ||= {}
54
+ cell_image = input.delete(:image)
55
+ cell_image = UIImage.imageNamed(cell_image) if cell_image.is_a?(String)
56
+
57
+ input[:properties]['imageView.image'] = cell_image
58
+ input[:properties]['imageView.layer.masksToBounds'] = true
59
+ end
60
+
51
61
  # process "before" helper keys
52
62
  data.update(FormStyle.to_style(input[:properties])) if input[:properties]
53
63
  data.update(FormStyle.to_style(input[:style ])) if input[:style ]
@@ -69,6 +79,7 @@ module ProMotion
69
79
  case f[:type]
70
80
  when :date then NSDate.date
71
81
  when :time then NSDate.date
82
+ when :datetime then NSDate.date
72
83
  else ""
73
84
  end
74
85
  end
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.3.0
4
+ version: 0.3.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-11-24 00:00:00.000000000 Z
11
+ date: 2015-05-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: ProMotion
@@ -114,7 +114,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
114
114
  version: '0'
115
115
  requirements: []
116
116
  rubyforge_project:
117
- rubygems_version: 2.2.2
117
+ rubygems_version: 2.4.6
118
118
  signing_key:
119
119
  specification_version: 4
120
120
  summary: Adds PM::FormScreen support to ProMotion, similar to Formotion but lighter.