motion-prime 0.4.3 → 0.4.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (47) hide show
  1. checksums.yaml +6 -14
  2. data/CHANGELOG.md +5 -0
  3. data/Gemfile.lock +1 -1
  4. data/ROADMAP.md +9 -4
  5. data/doc/code/getting_started.rb +1 -2
  6. data/doc/code/screens.rb +54 -0
  7. data/doc/docs/getting_started.html +27 -6
  8. data/doc/docs/screens.html +166 -0
  9. data/files/Gemfile +1 -1
  10. data/files/Gemfile.lock +64 -0
  11. data/files/app/environment.rb +10 -0
  12. data/files/app/styles/sidebar.rb +3 -10
  13. data/files/resources/images/menu_button.png +0 -0
  14. data/files/resources/images/menu_button@2x.png +0 -0
  15. data/motion-prime/app_delegate.rb +19 -0
  16. data/motion-prime/core_ext/kernel.rb +4 -0
  17. data/motion-prime/elements/_content_text_mixin.rb +23 -11
  18. data/motion-prime/elements/_text_mixin.rb +54 -0
  19. data/motion-prime/elements/base_element.rb +19 -14
  20. data/motion-prime/elements/draw.rb +22 -1
  21. data/motion-prime/elements/draw/_draw_background_mixin.rb +28 -28
  22. data/motion-prime/elements/draw/image.rb +67 -48
  23. data/motion-prime/elements/draw/label.rb +59 -49
  24. data/motion-prime/elements/draw/view.rb +5 -3
  25. data/motion-prime/helpers/has_style_chain_builder.rb +1 -3
  26. data/motion-prime/models/association_collection.rb +8 -0
  27. data/motion-prime/models/finder.rb +8 -0
  28. data/motion-prime/mp.rb +4 -0
  29. data/motion-prime/screens/_navigation_mixin.rb +4 -0
  30. data/motion-prime/screens/base_screen.rb +7 -0
  31. data/motion-prime/screens/sidebar_container_screen.rb +2 -2
  32. data/motion-prime/sections/_cell_section_mixin.rb +44 -5
  33. data/motion-prime/sections/_draw_section_mixin.rb +120 -0
  34. data/motion-prime/sections/base_section.rb +29 -24
  35. data/motion-prime/sections/form.rb +48 -65
  36. data/motion-prime/sections/form/base_field_section.rb +2 -2
  37. data/motion-prime/sections/table.rb +143 -82
  38. data/motion-prime/sections/table/table_delegate.rb +48 -0
  39. data/motion-prime/styles/form.rb +1 -1
  40. data/motion-prime/support/mp_cell_with_section.rb +6 -2
  41. data/motion-prime/support/mp_view_with_section.rb +1 -1
  42. data/motion-prime/version.rb +1 -1
  43. data/motion-prime/views/_frame_calculator_mixin.rb +4 -8
  44. data/motion-prime/views/layout.rb +1 -0
  45. data/motion-prime/views/view_styler.rb +3 -12
  46. metadata +34 -26
  47. data/motion-prime/sections/_draw_mixin.rb +0 -66
checksums.yaml CHANGED
@@ -1,15 +1,7 @@
1
1
  ---
