motion-prime 0.9.9 → 0.9.9.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 (58) hide show
  1. checksums.yaml +8 -8
  2. data/CHANGELOG.md +8 -2
  3. data/Gemfile.lock +2 -2
  4. data/ROADMAP.md +1 -3
  5. data/files/Gemfile +1 -1
  6. data/generators/templates/scaffold/table.rb +1 -1
  7. data/generators/templates/table.rb +1 -1
  8. data/motion-prime/config/base.rb +2 -2
  9. data/motion-prime/elements/_content_text_mixin.rb +1 -1
  10. data/motion-prime/elements/base_element.rb +14 -7
  11. data/motion-prime/elements/collection_view_cell.rb +7 -0
  12. data/motion-prime/elements/draw/image.rb +7 -2
  13. data/motion-prime/elements/table_view_cell.rb +1 -1
  14. data/motion-prime/helpers/has_normalizer.rb +1 -1
  15. data/motion-prime/helpers/has_search_bar.rb +1 -1
  16. data/motion-prime/models/_nano_bag_mixin.rb +1 -1
  17. data/motion-prime/models/model.rb +8 -8
  18. data/motion-prime/models/store.rb +1 -1
  19. data/motion-prime/screens/screen.rb +3 -3
  20. data/motion-prime/sections/_async_form_mixin.rb +2 -2
  21. data/motion-prime/sections/_async_table_mixin.rb +7 -7
  22. data/motion-prime/sections/_cell_section_mixin.rb +16 -11
  23. data/motion-prime/sections/_draw_section_mixin.rb +1 -0
  24. data/motion-prime/sections/{__section_with_container_mixin.rb → _section_with_container_mixin.rb} +2 -2
  25. data/motion-prime/sections/abstract_collection.rb +291 -0
  26. data/motion-prime/sections/base_section.rb +2 -2
  27. data/motion-prime/sections/collection/collection_delegate.rb +62 -0
  28. data/motion-prime/sections/form.rb +22 -18
  29. data/motion-prime/sections/form/base_field_section.rb +7 -7
  30. data/motion-prime/sections/form/form_delegate.rb +1 -1
  31. data/motion-prime/sections/form/form_header_section.rb +1 -1
  32. data/motion-prime/sections/form/password_field_section.rb +1 -1
  33. data/motion-prime/sections/form/static_field_section.rb +1 -1
  34. data/motion-prime/sections/form/string_field_section.rb +1 -1
  35. data/motion-prime/sections/form/text_field_section.rb +1 -1
  36. data/motion-prime/sections/grid.rb +92 -0
  37. data/motion-prime/sections/table.rb +26 -260
  38. data/motion-prime/sections/table/refresh_mixin.rb +3 -3
  39. data/motion-prime/sections/table/table_delegate.rb +1 -0
  40. data/motion-prime/styles/_mixins.rb +1 -1
  41. data/motion-prime/styles/base.rb +20 -6
  42. data/motion-prime/styles/form.rb +1 -1
  43. data/motion-prime/support/_control_content_alignment.rb +39 -0
  44. data/motion-prime/support/mp_button.rb +5 -13
  45. data/motion-prime/support/mp_collection_cell_with_section.rb +12 -0
  46. data/motion-prime/support/{mp_cell_content_view.rb → mp_table_cell_content_view.rb} +0 -0
  47. data/motion-prime/support/{mp_cell_with_section.rb → mp_table_cell_with_section.rb} +1 -1
  48. data/motion-prime/support/mp_text_field.rb +24 -18
  49. data/motion-prime/support/mp_text_view.rb +1 -0
  50. data/motion-prime/version.rb +1 -1
  51. data/motion-prime/views/_frame_calculator_mixin.rb +15 -11
  52. data/motion-prime/views/layout.rb +6 -4
  53. data/motion-prime/views/view_builder.rb +10 -0
  54. data/motion-prime/views/view_styler.rb +5 -1
  55. data/spec/factories/scaffold/sections/tasks/index_table.rb +1 -1
  56. data/spec/unit/support/filter_mixin_spec.rb +7 -3
  57. data/spec/unit/support/frame_calculator_mixin_spec.rb +43 -0
  58. metadata +13 -5
