motion-prime 0.9.6 → 0.9.7

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 (90) hide show
  1. checksums.yaml +8 -8
  2. data/CHANGELOG.md +6 -0
  3. data/Gemfile.lock +6 -6
  4. data/README.md +1 -10
  5. data/Rakefile +0 -1
  6. data/app/app_delegate.rb +1 -1
  7. data/bin/prime +1 -1
  8. data/files/Gemfile +1 -1
  9. data/motion-prime/api_client.rb +87 -31
  10. data/motion-prime/config/base.rb +20 -11
  11. data/motion-prime/config/config.rb +9 -3
  12. data/motion-prime/core_ext/kernel.rb +2 -1
  13. data/motion-prime/core_ext/nil_class.rb +5 -0
  14. data/motion-prime/delegate/app_delegate.rb +5 -0
  15. data/motion-prime/elements/base_element.rb +21 -2
  16. data/motion-prime/elements/draw.rb +6 -16
  17. data/motion-prime/helpers/has_authorization.rb +1 -1
  18. data/motion-prime/models/_base_mixin.rb +1 -1
  19. data/motion-prime/prime.rb +4 -0
  20. data/motion-prime/screens/extensions/_indicators_mixin.rb +16 -10
  21. data/motion-prime/screens/screen.rb +1 -1
  22. data/motion-prime/sections/_async_table_mixin.rb +1 -2
  23. data/motion-prime/sections/_draw_section_mixin.rb +3 -1
  24. data/motion-prime/sections/base_section.rb +37 -26
  25. data/motion-prime/sections/form.rb +23 -8
  26. data/motion-prime/sections/form/base_field_section.rb +1 -15
  27. data/motion-prime/sections/form/date_field_section.rb +1 -1
  28. data/motion-prime/sections/form/password_field_section.rb +1 -1
  29. data/motion-prime/sections/form/select_field_section.rb +1 -1
  30. data/motion-prime/sections/form/string_field_section.rb +1 -1
  31. data/motion-prime/sections/form/submit_field_section.rb +1 -1
  32. data/motion-prime/sections/form/text_field_section.rb +1 -1
  33. data/motion-prime/sections/table.rb +58 -27
  34. data/motion-prime/sections/table/refresh_mixin.rb +1 -1
  35. data/motion-prime/services/logger.rb +60 -21
  36. data/motion-prime/support/consts.rb +11 -0
  37. data/motion-prime/version.rb +1 -1
  38. data/motion-prime/views/layout.rb +5 -4
  39. data/motion-prime/views/view_styler.rb +3 -0
  40. data/spec/{helpers → factories}/delegates.rb +0 -3
  41. data/spec/{helpers → factories}/init.rb +0 -0
  42. data/spec/{helpers → factories}/models.rb +0 -0
  43. data/spec/factories/scaffold/models/task.rb +4 -0
  44. data/spec/factories/scaffold/screens/tasks.rb +45 -0
  45. data/spec/factories/scaffold/sections/tasks/form.rb +31 -0
  46. data/spec/factories/scaffold/sections/tasks/index_cell.rb +4 -0
  47. data/spec/factories/scaffold/sections/tasks/index_table.rb +12 -0
  48. data/spec/factories/scaffold/sections/tasks/show.rb +3 -0
  49. data/spec/factories/scaffold/styles/tasks.rb +18 -0
  50. data/spec/{helpers → factories}/screens.rb +0 -0
  51. data/spec/factories/sections.rb +9 -0
  52. data/spec/features/scaffold/index.rb +14 -0
  53. data/spec/features/screens/open_screen.rb +14 -2
  54. data/spec/helpers/has_content.rb +25 -0
  55. data/spec/unit/models/dirty_spec.rb +0 -1
  56. data/spec/unit/models/model_spec.rb +2 -0
  57. data/spec/unit/prime/logger.rb +49 -0
  58. data/spec/unit/sections/section_spec.rb +59 -0
  59. data/travis.sh +1 -1
  60. metadata +36 -41
  61. data/doc/FAQ.md +0 -2
  62. data/doc/SECTION.md +0 -7
  63. data/doc/STYLE.md +0 -39
  64. data/doc/code/getting_started.rb +0 -106
  65. data/doc/code/models.rb +0 -36
  66. data/doc/code/screens.rb +0 -93
  67. data/doc/code/sections.rb +0 -65
  68. data/doc/code/tables.rb +0 -54
  69. data/doc/docs/docco.css +0 -337
  70. data/doc/docs/getting_started.html +0 -195
  71. data/doc/docs/index.html +0 -205
  72. data/doc/docs/models.html +0 -115
  73. data/doc/docs/public/fonts/aller-bold.eot +0 -0
  74. data/doc/docs/public/fonts/aller-bold.ttf +0 -0
  75. data/doc/docs/public/fonts/aller-bold.woff +0 -0
  76. data/doc/docs/public/fonts/aller-light.eot +0 -0
  77. data/doc/docs/public/fonts/aller-light.ttf +0 -0
  78. data/doc/docs/public/fonts/aller-light.woff +0 -0
  79. data/doc/docs/public/fonts/fleurons.eot +0 -0
  80. data/doc/docs/public/fonts/fleurons.ttf +0 -0
  81. data/doc/docs/public/fonts/fleurons.woff +0 -0
  82. data/doc/docs/public/fonts/novecento-bold.eot +0 -0
  83. data/doc/docs/public/fonts/novecento-bold.ttf +0 -0
  84. data/doc/docs/public/fonts/novecento-bold.woff +0 -0
  85. data/doc/docs/public/images/gray.png +0 -0
  86. data/doc/docs/public/stylesheets/normalize.css +0 -375
  87. data/doc/docs/screens.html +0 -187
  88. data/doc/docs/sections.html +0 -138
  89. data/doc/docs/tables.html +0 -128
  90. data/spec/helpers/sections.rb +0 -3
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
@@ -1,375 +0,0 @@
1
- /*! normalize.css v2.0.1 | MIT License | git.io/normalize */
2
-
3
- /* ==========================================================================
4
- HTML5 display definitions
5
- ========================================================================== */
6
-
7
- /*
8
- * Corrects `block` display not defined in IE 8/9.
9
- */
10
-
11
- article,
12
- aside,
13
- details,
14
- figcaption,
15
- figure,
16
- footer,
17
- header,
18
- hgroup,
19
- nav,
20
- section,
21
- summary {
22
- display: block;
23
- }
24
-
25
- /*
26
- * Corrects `inline-block` display not defined in IE 8/9.
27
- */
28
-
29
- audio,
30
- canvas,
31
- video {
32
- display: inline-block;
33
- }
34
-
35
- /*
36
- * Prevents modern browsers from displaying `audio` without controls.
37
- * Remove excess height in iOS 5 devices.
38
- */
39
-
40
- audio:not([controls]) {
41
- display: none;
42
- height: 0;
43
- }
44
-
45
- /*
46
- * Addresses styling for `hidden` attribute not present in IE 8/9.
47
- */
48
-
49
- [hidden] {
50
- display: none;
51
- }
52
-
53
- /* ==========================================================================
54
- Base
55
- ========================================================================== */
56
-
57
- /*
58
- * 1. Sets default font family to sans-serif.
59
- * 2. Prevents iOS text size adjust after orientation change, without disabling
60
- * user zoom.
61
- */
62
-
63
- html {
64
- font-family: sans-serif; /* 1 */
65
- -webkit-text-size-adjust: 100%; /* 2 */
66
- -ms-text-size-adjust: 100%; /* 2 */
67
- }
68
-
69
- /*
70
- * Removes default margin.
71
- */
72
-
73
- body {
74
- margin: 0;
75
- }
76
-
77
- /* ==========================================================================
78
- Links
79
- ========================================================================== */
80
-
81
- /*
82
- * Addresses `outline` inconsistency between Chrome and other browsers.
83
- */
84
-
85
- a:focus {
86
- outline: thin dotted;
87
- }
88
-
89
- /*
90
- * Improves readability when focused and also mouse hovered in all browsers.
91
- */
92
-
93
- a:active,
94
- a:hover {
95
- outline: 0;
96
- }
97
-
98
- /* ==========================================================================
99
- Typography
100
- ========================================================================== */
101
-
102
- /*
103
- * Addresses `h1` font sizes within `section` and `article` in Firefox 4+,
104
- * Safari 5, and Chrome.
105
- */
106
-
107
- h1 {
108
- font-size: 2em;
109
- }
110
-
111
- /*
112
- * Addresses styling not present in IE 8/9, Safari 5, and Chrome.
113
- */
114
-
115
- abbr[title] {
116
- border-bottom: 1px dotted;
117
- }
118
-
119
- /*
120
- * Addresses style set to `bolder` in Firefox 4+, Safari 5, and Chrome.
121
- */
122
-
123
- b,
124
- strong {
125
- font-weight: bold;
126
- }
127
-
128
- /*
129
- * Addresses styling not present in Safari 5 and Chrome.
130
- */
131
-
132
- dfn {
133
- font-style: italic;
134
- }
135
-
136
- /*
137
- * Addresses styling not present in IE 8/9.
138
- */
139
-
140
- mark {
141
- background: #ff0;
142
- color: #000;
143
- }
144
-
145
-
146
- /*
147
- * Corrects font family set oddly in Safari 5 and Chrome.
148
- */
149
-
150
- code,
151
- kbd,
152
- pre,
153
- samp {
154
- font-family: monospace, serif;
155
- font-size: 1em;
156
- }
157
-
158
- /*
159
- * Improves readability of pre-formatted text in all browsers.
160
- */
161
-
162
- pre {
163
- white-space: pre;
164
- white-space: pre-wrap;
165
- word-wrap: break-word;
166
- }
167
-
168
- /*
169
- * Sets consistent quote types.
170
- */
171
-
172
- q {
173
- quotes: "\201C" "\201D" "\2018" "\2019";
174
- }
175
-
176
- /*
177
- * Addresses inconsistent and variable font size in all browsers.
178
- */
179
-
180
- small {
181
- font-size: 80%;
182
- }
183
-
184
- /*
185
- * Prevents `sub` and `sup` affecting `line-height` in all browsers.
186
- */
187
-
188
- sub,
189
- sup {
190
- font-size: 75%;
191
- line-height: 0;
192
- position: relative;
193
- vertical-align: baseline;
194
- }
195
-
196
- sup {
197
- top: -0.5em;
198
- }
199
-
200
- sub {
201
- bottom: -0.25em;
202
- }
203
-
204
- /* ==========================================================================
205
- Embedded content
206
- ========================================================================== */
207
-
208
- /*
209
- * Removes border when inside `a` element in IE 8/9.
210
- */
211
-
212
- img {
213
- border: 0;
214
- }
215
-
216
- /*
217
- * Corrects overflow displayed oddly in IE 9.
218
- */
219
-
220
- svg:not(:root) {
221
- overflow: hidden;
222
- }
223
-
224
- /* ==========================================================================
225
- Figures
226
- ========================================================================== */
227
-
228
- /*
229
- * Addresses margin not present in IE 8/9 and Safari 5.
230
- */
231
-
232
- figure {
233
- margin: 0;
234
- }
235
-
236
- /* ==========================================================================
237
- Forms
238
- ========================================================================== */
239
-
240
- /*
241
- * Define consistent border, margin, and padding.
242
- */
243
-
244
- fieldset {
245
- border: 1px solid #c0c0c0;
246
- margin: 0 2px;
247
- padding: 0.35em 0.625em 0.75em;
248
- }
249
-
250
- /*
251
- * 1. Corrects color not being inherited in IE 8/9.
252
- * 2. Remove padding so people aren't caught out if they zero out fieldsets.
253
- */
254
-
255
- legend {
256
- border: 0; /* 1 */
257
- padding: 0; /* 2 */
258
- }
259
-
260
- /*
261
- * 1. Corrects font family not being inherited in all browsers.
262
- * 2. Corrects font size not being inherited in all browsers.
263
- * 3. Addresses margins set differently in Firefox 4+, Safari 5, and Chrome
264
- */
265
-
266
- button,
267
- input,
268
- select,
269
- textarea {
270
- font-family: inherit; /* 1 */
271
- font-size: 100%; /* 2 */
272
- margin: 0; /* 3 */
273
- }
274
-
275
- /*
276
- * Addresses Firefox 4+ setting `line-height` on `input` using `!important` in
277
- * the UA stylesheet.
278
- */
279
-
280
- button,
281
- input {
282
- line-height: normal;
283
- }
284
-
285
- /*
286
- * 1. Avoid the WebKit bug in Android 4.0.* where (2) destroys native `audio`
287
- * and `video` controls.
288
- * 2. Corrects inability to style clickable `input` types in iOS.
289
- * 3. Improves usability and consistency of cursor style between image-type
290
- * `input` and others.
291
- */
292
-
293
- button,
294
- html input[type="button"], /* 1 */
295
- input[type="reset"],
296
- input[type="submit"] {
297
- -webkit-appearance: button; /* 2 */
298
- cursor: pointer; /* 3 */
299
- }
300
-
301
- /*
302
- * Re-set default cursor for disabled elements.
303
- */
304
-
305
- button[disabled],
306
- input[disabled] {
307
- cursor: default;
308
- }
309
-
310
- /*
311
- * 1. Addresses box sizing set to `content-box` in IE 8/9.
312
- * 2. Removes excess padding in IE 8/9.
313
- */
314
-
315
- input[type="checkbox"],
316
- input[type="radio"] {
317
- box-sizing: border-box; /* 1 */
318
- padding: 0; /* 2 */
319
- }
320
-
321
- /*
322
- * 1. Addresses `appearance` set to `searchfield` in Safari 5 and Chrome.
323
- * 2. Addresses `box-sizing` set to `border-box` in Safari 5 and Chrome
324
- * (include `-moz` to future-proof).
325
- */
326
-
327
- input[type="search"] {
328
- -webkit-appearance: textfield; /* 1 */
329
- -moz-box-sizing: content-box;
330
- -webkit-box-sizing: content-box; /* 2 */
331
- box-sizing: content-box;
332
- }
333
-
334
- /*
335
- * Removes inner padding and search cancel button in Safari 5 and Chrome
336
- * on OS X.
337
- */
338
-
339
- input[type="search"]::-webkit-search-cancel-button,
340
- input[type="search"]::-webkit-search-decoration {
341
- -webkit-appearance: none;
342
- }
343
-
344
- /*
345
- * Removes inner padding and border in Firefox 4+.
346
- */
347
-
348
- button::-moz-focus-inner,
349
- input::-moz-focus-inner {
350
- border: 0;
351
- padding: 0;
352
- }
353
-
354
- /*
355
- * 1. Removes default vertical scrollbar in IE 8/9.
356
- * 2. Improves readability and alignment in all browsers.
357
- */
358
-
359
- textarea {
360
- overflow: auto; /* 1 */
361
- vertical-align: top; /* 2 */
362
- }
363
-
364
- /* ==========================================================================
365
- Tables
366
- ========================================================================== */
367
-
368
- /*
369
- * Remove most spacing between table cells.
370
- */
371
-
372
- table {
373
- border-collapse: collapse;
374
- border-spacing: 0;
375
- }
@@ -1,187 +0,0 @@
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
- <link rel="stylesheet" media="all" href="public/stylesheets/normalize.css" />
8
- <link rel="stylesheet" media="all" href="docco.css" />
9
- </head>
10
- <body>
11
- <div class="container">
12
- <div class="page">
13
-
14
- <div class="header">
15
-
16
- <h1>screens.rb</h1>
17
-
18
-
19
-
20
- <div class="toc">
21
- <h3>Table of Contents</h3>
22
- <ol>
23
-
24
-
25
- <li>
26
- <a class="source" href="getting_started.html">
27
- getting_started.rb
28
- </a>
29
- </li>
30
-
31
-
32
- <li>
33
- <a class="source" href="models.html">
34
- models.rb
35
- </a>
36
- </li>
37
-
38
-
39
- <li>
40
- <a class="source" href="screens.html">
41
- screens.rb
42
- </a>
43
- </li>
44
-
45
-
46
- <li>
47
- <a class="source" href="sections.html">
48
- sections.rb
49
- </a>
50
- </li>
51
-
52
-
53
- <li>
54
- <a class="source" href="tables.html">
55
- tables.rb
56
- </a>
57
- </li>
58
-
59
- </ol>
60
- </div>
61
-
62
- </div>
63
-
64
-
65
-
66
- <p><strong> What is a Screen? </strong></p>
67
- <p>&quot;Screen&quot; is the most common class in MotionPrime, you can create entire application using only &quot;Screens&quot;.
68
- Generally it&#39;s just a &quot;UIViewController&quot; wrapper with some syntax sugar.
69
- For RubyOnRails developers the nearest analogy would be &quot;Controllers&quot;.</p>
70
- <p><strong> Create a screen. </strong></p>
71
- <p>Just inherit it from <code>Prime::Screen</code>.</p>
72
-
73
-
74
- <div class='highlight'><pre><span class="class"><span class="keyword">class</span> <span class="title">FooScreen</span> <span class="inheritance">&lt; <span class="parent">Prime::Screen</span></span></span>
75
- <span class="keyword">end</span></pre></div>
76
-
77
-
78
-
79
- <p><strong> Render the screen. </strong></p>
80
- <p>You should rewrite the <code>render</code> method of <code>Prime::Screen</code>, which will be runned after first opening screen.</p>
81
-
82
-
83
- <div class='highlight'><pre><span class="class"><span class="keyword">class</span> <span class="title">FooScreen</span> <span class="inheritance">&lt; <span class="parent">Prime::Screen</span></span></span>
84
- <span class="function"><span class="keyword">def</span> <span class="title">render</span></span>
85
- <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)
86
- <span class="variable">@main_section</span>.render
87
- <span class="keyword">end</span>
88
- <span class="keyword">end</span></pre></div>
89
-
90
-
91
-
92
- <p><strong> Set screen&#39;s title </strong></p>
93
- <p>Title will be used in screen&#39;s navigation controller and will be shown on top of screen.</p>
94
-
95
-
96
- <div class='highlight'><pre><span class="class"><span class="keyword">class</span> <span class="title">FooScreen</span> <span class="inheritance">&lt; <span class="parent">Prime::Screen</span></span></span>
97
- title <span class="string">'Foo screen'</span>
98
- <span class="keyword">end</span></pre></div>
99
-
100
-
101
-
102
- <p>You can pass block to define screen&#39;s title</p>
103
-
104
-
105
- <div class='highlight'><pre><span class="class"><span class="keyword">class</span> <span class="title">FooScreen</span> <span class="inheritance">&lt; <span class="parent">Prime::Screen</span></span></span>
106
- title { params[<span class="symbol">:title</span>] }
107
- <span class="keyword">end</span></pre></div>
108
-
109
-
110
-
111
- <p><strong> Initialize screen. </strong></p>
112
- <p>Available options:</p>
113
- <ul>
114
- <li><code>:navigation</code>. When this options is true, screen will be created with navigation support: it will allow adding title and left/right buttons.
115
- This option is true by default.</li>
116
- </ul>
117
-
118
-
119
- <div class='highlight'><pre><span class="class"><span class="keyword">class</span> <span class="title">AppDelegate</span> <span class="inheritance">&lt; <span class="parent">Prime::BaseAppDelegate</span></span></span>
120
- <span class="function"><span class="keyword">def</span> <span class="title">on_load</span><span class="params">(application, launch_options)</span></span>
121
- foo_screen = <span class="constant">FooScreen</span>.new(<span class="symbol">navigation:</span> <span class="keyword">false</span>)
122
- <span class="keyword">end</span>
123
- <span class="keyword">end</span></pre></div>
124
-
125
-
126
-
127
- <p><strong> Open screen: from app delegate. </strong></p>
128
- <p>Opening screen using app delegate is the most basic way, you would use it at least on app load.</p>
129
- <p>Available options:</p>
130
- <ul>
131
- <li><p><code>:root</code>. 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><code>:sidebar</code>. Send <code>Prime::Screen</code> instance to this option if you want to create root screen with sidebar.
136
- Value of this options will be used as sidebar controller.
137
- NOTE: you should install some gem providing sidebar functionality, e.g. &#39;prime_reside_menu&#39;</p>
138
- </li>
139
- </ul>
140
-
141
-
142
- <div class='highlight'><pre><span class="class"><span class="keyword">class</span> <span class="title">AppDelegate</span> <span class="inheritance">&lt; <span class="parent">Prime::BaseAppDelegate</span></span></span>
143
- <span class="function"><span class="keyword">def</span> <span class="title">on_load</span><span class="params">(application, launch_options)</span></span>
144
- foo_screen = <span class="constant">FooScreen</span>.new
145
- sidebar = <span class="constant">MySidebar</span>.new(<span class="symbol">navigation:</span> <span class="keyword">false</span>)
146
- app_delegate.open_screen foo_screen, <span class="symbol">sidebar:</span> sidebar
147
- <span class="keyword">end</span>
148
- <span class="keyword">end</span></pre></div>
149
-
150
-
151
-
152
- <p><strong> Open screen: from parent screen. </strong></p>
153
- <p>Opening screen using parent screen is usefull if you want to create inherited screen.
154
- Parent screen should have been initialized with navigation support.</p>
155
-
156
-
157
- <div class='highlight'><pre><span class="class"><span class="keyword">class</span> <span class="title">FooScreen</span> <span class="inheritance">&lt; <span class="parent">Prime::Screen</span></span></span>
158
- <span class="function"><span class="keyword">def</span> <span class="title">render</span></span>
159
- second_screen = <span class="constant">SecondScreen</span>.new(<span class="symbol">navigation:</span> <span class="keyword">true</span>)
160
- foo_screen.open_screen second_screen
161
- <span class="keyword">end</span>
162
- <span class="keyword">end</span></pre></div>
163
-
164
-
165
-
166
- <p><strong> Open screen: using short version. </strong></p>
167
- <p>Opening screen using short syntax available both for opening via app delegate and via parent screen.</p>
168
-
169
-
170
- <div class='highlight'><pre><span class="class"><span class="keyword">class</span> <span class="title">AppDelegate</span> <span class="inheritance">&lt; <span class="parent">Prime::BaseAppDelegate</span></span></span>
171
- <span class="function"><span class="keyword">def</span> <span class="title">on_load</span><span class="params">(application, launch_options)</span></span>
172
- open_screen <span class="symbol">:foo_bar</span>, <span class="symbol">sidebar:</span> <span class="keyword">true</span>
173
- <span class="keyword">end</span>
174
- <span class="keyword">end</span></pre></div>
175
-
176
-
177
-
178
- <p><strong> Next </strong></p>
179
- <p><a href="sections.html">Read more about Sections</a></p>
180
-
181
-
182
-
183
- <div class="fleur">h</div>
184
- </div>
185
- </div>
186
- </body>
187
- </html>