2
- !binary "U0hBMQ==":
3
- metadata.gz: !binary |-
4
- ZWVmZmZjNDVhMTMxZGE4ZjMzMWQyMzM0OWU4NDMzZGUzMjdmZTNjMQ==
5
- data.tar.gz: !binary |-
6
- ZDBkMTNhODQzYjQyZGMwOTI1ZTEwYWM2NzUyNTFjZDJhYTBiODUyZg==
7
- !binary "U0hBNTEy":
8
- metadata.gz: !binary |-
9
- NDJkY2JmMzAzMWFmY2QyODM0Yzg1ODllMjRmNDY2MWIzMTk5MDRlMDI5NWQ1
10
- NTIwZmJmYWE5Y2U2NzZjNWM3NGUwMTVkNDM0YzAyYzNiZjNlMDVkYmUwZGEw
11
- NTkxNWJlY2U5ODM4NTIyNWNhN2I2M2UzZTRiYmYyMDllYWM0NDc=
12
- data.tar.gz: !binary |-
13
- NTU5YzUwZmUwYWVhYWNiYzc0YWIzOGU4NzMxMDE4NGJkMjUyN2QxZjBkMGY3
14
- ZWJjMmMwN2E4YmZkMGM0YWZkZWI0NTBlYzIzYmEyM2NmNjVmNTJiNWUyZjZh
15
- M2Y0Yjk2MjYzNGI1NDkwZjU0NjNlYTMyNzUyMjY1YzQ4OTZkOTc=
2
+ SHA1:
3
+ metadata.gz: ed397d9e2fd731cd20575ece1c67b150915711c3
4
+ data.tar.gz: d35b535aafc6ccfc39b317ab15387b0d58032edd
5
+ SHA512:
6
+ metadata.gz: bf28b8ece9d90c0703b94b1763d0fb7ff61f7a6f7688d8355634ed0f76af2528e08e07f7e1d185824d8596715e251dc479fc99cca1e1f04114b0466f1d2b7c64
7
+ data.tar.gz: 35f315439efb220eb33d6c63def92b87dda91d52713abad7ad573956cc00a514de7d023aba6113282c07098f1a0f509b7094717386d1de22b98f197c63e2dabe
data/CHANGELOG.md CHANGED
@@ -1,3 +1,8 @@
1
+ === 0.4.4
2
+ * Added Prime.env support
3
+ * Added Prime.root support
4
+ * Fix memory leak issues
5
+
1
6
  === 0.4.3
2
7
  * Speed improvements
3
8
  * Rename dm_ views to mp_
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- motion-prime (0.4.3)
4
+ motion-prime (0.4.4)
5
5
  bubble-wrap
6
6
  cocoapods
7
7
  methadone
data/ROADMAP.md CHANGED
@@ -1,12 +1,17 @@
1
1
  === 0.5.0
2
- * rename support/dm_* to support/mp_*
3
2
  * "id" attribute should always be added to model by default
4
- * add DSL for ViewStyles#setValue conditions
5
- * add auto-symbol-value for Prime::Config.color items
3
+ * fix issue when draw element without table section in parent will not be drawn.
4
+ * Ability to pass "locals" while opening screen.
5
+ * navigation: true by default for screen initialization.
6
+ * separate screen.open_screen to screen.open_child and screen.open_modal.
7
+ * use model.assign_attributes instead of model.fetch_with_attributes and call it on initialization.
8
+ * separate sync#update and sync#fetch
6
9
 
7
10
  === 0.6.0
8
11
  * add testing framework
9
12
  * add auth backends to ApiClient: password auth and facebook auth
10
13
 
11
14
  === 0.7.0
12
- * add sections/screens/models generator
15
+ * add sections/screens/models generator
16
+ * add DSL for ViewStyles#setValue conditions
17
+ * add auto-symbol-value for Prime::Config.color items
@@ -20,8 +20,7 @@ end
20
20
 
21
21
  # **3. Create the main screen.**
22
22
  #
23
- # You should rewrite the `render` method, which will be runned after opening screen.
24
- # Note: you must always pass `screen` option, which points to screen to render
23
+ # You should rewrite the `render` method, which will be runned after first opening screen.
25
24
 
26
25
  class MainScreen < Prime::BaseScreen
27
26
  title 'Main screen'
