formotion 0.5.1 → 1.0

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 (85) hide show
  1. data/CHANGELOG.md +24 -0
  2. data/LIST_OF_ROW_TYPES.md +1 -1
  3. data/Rakefile +20 -5
  4. data/app/app_delegate.rb +89 -17
  5. data/examples/FormModel/.gitignore +5 -0
  6. data/examples/FormModel/Rakefile +9 -0
  7. data/examples/FormModel/app/app_delegate.rb +11 -0
  8. data/examples/FormModel/app/user.rb +18 -0
  9. data/examples/FormModel/app/users_controller.rb +52 -0
  10. data/examples/FormModel/spec/main_spec.rb +9 -0
  11. data/examples/KitchenSink/app/app_delegate.rb +2 -2
  12. data/gh-pages/assets/css/bootstrap-responsive.css +815 -0
  13. data/gh-pages/assets/css/bootstrap-responsive.min.css +9 -0
  14. data/gh-pages/assets/css/bootstrap.css +4983 -0
  15. data/gh-pages/assets/css/bootstrap.min.css +9 -0
  16. data/gh-pages/assets/css/formotion.css +117 -0
  17. data/gh-pages/assets/css/pygments.css +62 -0
  18. data/gh-pages/assets/img/glyphicons-halflings-white.png +0 -0
  19. data/gh-pages/assets/img/glyphicons-halflings.png +0 -0
  20. data/gh-pages/assets/js/bootstrap-alert.js +90 -0
  21. data/gh-pages/assets/js/bootstrap-button.js +96 -0
  22. data/gh-pages/assets/js/bootstrap-carousel.js +169 -0
  23. data/gh-pages/assets/js/bootstrap-collapse.js +157 -0
  24. data/gh-pages/assets/js/bootstrap-dropdown.js +100 -0
  25. data/gh-pages/assets/js/bootstrap-modal.js +218 -0
  26. data/gh-pages/assets/js/bootstrap-popover.js +98 -0
  27. data/gh-pages/assets/js/bootstrap-scrollspy.js +151 -0
  28. data/gh-pages/assets/js/bootstrap-tab.js +135 -0
  29. data/gh-pages/assets/js/bootstrap-tooltip.js +275 -0
  30. data/gh-pages/assets/js/bootstrap-transition.js +61 -0
  31. data/gh-pages/assets/js/bootstrap-typeahead.js +285 -0
  32. data/gh-pages/assets/js/bootstrap.js +1825 -0
  33. data/gh-pages/assets/js/bootstrap.min.js +6 -0
  34. data/gh-pages/index.html +205 -0
  35. data/lib/formotion.rb +15 -2
  36. data/lib/formotion/base.rb +5 -5
  37. data/lib/formotion/{form_controller.rb → controller/form_controller.rb} +22 -3
  38. data/lib/formotion/controller/formable_controller.rb +21 -0
  39. data/lib/formotion/form/form.rb +31 -8
  40. data/lib/formotion/form/form_delegate.rb +26 -3
  41. data/lib/formotion/model/formable.rb +78 -0
  42. data/lib/formotion/row/row.rb +54 -21
  43. data/lib/formotion/row/row_cell_builder.rb +1 -1
  44. data/lib/formotion/row_type/back_row.rb +11 -0
  45. data/lib/formotion/row_type/base.rb +42 -1
  46. data/lib/formotion/row_type/button.rb +30 -0
  47. data/lib/formotion/row_type/check_row.rb +9 -5
  48. data/lib/formotion/row_type/date_row.rb +5 -0
  49. data/lib/formotion/row_type/edit_row.rb +14 -0
  50. data/lib/formotion/row_type/image_row.rb +7 -7
  51. data/lib/formotion/row_type/options_row.rb +18 -8
  52. data/lib/formotion/row_type/slider_row.rb +14 -5
  53. data/lib/formotion/row_type/string_row.rb +17 -5
  54. data/lib/formotion/row_type/subform_row.rb +16 -0
  55. data/lib/formotion/row_type/submit_row.rb +1 -24
  56. data/lib/formotion/row_type/switch_row.rb +10 -2
  57. data/lib/formotion/row_type/template_row.rb +77 -0
  58. data/lib/formotion/row_type/text_row.rb +12 -4
  59. data/lib/formotion/section/section.rb +9 -1
  60. data/lib/formotion/version.rb +1 -1
  61. data/spec/form_spec.rb +24 -0
  62. data/spec/formable_spec.rb +100 -0
  63. data/spec/functional/formable_controller_spec.rb +47 -0
  64. data/spec/functional/image_row_spec.rb +2 -2
  65. data/spec/functional/subform_row.rb +33 -0
  66. data/spec/functional/template_row_spec.rb +57 -0
  67. data/spec/helpers/row_test_helpers.rb +26 -0
  68. data/spec/row_type/back_spec.rb +31 -0
  69. data/spec/row_type/check_spec.rb +9 -9
  70. data/spec/row_type/date_spec.rb +3 -10
  71. data/spec/row_type/email_spec.rb +1 -9
  72. data/spec/row_type/image_spec.rb +3 -12
  73. data/spec/row_type/number_spec.rb +1 -9
  74. data/spec/row_type/options_spec.rb +18 -10
  75. data/spec/row_type/phone_spec.rb +1 -9
  76. data/spec/row_type/picker_spec.rb +2 -11
  77. data/spec/row_type/slider_spec.rb +11 -10
  78. data/spec/row_type/static_spec.rb +1 -9
  79. data/spec/row_type/string_spec.rb +13 -9
  80. data/spec/row_type/subform_spec.rb +47 -0
  81. data/spec/row_type/submit_spec.rb +1 -9
  82. data/spec/row_type/switch_spec.rb +9 -9
  83. data/spec/row_type/template_spec.rb +14 -0
  84. data/spec/row_type/text_spec.rb +9 -9
  85. metadata +58 -6