@@ -0,0 +1,43 @@
1
+ describe MotionPrime::FrameCalculatorMixin do
2
+ before do
3
+ @parent_bounds = CGRectMake(0,0,0,0)
4
+ @parent_bounds.size.width = 300
5
+ @parent_bounds.size.height = 200
6
+ @subject = MotionPrime::FrameCalculatorMixin.new
7
+ end
8
+
9
+ it "should set width and height" do
10
+ result = @subject.calculate_frame_for(@parent_bounds, width: 200, height: 100)
11
+ result.size.width.should == 200
12
+ result.size.height.should == 100
13
+ end
14
+
15
+ it "should use parent size if size not set" do
16
+ result = @subject.calculate_frame_for(@parent_bounds, {})
17
+ result.size.width.should == 300
18
+ result.size.height.should == 200
19
+ end
20
+
21
+ it "should calculate size based on left/right" do
22
+ result = @subject.calculate_frame_for(@parent_bounds, {left: 10, right: 10, top: 10, bottom: 10})
23
+ result.size.width.should == 280
24
+ result.size.height.should == 180
25
+ result.origin.x.should == 10
26
+ result.origin.y.should == 10
27
+ end
28
+
29
+ it "should calculate left based on width and right" do
30
+ result = @subject.calculate_frame_for(@parent_bounds, {right: 10, width: 200})
31
+ result.origin.x.should == 90 #300 - 200 - 10
32
+ end
33
+
34
+ it "should calculate top based on height and bottom" do
35
+ result = @subject.calculate_frame_for(@parent_bounds, {bottom: 10, height: 100})
36
+ result.origin.y.should == 90 #300 - 200 - 10
37
+ end
38
+
39
+ it "should use width as more priority than right" do
40
+ result = @subject.calculate_frame_for(@parent_bounds, {width: 100, left: 10, right: 10})
41
+ result.size.width.should == 100
42
+ end
43
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: motion-prime
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.9
4
+ version: 0.9.9.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Iskander Haziev
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2014-05-26 00:00:00.000000000 Z
12
+ date: 2014-05-29 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rake
@@ -271,6 +271,7 @@ files:
271
271
  - motion-prime/elements/_text_mixin.rb
272
272
  - motion-prime/elements/base_element.rb
273
273
  - motion-prime/elements/button.rb
274
+ - motion-prime/elements/collection_view_cell.rb
274
275
  - motion-prime/elements/draw.rb
275
276
  - motion-prime/elements/draw/_draw_background_mixin.rb
276
277
  - motion-prime/elements/draw/image.rb
@@ -323,13 +324,15 @@ files:
323
324
  - motion-prime/screens/extensions/_indicators_mixin.rb
324
325
  - motion-prime/screens/extensions/_navigation_bar_mixin.rb
325
326
  - motion-prime/screens/screen.rb
326
- - motion-prime/sections/__section_with_container_mixin.rb
327
327
  - motion-prime/sections/_async_form_mixin.rb
328
328
  - motion-prime/sections/_async_table_mixin.rb
329
329
  - motion-prime/sections/_cell_section_mixin.rb
330
330
  - motion-prime/sections/_delegate_mixin.rb
331
331
  - motion-prime/sections/_draw_section_mixin.rb
332
+ - motion-prime/sections/_section_with_container_mixin.rb
333
+ - motion-prime/sections/abstract_collection.rb
332
334
  - motion-prime/sections/base_section.rb
335
+ - motion-prime/sections/collection/collection_delegate.rb
333
336
  - motion-prime/sections/form.rb
334
337
  - motion-prime/sections/form/base_field_section.rb
335
338
  - motion-prime/sections/form/date_field_section.rb
@@ -342,6 +345,7 @@ files:
342
345
  - motion-prime/sections/form/submit_field_section.rb
343
346
  - motion-prime/sections/form/switch_field_section.rb
344
347
  - motion-prime/sections/form/text_field_section.rb
348
+ - motion-prime/sections/grid.rb
345
349
  - motion-prime/sections/header.rb
346
350
  - motion-prime/sections/tabbed.rb
347
351
  - motion-prime/sections/table.rb
@@ -352,15 +356,17 @@ files:
352
356
  - motion-prime/styles/_mixins.rb
353
357
  - motion-prime/styles/base.rb
354
358
  - motion-prime/styles/form.rb
359
+ - motion-prime/support/_control_content_alignment.rb
355
360
  - motion-prime/support/_key_value_store.rb
356
361
  - motion-prime/support/_padding_attribute.rb
357
362
  - motion-prime/support/consts.rb
358
363
  - motion-prime/support/mp_button.rb
359
- - motion-prime/support/mp_cell_content_view.rb
360
- - motion-prime/support/mp_cell_with_section.rb
364
+ - motion-prime/support/mp_collection_cell_with_section.rb
361
365
  - motion-prime/support/mp_label.rb
362
366
  - motion-prime/support/mp_search_bar_custom.rb
363
367
  - motion-prime/support/mp_spinner.rb
368
+ - motion-prime/support/mp_table_cell_content_view.rb
369
+ - motion-prime/support/mp_table_cell_with_section.rb
364
370
  - motion-prime/support/mp_table_header_with_section.rb
365
371
  - motion-prime/support/mp_table_view.rb
366
372
  - motion-prime/support/mp_text_field.rb
@@ -409,6 +415,7 @@ files:
409
415
  - spec/unit/screens/screen_spec.rb
410
416
  - spec/unit/sections/section_spec.rb
411
417
  - spec/unit/support/filter_mixin_spec.rb
418
+ - spec/unit/support/frame_calculator_mixin_spec.rb
412
419
  - travis.sh
413
420
  homepage: ''
414
421
  licenses:
@@ -467,3 +474,4 @@ test_files:
467
474
  - spec/unit/screens/screen_spec.rb
468
475
  - spec/unit/sections/section_spec.rb
469
476
  - spec/unit/support/filter_mixin_spec.rb
477
+ - spec/unit/support/frame_calculator_mixin_spec.rb