@@ -0,0 +1,54 @@
1
+ # ** Render the screen. **
2
+ #
3
+ # You should rewrite the `render` method of Prime::BaseScreen, which will be runned after first opening screen.
4
+
5
+ class MainScreen < Prime::BaseScreen
6
+ def render
7
+ @main_section = MyProfileSection.new(screen: self, model: User.first)
8
+ @main_section.render
9
+ end
10
+ end
11
+
12
+ # ** Set screen's title **
13
+ #
14
+ # This title will be used in screen's navigation controller and will be shown there.
15
+
16
+ class MainScreen < Prime::BaseScreen
17
+ title 'Main screen'
18
+ end
19
+
20
+ # Also, you can pass block to define screen's title
21
+
22
+ class MainScreen < Prime::BaseScreen
23
+ title { params[:title] }
24
+ end
25
+
26
+ # ** Initialize screen. **
27
+ #
28
+ # Available options:
29
+ # * :navigation. when this options is true, screen will be created with navigation support, like left and right buttons and title.
30
+ # This option is false by default.
31
+
32
+ screen = MainScreen.new(navigation: true)
33
+
34
+ # ** Open screen: using app delegate. **
35
+
36
+ # Opening screen using app delegate is the most basic way, you would do it at least on app load.
37
+ #
38
+ # Available options:
39
+ # * :root. when this option is true, screen will not be in content controller and will create new root screen.
40
+ # You can use root: true when you have already opened screen with sidebar, and you want to open new screen without sidebar.
41
+ # This option is false by default if you already have root screen and true if not.
42
+ #
43
+ # * :sidebar. send Prime::BaseScreen instance to this option if you want to create root screen with sidebar.
44
+ # value of this options will be used as sidebar controller.
45
+
46
+ app_delegate.open_screen MainScreen.new(navigation: true), sidebar: MySidebar.new
47
+
48
+ # ** Open screen: using parent screen. **
49
+
50
+ # Opening screen using parent screen is usefull if you want to create inherited screen.
51
+ # Parent screen should have been initialized with navigation support.
52
+
53
+ screen.open_screen AnotherScreen.new(navigation: true)
54
+
@@ -11,6 +11,27 @@
11
11
  <div id="container">
12
12
  <div id="background"></div>
13
13
 
14
+ <ul id="jump_to">
15
+ <li>
16
+ <a class="large" href="javascript:void(0);">Jump To &hellip;</a>
17
+ <a class="small" href="javascript:void(0);">+</a>
18
+ <div id="jump_wrapper">
19
+ <div id="jump_page">
20
+
21
+
22
+ <a class="source" href="getting_started.html">
23
+ getting_started.rb
24
+ </a>
25
+
26
+
27
+ <a class="source" href="screens.html">
28
+ screens.rb
29
+ </a>
30
+
31
+ </div>
32
+ </li>
33
+ </ul>
34
+
14
35
  <ul class="sections">
15
36
 
16
37
  <li id="title">
@@ -98,7 +119,7 @@ Note: you should always use AppDelegate class name.</p>
98
119
  <a class="pilcrow" href="#section-5">&#182;</a>
99
120
  </div>
100
121
  <p><strong>3. Create the main screen.</strong></p>
101
- <p>You should rewrite the <code>render</code> method, which will be runned after opening screen.</p>
122
+ <p>You should rewrite the <code>render</code> method, which will be runned after first opening screen.</p>
102
123
 
103
124
  </div>
104
125
 
@@ -106,8 +127,8 @@ Note: you should always use AppDelegate class name.</p>
106
127
  title <span class="string">'Main screen'</span>
107
128
 
108
129
  <span class="function"><span class="keyword">def</span> <span class="title">render</span></span>
109
- <span class="variable">@main_section</span> = <span class="constant">MyProfileSection</span>.new(<span class="symbol">model:</span> <span class="constant">User</span>.first)
110
- <span class="variable">@main_section</span>.render(<span class="symbol">to:</span> <span class="keyword">self</span>)
130
+ <span class="variable">@main_section</span> = <span class="constant">MyProfileSection</span>.new(<span class="symbol">screen:</span> <span class="keyword">self</span>, <span class="symbol">model:</span> <span class="constant">User</span>.first)
131
+ <span class="variable">@main_section</span>.render
111
132
  <span class="keyword">end</span>
112
133
  <span class="keyword">end</span></pre></div></div>