@@ -1,14 +1,6 @@
1
1
  # Tests character row behavior on a string type
2
2
  describe "String Row Type" do
3
- before do
4
- row_settings = {
5
- title: "String",
6
- key: :string,
7
- type: :string,
8
- }
9
- @row = Formotion::Row.new(row_settings)
10
- @row.reuse_identifier = 'test'
11
- end
3
+ tests_row :string
12
4
 
13
5
  it "should initialize with correct settings" do
14
6
  @row.object.class.should == Formotion::RowType::StringRow
@@ -32,6 +24,18 @@ describe "String Row Type" do
32
24
  @row.text_field.text.should == 'init value'
33
25
  end
34
26
 
27
+ it "should be bound to value of row" do
28
+ @row.value = "first value"
29
+ cell = @row.make_cell
30
+
31
+ @row.value = "new value"
32
+ @row.text_field.text.should == 'new value'
33
+
34
+ @row.text_field.setText("other value")
35
+ @row.text_field.delegate.on_change(@row.text_field)
36
+ @row.value.should == "other value"
37
+ end
38
+
35
39
  # Placeholder
36
40
  it "should have no placeholder by default" do
37
41
  cell = @row.make_cell
@@ -0,0 +1,47 @@
1
+ describe "Subform Row" do
2
+ tests_row title: "Subform", type: :subform,
3
+ subform: {
4
+ sections: [{
5
+ rows: [{
6
+ title: 'Hello',
7
+ type: :static
8
+ }]
9
+ }]
10
+ }
11
+
12
+ it "should build cell with a label and an accessory" do
13
+ cell = @row.make_cell
14
+ cell.accessoryType.should == UITableViewCellAccessoryDisclosureIndicator
15
+ cell.textLabel.text.should == 'Subform'
16
+ end
17
+
18
+ it "should build subform" do
19
+ @row.subform.to_form.class.should == Formotion::Form
20
+ end
21
+
22
+ it "should push subform on select" do
23
+ form = FakeForm.new
24
+ @row.instance_variable_set("@section", form)
25
+
26
+ @row.object.on_select(nil, nil)
27
+ form.controller.push_subform_called.should == true
28
+ end
29
+ end
30
+
31
+
32
+ class FakeForm
33
+ def form
34
+ self
35
+ end
36
+
37
+ def controller
38
+ @controller ||= FakeControllerClass.new
39
+ end
40
+ end
41
+
42
+ class FakeControllerClass
43
+ attr_accessor :push_subform_called
44
+ def push_subform(form)
45
+ self.push_subform_called = true
46
+ end
47
+ end
@@ -1,13 +1,5 @@
1
1
  describe "Submit Row" do
