motion-prime 0.7.2 → 0.8.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 (60) hide show
  1. checksums.yaml +8 -8
  2. data/CHANGELOG.md +7 -0
  3. data/Gemfile.lock +1 -1
  4. data/README.md +8 -9
  5. data/ROADMAP.md +4 -5
  6. data/bin/prime +19 -14
  7. data/files/Rakefile +0 -1
  8. data/files/app/app_delegate.rb +0 -12
  9. data/files/app/config/base.rb +1 -12
  10. data/files/app/screens/application.rb +1 -5
  11. data/files/app/sections/.gitkeep +0 -0
  12. data/files/app/styles/.gitkeep +0 -0
  13. data/files/resources/Default-568h@2x.png +0 -0
  14. data/files/resources/Default.png +0 -0
  15. data/files/resources/Default@2x.png +0 -0
  16. data/motion-prime/api_client.rb +2 -1
  17. data/motion-prime/config/base.rb +8 -3
  18. data/motion-prime/config/config.rb +18 -0
  19. data/motion-prime/elements/_text_mixin.rb +0 -4
  20. data/motion-prime/elements/base_element.rb +64 -51
  21. data/motion-prime/elements/draw/image.rb +3 -2
  22. data/motion-prime/elements/draw/label.rb +9 -2
  23. data/motion-prime/helpers/has_search_bar.rb +10 -1
  24. data/motion-prime/screens/_base_mixin.rb +1 -1
  25. data/motion-prime/screens/_sections_mixin.rb +8 -4
  26. data/motion-prime/sections/__section_with_container_mixin.rb +52 -0
  27. data/motion-prime/sections/_cell_section_mixin.rb +7 -21
  28. data/motion-prime/sections/_delegate_mixin.rb +12 -0
  29. data/motion-prime/sections/_draw_section_mixin.rb +4 -21
  30. data/motion-prime/sections/base_section.rb +7 -7
  31. data/motion-prime/sections/form.rb +7 -0
  32. data/motion-prime/sections/form/base_field_section.rb +9 -0
  33. data/motion-prime/sections/form/date_field_section.rb +1 -1
  34. data/motion-prime/sections/form/form_delegate.rb +0 -1
  35. data/motion-prime/sections/form/password_field_section.rb +1 -1
  36. data/motion-prime/sections/form/select_field_section.rb +1 -1
  37. data/motion-prime/sections/form/string_field_section.rb +1 -1
  38. data/motion-prime/sections/form/submit_field_section.rb +1 -1
  39. data/motion-prime/sections/form/switch_field_section.rb +1 -1
  40. data/motion-prime/sections/form/text_field_section.rb +1 -1
  41. data/motion-prime/sections/tabbed.rb +7 -0
  42. data/motion-prime/sections/table.rb +20 -7
  43. data/motion-prime/sections/table/table_delegate.rb +1 -9
  44. data/motion-prime/styles/base.rb +1 -1
  45. data/motion-prime/styles/form.rb +7 -7
  46. data/motion-prime/version.rb +1 -1
  47. data/motion-prime/views/layout.rb +4 -2
  48. metadata +6 -14
  49. data/files/app/screens/help.rb +0 -6
  50. data/files/app/screens/home.rb +0 -8
  51. data/files/app/screens/sidebar.rb +0 -14
  52. data/files/app/sections/home/section.rb +0 -3
  53. data/files/app/sections/sidebar/action.rb +0 -5
  54. data/files/app/sections/sidebar/table.rb +0 -20
  55. data/files/app/styles/home.rb +0 -9
  56. data/files/resources/fonts/ubuntu.ttf +0 -0
  57. data/files/resources/images/arrow.png +0 -0
  58. data/files/resources/images/menu_button.png +0 -0
  59. data/files/resources/images/menu_button@2x.png +0 -0
  60. data/motion-prime/styles/sidebar.rb +0 -23
@@ -1,20 +1,12 @@
1
1
  module MotionPrime
2
2
  class TableDelegate
3
+ include DelegateMixin
3
4
  attr_accessor :table_section
4
5
  def initialize(options)
5
6
  self.table_section = options[:section].try(:weak_ref)
6
7
  @section_instance = table_section.to_s
7
8
  end
8
9
 
9
- def delegated_by(view)
10
- @delegated_views ||= []
11
- @delegated_views << view
12
- end
13
-
14
- def clear_delegated
15
- Array.wrap(@delegated_views).each { |view| view.setDelegate(nil) }
16
- end
17
-
18
10
  # def dealloc