113
134
 
@@ -122,7 +143,7 @@ Note: you should always use AppDelegate class name.</p>
122
143
  </div>
123
144
  <p><strong>4. Create your first section.</strong></p>
124
145
  <p>&quot;Section&quot; is something like helper, which contains &quot;Elements&quot;.</p>
125
- <p>Each element will be added to the parent screen when you run <code>section.render(to: screen)</code></p>
146
+ <p>Each element will be added to the parent screen when you run <code>section.render</code></p>
126
147
 
127
148
  </div>
128
149
 
@@ -141,9 +162,9 @@ Note: you should always use AppDelegate class name.</p>
141
162
  <a class="pilcrow" href="#section-7">&#182;</a>
142
163
  </div>
143
164
  <p><strong>5. Create your first stylesheet file.</strong></p>
144
- <p>Styles will be applied to each element in section.
165
+ <p>Styles will be applied to each element in section.
145
166
  The simplest rule by default is: <code>:section-name_:element-name</code>.</p>
146
- <p>E.g. if you have &#39;MyProfileSection&#39; (the name for section by default will be - <code>my_profile</code>)
167
+ <p>E.g. if you have &#39;MyProfileSection&#39; (the name for section by default will be - <code>my_profile</code>)
147
168
  and &#39;title&#39; element, then you should use <code>my_profile_title</code> style name.</p>
148
169
 
149
170
  </div>