2
- before do
3
- row_settings = {
4
- title: "Submit",
5
- key: :submit,
6
- type: :submit,
7
- }
8
- @row = Formotion::Row.new(row_settings)
9
- @row.reuse_identifier = 'test'
10
- end
2
+ tests_row :submit
11
3
 
12
4
  it "should initialize with correct settings" do
13
5
  @row.object.class.should == Formotion::RowType::SubmitRow
@@ -1,13 +1,5 @@
1
1
  describe "Switch Row" do
2
- before do
3
- row_settings = {
4
- title: "Switch",
5
- key: :switch,
6
- type: :switch,
7
- }
8
- @row = Formotion::Row.new(row_settings)
9
- @row.reuse_identifier = 'test'
10
- end
2
+ tests_row :switch
11
3
 
12
4
  it "should initialize with correct settings" do
13
5
  @row.object.class.should == Formotion::RowType::SwitchRow
@@ -24,4 +16,12 @@ describe "Switch Row" do
24
16
  cell = @row.make_cell
25
17
  cell.accessoryView.on?.should == true
26
18
  end
19
+
20
+ it "should bind its switch" do
21
+ @row.value = true
22
+ cell = @row.make_cell
23
+
24
+ @row.value = false
25
+ cell.accessoryView.on?.should == false
26
+ end
27
27
  end
@@ -0,0 +1,14 @@
1
+ describe "Template Row" do
2
+ tests_row title: "Template", key: :template, type: :template,
3
+ template: {type: :string}
4
+
5
+ it "should initialize with correct settings" do
6
+ @row.object.class.should == Formotion::RowType::TemplateRow
7
+ end
8
+
9
+ # Value
10
+ it "should select default value" do
11
+ cell = @row.make_cell
12
+ @row.value.should == nil
13
+ end
14
+ end
@@ -1,13 +1,5 @@
1
1
  describe "Text Row" do
2
- before do
3
- row_settings = {
4
- title: "Text",
5
- key: :text,
6
- type: :text,
7
- }
8
- @row = Formotion::Row.new(row_settings)
9
- @row.reuse_identifier = 'test'
10
- end
2
+ tests_row :text
11
3
 
12
4
  it "should initialize with correct settings" do
13
5
  @row.object.class.should == Formotion::RowType::TextRow
@@ -26,6 +18,14 @@ describe "Text Row" do
26
18
  @row.text_field.text.should == 'init value'
27
19
  end
28
20
 
21
+ it "should bind row.value" do
22
+ @row.value = 'init value'
23
+ cell = @row.make_cell
24
+
25
+ @row.value = "new value"
26
+ @row.text_field.text.should == 'new value'
27
+ end
28
+
29
29
  # Placeholder
30
30
  it "should have no placeholder by default" do
31
31
  cell = @row.make_cell
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.5.1
4
+ version: '1.0'
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-07-19 00:00:00.000000000 Z
12
+ date: 2012-08-12 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bubble-wrap
@@ -60,6 +60,12 @@ files:
60
60
  - README.md
61
61
  - Rakefile
62
62
  - app/app_delegate.rb
63
+ - examples/FormModel/.gitignore
64
+ - examples/FormModel/Rakefile
65
+ - examples/FormModel/app/app_delegate.rb
66
+ - examples/FormModel/app/user.rb
67
+ - examples/FormModel/app/users_controller.rb
68
+ - examples/FormModel/spec/main_spec.rb
63
69
  - examples/KitchenSink/.gitignore
64
70
  - examples/KitchenSink/README.md
65
71
  - examples/KitchenSink/Rakefile