19
11
  # pp 'Deallocating table_delegate for ', @section_instance
20
12
  # super
@@ -60,6 +60,6 @@ MotionPrime::Styles.define :base do
60
60
 
61
61
  style :spinner_message, mixins: [:multiline],
62
62
  top: proc { screen.view.center.y + 38 }, left: 50, width: 220, text_alignment: :center,
63
- font: proc { MotionPrime::Config.font.name.uifont(18) },
63
+ font: proc { :app_base.uifont(18) },
64
64
  line_spacing: 6
65
65
  end
@@ -31,7 +31,7 @@ MotionPrime::Styles.define :base_form do
31
31
  height: 16,
32
32
  left: 0,
33
33
  right: 0,
34
- font: proc { MotionPrime::Config.font.name.uifont(12) },
34
+ font: proc { :app_base.uifont(12) },
35
35
  size_to_fit: true
36
36
 
37
37
  style :field_error_message,
@@ -43,7 +43,7 @@ MotionPrime::Styles.define :base_form do
43
43
  number_of_lines: 0,
44
44
  size_to_fit: true,
45
45
  text_color: :app_error,
46
- font: proc { MotionPrime::Config.font.name.uifont(12) }
46
+ font: proc { :app_base.uifont(12) }
47
47
 
48
48
  # available options for input:
49
49
  # @layer: @border_width: FLOAT
@@ -55,8 +55,8 @@ MotionPrime::Styles.define :base_form do
55
55
  border_width: 1,
56
56
  border_color: :gray
57
57
  },
58
- font: proc { MotionPrime::Config.font.name.uifont(16) },
59
- placeholder_font: proc { MotionPrime::Config.font.name.uifont(16) },
58
+ font: proc { :app_base.uifont(16) },
59
+ placeholder_font: proc { :app_base.uifont(16) },
60
60
  background_color: :white,
61
61
  left: 0,
62
62
  right: 0,
@@ -77,7 +77,7 @@ MotionPrime::Styles.define :base_form do
77
77
  },
78
78
  title_color: :gray,
79
79
  title_label: {
80
- font: proc { MotionPrime::Config.font.name.uifont(16) }
80
+ font: proc {:app_base.uifont(16) }
81
81
  }
82
82
 
83
83
  style :select_field_image,
@@ -121,9 +121,9 @@ MotionPrime::Styles.define :base_form do
121
121
 
122
122
  style :switch_field_label,
123
123
  top: 10,
124
- font: proc { MotionPrime::Config.font.name.uifont(16) }
124
+ font: proc { :app_base.uifont(16) }
125
125
 
126
126
  style :switch_field_hint,
127
127
  top: 40,
128
- font: proc { MotionPrime::Config.font.name.uifont(12) }
128
+ font: proc { :app_base.uifont(12) }
129
129
  end
@@ -1,3 +1,3 @@
1
1
  module MotionPrime
2
- VERSION = "0.7.2"
2
+ VERSION = "0.8.0"
3
3
  end
@@ -13,11 +13,13 @@ module MotionPrime
13
13
  builder = ViewBuilder.new(klass, options)
14
14
  options = builder.options.merge(calculate_frame: true, bounds: bounds)
15
15
  view = builder.view
16
+ insert_index = options.delete(:at_index)
17
+
16
18
  if render_target = options.delete(:render_target)
17
19
  options[:bounds] = render_target.bounds
18
- render_target.addSubview(view)
20
+ insert_index ? render_target.insertSubview(view, atIndex: insert_index) : render_target.addSubview(view)
19
21
  elsif view_stack.any?
20
- view_stack.last.addSubview(view)
22
+ insert_index ? view_stack.last.insertSubview(view, atIndex: insert_index) : view_stack.last.addSubview(view)
21
23
  end
22
24
 
23
25
  setup(view, options, &block)
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.7.2
4
+ version: 0.8.0
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-02-07 00:00:00.000000000 Z
12
+ date: 2014-02-08 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rake
@@ -234,21 +234,12 @@ files:
234
234
  - files/app/environment.rb
235
235
  - files/app/models/.gitkeep
236
236
  - files/app/screens/application.rb
237
- - files/app/screens/help.rb
238
- - files/app/screens/home.rb
239
- - files/app/screens/sidebar.rb
240
- - files/app/sections/home/section.rb
241
- - files/app/sections/sidebar/action.rb
242
- - files/app/sections/sidebar/table.rb
243
- - files/app/styles/home.rb
237
+ - files/app/sections/.gitkeep
238
+ - files/app/styles/.gitkeep
244
239
  - files/resources/Default-568h@2x.png