@@ -0,0 +1,166 @@
1
+ <!DOCTYPE html>
2
+
3
+ <html>
4
+ <head>
5
+ <title>screens.rb</title>
6
+ <meta http-equiv="content-type" content="text/html; charset=UTF-8">
7
+ <meta name="viewport" content="width=device-width, target-densitydpi=160dpi, initial-scale=1.0; maximum-scale=1.0; user-scalable=0;">
8
+ <link rel="stylesheet" media="all" href="docco.css" />
9
+ </head>
10
+ <body>
11
+ <div id="container">
12
+ <div id="background"></div>
13
+
14
+ <ul id="jump_to">
15
+ <li>
16
+ <a class="large" href="javascript:void(0);">Jump To &hellip;</a>
17
+ <a class="small" href="javascript:void(0);">+</a>
18
+ <div id="jump_wrapper">
19
+ <div id="jump_page">
20
+
21
+
22
+ <a class="source" href="getting_started.html">
23
+ getting_started.rb
24
+ </a>
25
+
26
+
27
+ <a class="source" href="screens.html">
28
+ screens.rb
29
+ </a>
30
+
31
+ </div>
32
+ </li>
33
+ </ul>
34
+
35
+ <ul class="sections">
36
+
37
+ <li id="title">
38
+ <div class="annotation">
39
+ <h1>screens.rb</h1>
40
+ </div>
41
+ </li>
42
+
43
+
44
+
45
+ <li id="section-1">
46
+ <div class="annotation">
47
+
48
+ <div class="pilwrap ">
49
+ <a class="pilcrow" href="#section-1">&#182;</a>
50
+ </div>
51
+ <p><strong> Render the screen. </strong></p>
52
+ <p>You should rewrite the <code>render</code> method of Prime::BaseScreen, which will be runned after first opening screen.</p>
53
+
54
+ </div>
55
+
56
+ <div class="content"><div class='highlight'><pre><span class="class"><span class="keyword">class</span> <span class="title">MainScreen</span> <span class="inheritance">&lt; <span class="parent">Prime::BaseScreen</span></span></span>
57
+ <span class="function"><span class="keyword">def</span> <span class="title">render</span></span>
58
+ <span class="variable">@main_section</span> = <span class="constant">MyProfileSection</span>.new(<span class="symbol">screen:</span> <span class="keyword">self</span>, <span class="symbol">model:</span> <span class="constant">User</span>.first)
59
+ <span class="variable">@main_section</span>.render
60
+ <span class="keyword">end</span>
61
+ <span class="keyword">end</span></pre></div></div>
62
+
63
+ </li>
64
+
65
+
66
+ <li id="section-2">
67
+ <div class="annotation">
68
+
69
+ <div class="pilwrap ">
70
+ <a class="pilcrow" href="#section-2">&#182;</a>
71
+ </div>
72
+ <p><strong> Set screen&#39;s title </strong></p>
73
+ <p>This title will be used in screen&#39;s navigation controller and will be shown there.</p>
74
+
75
+ </div>
76
+
77
+ <div class="content"><div class='highlight'><pre><span class="class"><span class="keyword">class</span> <span class="title">MainScreen</span> <span class="inheritance">&lt; <span class="parent">Prime::BaseScreen</span></span></span>
78
+ title <span class="string">'Main screen'</span>
79
+ <span class="keyword">end</span></pre></div></div>
80
+
81
+ </li>
82
+
83
+
84
+ <li id="section-3">
85
+ <div class="annotation">
86
+
87
+ <div class="pilwrap ">
88
+ <a class="pilcrow" href="#section-3">&#182;</a>
89
+ </div>
90
+ <p>Also, you can pass block to define screen&#39;s title</p>
91
+
92
+ </div>
93
+
94
+ <div class="content"><div class='highlight'><pre><span class="class"><span class="keyword">class</span> <span class="title">MainScreen</span> <span class="inheritance">&lt; <span class="parent">Prime::BaseScreen</span></span></span>
95
+ title { params[<span class="symbol">:title</span>] }
96
+ <span class="keyword">end</span></pre></div></div>
97
+
98
+ </li>
99
+
100
+
101
+ <li id="section-4">
102
+ <div class="annotation">
103
+
104
+ <div class="pilwrap ">
105
+ <a class="pilcrow" href="#section-4">&#182;</a>
106
+ </div>
107
+ <p><strong> Initialize screen. </strong></p>
108
+ <p>Available options:</p>
109
+ <ul>
110
+ <li>:navigation. when this options is true, screen will be created with navigation support, like left and right buttons and title.
111
+ This option is false by default.</li>
112
+ </ul>
113
+
114
+ </div>
115
+
116
+ <div class="content"><div class='highlight'><pre>screen = <span class="constant">MainScreen</span>.new(<span class="symbol">navigation:</span> <span class="keyword">true</span>)</pre></div></div>
117
+
118
+ </li>
119
+
120
+
121
+ <li id="section-5">
122
+ <div class="annotation">
123
+
124
+ <div class="pilwrap ">
125
+ <a class="pilcrow" href="#section-5">&#182;</a>
126
+ </div>
127
+ <p><strong> Open screen: using app delegate. </strong></p>
128
+ <p>Opening screen using app delegate is the most basic way, you would do it at least on app load.</p>
129
+ <p>Available options:</p>
130
+ <ul>
131
+ <li><p>:root. when this option is true, screen will not be in content controller and will create new root screen.
132
+ You can use root: true when you have already opened screen with sidebar, and you want to open new screen without sidebar.
133
+ This option is false by default if you already have root screen and true if not.</p>
134
+ </li>
135
+ <li><p>:sidebar. send Prime::BaseScreen instance to this option if you want to create root screen with sidebar.
136
+ value of this options will be used as sidebar controller.</p>
137
+ </li>
138
+ </ul>
139
+
140
+ </div>
141
+
142
+ <div class="content"><div class='highlight'><pre>app_delegate.open_screen <span class="constant">MainScreen</span>.new(<span class="symbol">navigation:</span> <span class="keyword">true</span>), <span class="symbol">sidebar:</span> <span class="constant">MySidebar</span>.new</pre></div></div>
143
+
144
+ </li>
145
+
146
+
147
+ <li id="section-6">
148
+ <div class="annotation">
149
+
150
+ <div class="pilwrap ">
151
+ <a class="pilcrow" href="#section-6">&#182;</a>
152
+ </div>
153
+ <p><strong> Open screen: using parent screen. </strong></p>
154
+ <p>Opening screen using parent screen is usefull if you want to create inherited screen.
155
+ Parent screen should have been initialized with navigation support.</p>
156
+
157
+ </div>
158
+
159
+ <div class="content"><div class='highlight'><pre>screen.open_screen <span class="constant">AnotherScreen</span>.new(<span class="symbol">navigation:</span> <span class="keyword">true</span>)</pre></div></div>
160
+
161
+ </li>
162
+
163
+ </ul>
164
+ </div>
165
+ </body>
166
+ </html>
data/files/Gemfile CHANGED
@@ -5,4 +5,4 @@ gem 'motion-support', '~> 0.2.4'
5
5
  gem 'sugarcube', '~> 1.3.7', require: 'sugarcube-classic'