@@ -71,12 +77,37 @@ files:
71
77
  - examples/Login/app/login_controller.rb
72
78
  - examples/Login/app/user_controller.rb
73
79
  - examples/Login/spec/main_spec.rb
80
+ - gh-pages/assets/css/bootstrap-responsive.css
81
+ - gh-pages/assets/css/bootstrap-responsive.min.css
82
+ - gh-pages/assets/css/bootstrap.css
83
+ - gh-pages/assets/css/bootstrap.min.css
84
+ - gh-pages/assets/css/formotion.css
85
+ - gh-pages/assets/css/pygments.css
86
+ - gh-pages/assets/img/glyphicons-halflings-white.png
87
+ - gh-pages/assets/img/glyphicons-halflings.png
88
+ - gh-pages/assets/js/bootstrap-alert.js
89
+ - gh-pages/assets/js/bootstrap-button.js
90
+ - gh-pages/assets/js/bootstrap-carousel.js
91
+ - gh-pages/assets/js/bootstrap-collapse.js
92
+ - gh-pages/assets/js/bootstrap-dropdown.js
93
+ - gh-pages/assets/js/bootstrap-modal.js
94
+ - gh-pages/assets/js/bootstrap-popover.js
95
+ - gh-pages/assets/js/bootstrap-scrollspy.js
96
+ - gh-pages/assets/js/bootstrap-tab.js
97
+ - gh-pages/assets/js/bootstrap-tooltip.js
98
+ - gh-pages/assets/js/bootstrap-transition.js
99
+ - gh-pages/assets/js/bootstrap-typeahead.js
100
+ - gh-pages/assets/js/bootstrap.js
101
+ - gh-pages/assets/js/bootstrap.min.js
102
+ - gh-pages/index.html
74
103
  - lib/formotion.rb
75
104
  - lib/formotion/base.rb
105
+ - lib/formotion/controller/form_controller.rb
106
+ - lib/formotion/controller/formable_controller.rb
76
107
  - lib/formotion/exceptions.rb
77
108
  - lib/formotion/form/form.rb
78
109
  - lib/formotion/form/form_delegate.rb
79
- - lib/formotion/form_controller.rb
110
+ - lib/formotion/model/formable.rb
80
111
  - lib/formotion/patch/object.rb
81
112
  - lib/formotion/patch/ui_action_sheet.rb
82
113
  - lib/formotion/patch/ui_text_field.rb
@@ -84,9 +115,12 @@ files:
84
115
  - lib/formotion/patch/ui_text_view_placeholder.rb
85
116
  - lib/formotion/row/row.rb
86
117
  - lib/formotion/row/row_cell_builder.rb
118
+ - lib/formotion/row_type/back_row.rb
87
119
  - lib/formotion/row_type/base.rb
120
+ - lib/formotion/row_type/button.rb
88
121
  - lib/formotion/row_type/check_row.rb
89
122
  - lib/formotion/row_type/date_row.rb
123
+ - lib/formotion/row_type/edit_row.rb
90
124
  - lib/formotion/row_type/email_row.rb
91
125
  - lib/formotion/row_type/image_row.rb
92
126
  - lib/formotion/row_type/number_row.rb
@@ -97,23 +131,31 @@ files:
97
131
  - lib/formotion/row_type/slider_row.rb
98
132
  - lib/formotion/row_type/static_row.rb
99
133
  - lib/formotion/row_type/string_row.rb
134
+ - lib/formotion/row_type/subform_row.rb
100
135
  - lib/formotion/row_type/submit_row.rb
101
136
  - lib/formotion/row_type/switch_row.rb
137
+ - lib/formotion/row_type/template_row.rb
102
138
  - lib/formotion/row_type/text_row.rb
103
139
  - lib/formotion/section/section.rb
104
140
  - lib/formotion/version.rb
105
141
  - spec/form_spec.rb
142
+ - spec/formable_spec.rb
106
143
  - spec/functional/character_spec.rb
107
144
  - spec/functional/check_row_spec.rb