245
240
  - files/resources/Default.png
246
241
  - files/resources/Default@2x.png
247
242
  - files/resources/Icon.png
248
- - files/resources/fonts/ubuntu.ttf
249
- - files/resources/images/arrow.png
250
- - files/resources/images/menu_button.png
251
- - files/resources/images/menu_button@2x.png
252
243
  - lib/motion-prime.rb
253
244
  - motion-prime.gemspec
254
245
  - motion-prime/api_client.rb
@@ -309,7 +300,9 @@ files:
309
300
  - motion-prime/screens/extensions/_indicators_mixin.rb
310
301
  - motion-prime/screens/extensions/_navigation_bar_mixin.rb
311
302
  - motion-prime/screens/screen.rb
303
+ - motion-prime/sections/__section_with_container_mixin.rb
312
304
  - motion-prime/sections/_cell_section_mixin.rb
305
+ - motion-prime/sections/_delegate_mixin.rb
313
306
  - motion-prime/sections/_draw_section_mixin.rb
314
307
  - motion-prime/sections/base_section.rb
315
308
  - motion-prime/sections/form.rb
@@ -332,7 +325,6 @@ files:
332
325
  - motion-prime/styles/_mixins.rb
333
326
  - motion-prime/styles/base.rb
334
327
  - motion-prime/styles/form.rb
335
- - motion-prime/styles/sidebar.rb
336
328
  - motion-prime/support/_key_value_store.rb
337
329
  - motion-prime/support/_padding_attribute.rb
338
330
  - motion-prime/support/mp_button.rb
@@ -1,6 +0,0 @@
1
- class HelpScreen < ApplicationScreen
2
- title 'Help'
3
-
4
- def render
5
- end
6
- end
@@ -1,8 +0,0 @@
1
- class HomeScreen < ApplicationScreen
2
- title 'Home'
3
-
4
- def render
5
- @main_section = HomeSection.new(screen: self)
6
- @main_section.render
7
- end
8
- end
@@ -1,14 +0,0 @@
1
- class SidebarScreen < Prime::Screen
2
- def render
3
- @main_section = SidebarTableSection.new(screen: self)
4
- @main_section.render
5
- end
6
-
7
- def open_home
8
- app_delegate.open_screen HomeScreen.new
9
- end
10
-
11
- def open_help
12
- app_delegate.open_screen HelpScreen.new
13
- end
14
- end
@@ -1,3 +0,0 @@
1
- class HomeSection < Prime::Section
2
- element :date, text: proc { Time.now.strftime("%A, %B %d") }
3
- end
@@ -1,5 +0,0 @@
1
- class SidebarActionSection < Prime::Section
2
- container height: 43
3
- element :title, text: proc { model[:title] }
4
- element :arrow, type: :image
5
- end
@@ -1,20 +0,0 @@
1
- class SidebarTableSection < Prime::TableSection
2
- def sidebar_items
3
- [
4
- {title: 'Home Screen', action: :open_home},
5
- {title: 'Help Screen', action: :open_help}
6
- ]
7
- end
8
-
9
- def table_data
10
- sidebar_items.map do |model|
11
- SidebarActionSection.new(model: model)
12
- end
13
- end
14
-
15
- def on_click(table, index)
16
- section = data[index.row]
17
- return false if !section || !section.model[:action]
18
- screen.send section.model[:action].to_sym
19
- end
20
- end
@@ -1,9 +0,0 @@
1
- Prime::Styles.define :home do
2
- style :date,
3
- text_color: :black,
4
- top: 100,
5
- width: 320,
6
- font: proc { :system.uifont(20) },
7
- size_to_fit: true,
8
- left: 20,
9
- end
Binary file
Binary file
Binary file
@@ -1,23 +0,0 @@
1
- Prime::Styles.define :sidebar do
2
- style :screen,
3
- background_color: :app_dark
4
-
5
- style :table,
6
- top: 150,
7
- left: 0,
8
- width: 320,
9
- bottom: 0,
10
- background_color: :app_dark,
11
- separator_color: :clear
12
-
13
- style :table_cell,
14
- selection_style: :none
15
-
16
- style :action_title,
17
- text_color: :white,
18
- left: 20,
19
- top: 10,
20
- width: 320,
21
- font: proc { :system.uifont(20) },
22
- size_to_fit: true
23
- end