6
6
  gem 'bubble-wrap', '~> 1.3.0'
7
7
 
8
- gem 'motion-prime', '~> 0.4.2'
8
+ gem 'motion-prime', '~> 0.4.4'
@@ -0,0 +1,64 @@
1
+ GEM
2
+ remote: http://rubygems.org/
3
+ specs:
4
+ activesupport (3.2.16)
5
+ i18n (~> 0.6, >= 0.6.4)
6
+ multi_json (~> 1.0)
7
+ bubble-wrap (1.3.0)
8
+ claide (0.4.0)
9
+ cocoapods (0.28.0)
10
+ activesupport (>= 3.2.15, < 4)
11
+ claide (~> 0.4.0)
12
+ cocoapods-core (= 0.28.0)
13
+ cocoapods-downloader (~> 0.2.0)
14
+ colored (~> 1.2)
15
+ escape (~> 0.0.4)
16
+ json_pure (~> 1.8)
17
+ open4 (~> 1.3)
18
+ xcodeproj (~> 0.14.1)
19
+ cocoapods-core (0.28.0)
20
+ activesupport (>= 3.2.15, < 4)
21
+ fuzzy_match (~> 2.0.4)
22
+ json (~> 1.8)
23
+ nap (~> 0.5)
24
+ cocoapods-downloader (0.2.0)
25
+ colored (1.2)
26
+ escape (0.0.4)
27
+ fuzzy_match (2.0.4)
28
+ i18n (0.6.9)
29
+ json (1.8.1)
30
+ json_pure (1.8.1)
31
+ methadone (1.3.1)
32
+ bundler
33
+ motion-cocoapods (1.4.0)
34
+ cocoapods (>= 0.26.2)
35
+ motion-prime (0.4.3)
36
+ bubble-wrap
37
+ cocoapods
38
+ methadone
39
+ motion-cocoapods
40
+ motion-require
41
+ motion-support
42
+ sugarcube
43
+ motion-require (0.0.7)
44
+ motion-support (0.2.5)
45
+ motion-require (>= 0.0.6)
46
+ multi_json (1.8.2)
47
+ nap (0.6.0)
48
+ open4 (1.3.0)
49
+ rake (10.1.1)
50
+ sugarcube (1.3.11)
51
+ xcodeproj (0.14.1)
52
+ activesupport (~> 3.0)
53
+ colored (~> 1.2)
54
+ rake
55
+
56
+ PLATFORMS
57
+ ruby
58
+
59
+ DEPENDENCIES
60
+ bubble-wrap (~> 1.3.0)
61
+ motion-cocoapods (~> 1.4.0)
62
+ motion-prime (~> 0.4.3)
63
+ motion-support (~> 0.2.4)
64
+ sugarcube (~> 1.3.7)
@@ -0,0 +1,10 @@
1
+ module MotionPrime
2
+ def self.env
3
+ ENV['PRIME_ENV'] || ENV['RUBYMOTION_ENV'] || 'development'
4
+ end
5
+
6
+ def self.root
7
+ File.expand_path File.dirname(__FILE__) + '/../'
8
+ end
9
+ end
10
+ ::Prime = MotionPrime unless defined?(::Prime)