formotion 0.0.1 → 0.0.2
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.
- data/README.md +6 -6
- data/lib/formotion.rb +6 -3
- data/lib/formotion/form_controller.rb +9 -4
- data/lib/formotion/version.rb +1 -1
- metadata +3 -2
data/README.md
CHANGED
@@ -4,7 +4,7 @@ Make this:
|
|
4
4
|
|
5
5
|

|
6
6
|
|
7
|
-
using
|
7
|
+
using this:
|
8
8
|
|
9
9
|
```ruby
|
10
10
|
@form = Formotion::Form.new({
|
@@ -25,7 +25,7 @@ using just this:
|
|
25
25
|
secure: true
|
26
26
|
}, {
|
27
27
|
title: "Password",
|
28
|
-
subtitle: "Confirmation"
|
28
|
+
subtitle: "Confirmation",
|
29
29
|
key: :confirm,
|
30
30
|
placeholder: "required",
|
31
31
|
type: :string,
|
@@ -61,7 +61,7 @@ using just this:
|
|
61
61
|
}]
|
62
62
|
})
|
63
63
|
|
64
|
-
@form_controller = FormController.alloc.initWithForm(@form)
|
64
|
+
@form_controller = Formotion::FormController.alloc.initWithForm(@form)
|
65
65
|
@window.rootViewController = @form_controller
|
66
66
|
```
|
67
67
|
|
@@ -100,10 +100,10 @@ form.build_section do |section|
|
|
100
100
|
end
|
101
101
|
```
|
102
102
|
|
103
|
-
Then attach it to a `Formotion::
|
103
|
+
Then attach it to a `Formotion::FormController` and you're ready to rock and roll:
|
104
104
|
|
105
105
|
```ruby
|
106
|
-
@controller = Formotion::
|
106
|
+
@controller = Formotion::FormController.alloc.initWithForm(form)
|
107
107
|
self.navigationController.pushViewController(@controller, animated: true)
|
108
108
|
```
|
109
109
|
|
@@ -112,7 +112,7 @@ self.navigationController.pushViewController(@controller, animated: true)
|
|
112
112
|
You have `form#submit`, `form#on_submit`, and `form#render` at your disposal. Here's an example:
|
113
113
|
|
114
114
|
```ruby
|
115
|
-
class PeopleController < Formotion::
|
115
|
+
class PeopleController < Formotion::FormController
|
116
116
|
def viewDidLoad
|
117
117
|
self.navigationItem.rightBarButtonItem = UIBarButtonItem.alloc.initWithBarButtonSystemItem(UIBarButtonSystemItemSave, target:self, action:'submit')
|
118
118
|
end
|
data/lib/formotion.rb
CHANGED
@@ -1,6 +1,9 @@
|
|
1
1
|
require "formotion/version"
|
2
2
|
require 'bubble-wrap/core'
|
3
3
|
|
4
|
-
|
5
|
-
|
6
|
-
|
4
|
+
BW.require File.expand_path('../formotion/**/*.rb', __FILE__) do
|
5
|
+
['form.rb', 'row.rb', 'section.rb'].each {|file|
|
6
|
+
file("lib/formotion/#{file}").depends_on 'lib/formotion/base.rb'
|
7
|
+
}
|
8
|
+
file("lib/formotion/form_controller.rb").depends_on 'lib/formotion/patch/ui_text_field.rb'
|
9
|
+
end
|
@@ -34,12 +34,10 @@ module Formotion
|
|
34
34
|
super
|
35
35
|
|
36
36
|
# via https://gist.github.com/330916, could be wrong.
|
37
|
-
tabBarHeight = self.tabBarController && self.tabBarController.tabBar.bounds.size.height
|
38
|
-
tabBarHeight ||= 0
|
39
37
|
navBarHeight = self.navigationController && (self.navigationController.isNavigationBarHidden ? 0.0 : self.navigationController.navigationBar.bounds.size.height)
|
40
38
|
navBarHeight ||= 0
|
41
39
|
frame = self.view.frame
|
42
|
-
frame.size.height = frame.size.height - navBarHeight -
|
40
|
+
frame.size.height = frame.size.height - navBarHeight - tab_bar_height
|
43
41
|
self.view.frame = frame
|
44
42
|
|
45
43
|
self.title = self.form.title
|
@@ -79,12 +77,13 @@ module Formotion
|
|
79
77
|
curve = userInfo[UIKeyboardAnimationCurveUserInfoKey].intValue
|
80
78
|
keyboardFrame = userInfo[UIKeyboardFrameEndUserInfoKey].CGRectValue
|
81
79
|
|
82
|
-
view_frame =
|
80
|
+
view_frame = self.view.frame;
|
83
81
|
|
84
82
|
if @keyboard_state == UIKeyboardWillHideNotification
|
85
83
|
view_frame.size.height = self.view.bounds.size.height
|
86
84
|
else
|
87
85
|
view_frame.size.height -= keyboardFrame.size.height
|
86
|
+
view_frame.size.height += tab_bar_height
|
88
87
|
end
|
89
88
|
|
90
89
|
UIView.beginAnimations(nil, context: nil)
|
@@ -98,5 +97,11 @@ module Formotion
|
|
98
97
|
|
99
98
|
UIView.commitAnimations
|
100
99
|
end
|
100
|
+
|
101
|
+
private
|
102
|
+
def tab_bar_height
|
103
|
+
tabBarHeight = self.tabBarController && self.tabBarController.tabBar.bounds.size.height
|
104
|
+
tabBarHeight ||= 0
|
105
|
+
end
|
101
106
|
end
|
102
107
|
end
|
data/lib/formotion/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: formotion
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-
|
12
|
+
date: 2012-07-01 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: bubble-wrap
|
@@ -103,3 +103,4 @@ test_files:
|
|
103
103
|
- spec/form_spec.rb
|
104
104
|
- spec/row_spec.rb
|
105
105
|
- spec/section_spec.rb
|
106
|
+
has_rdoc:
|