108
145
  - spec/functional/date_row_spec.rb
146
+ - spec/functional/formable_controller_spec.rb
109
147
  - spec/functional/image_row_spec.rb
110
148
  - spec/functional/options_row_spec.rb
111
149
  - spec/functional/picker_row_spec.rb
112
150
  - spec/functional/slider_row_spec.rb
151
+ - spec/functional/subform_row.rb
113
152
  - spec/functional/submit_row_spec.rb
114
153
  - spec/functional/switch_row_spec.rb
154
+ - spec/functional/template_row_spec.rb
115
155
  - spec/functional/text_row_spec.rb
156
+ - spec/helpers/row_test_helpers.rb
116
157
  - spec/row_spec.rb
158
+ - spec/row_type/back_spec.rb
117
159
  - spec/row_type/check_spec.rb
118
160
  - spec/row_type/date_spec.rb
119
161
  - spec/row_type/email_spec.rb
@@ -125,8 +167,10 @@ files:
125
167
  - spec/row_type/slider_spec.rb
126
168
  - spec/row_type/static_spec.rb
127
169
  - spec/row_type/string_spec.rb
170
+ - spec/row_type/subform_spec.rb
128
171
  - spec/row_type/submit_spec.rb
129
172
  - spec/row_type/switch_spec.rb
173
+ - spec/row_type/template_spec.rb
130
174
  - spec/row_type/text_spec.rb
131
175
  - spec/section_spec.rb
132
176
  - spec/support/ui_control_wrap_extension.rb
@@ -144,7 +188,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
144
188
  version: '0'
145
189
  segments:
146
190
  - 0
147
- hash: -3180843362770153593
191
+ hash: 84446603769905079
148
192
  required_rubygems_version: !ruby/object:Gem::Requirement
149
193
  none: false
150
194
  requirements:
@@ -153,26 +197,32 @@ required_rubygems_version: !ruby/object:Gem::Requirement
153
197
  version: '0'
154
198
  segments:
155
199
  - 0
156
- hash: -3180843362770153593
200
+ hash: 84446603769905079
157
201
  requirements: []
158
202
  rubyforge_project:
159
- rubygems_version: 1.8.24
203
+ rubygems_version: 1.8.23
160
204
  signing_key:
161
205
  specification_version: 3
162
206
  summary: Making iOS Forms insanely great with RubyMotion
163
207
  test_files:
164
208
  - spec/form_spec.rb
209
+ - spec/formable_spec.rb
165
210
  - spec/functional/character_spec.rb
166
211
  - spec/functional/check_row_spec.rb
167
212
  - spec/functional/date_row_spec.rb
213
+ - spec/functional/formable_controller_spec.rb
168
214
  - spec/functional/image_row_spec.rb
169
215
  - spec/functional/options_row_spec.rb
170
216
  - spec/functional/picker_row_spec.rb
171
217
  - spec/functional/slider_row_spec.rb
218
+ - spec/functional/subform_row.rb
172
219
  - spec/functional/submit_row_spec.rb
173
220
  - spec/functional/switch_row_spec.rb
221
+ - spec/functional/template_row_spec.rb
174
222
  - spec/functional/text_row_spec.rb
223
+ - spec/helpers/row_test_helpers.rb
175
224
  - spec/row_spec.rb
225
+ - spec/row_type/back_spec.rb
176
226
  - spec/row_type/check_spec.rb
177
227
  - spec/row_type/date_spec.rb
178
228
  - spec/row_type/email_spec.rb
@@ -184,8 +234,10 @@ test_files:
184
234
  - spec/row_type/slider_spec.rb
185
235
  - spec/row_type/static_spec.rb
186
236
  - spec/row_type/string_spec.rb
237
+ - spec/row_type/subform_spec.rb
187
238
  - spec/row_type/submit_spec.rb
188
239
  - spec/row_type/switch_spec.rb
240
+ - spec/row_type/template_spec.rb
189
241
  - spec/row_type/text_spec.rb
190
242
  - spec/section_spec.rb
191
243
  - spec/support/ui_control_wrap_extension.rb