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.
- checksums.yaml +8 -8
- data/CHANGELOG.md +6 -0
- data/Gemfile.lock +6 -6
- data/README.md +1 -10
- data/Rakefile +0 -1
- data/app/app_delegate.rb +1 -1
- data/bin/prime +1 -1
- data/files/Gemfile +1 -1
- data/motion-prime/api_client.rb +87 -31
- data/motion-prime/config/base.rb +20 -11
- data/motion-prime/config/config.rb +9 -3
- data/motion-prime/core_ext/kernel.rb +2 -1
- data/motion-prime/core_ext/nil_class.rb +5 -0
- data/motion-prime/delegate/app_delegate.rb +5 -0
- data/motion-prime/elements/base_element.rb +21 -2
- data/motion-prime/elements/draw.rb +6 -16
- data/motion-prime/helpers/has_authorization.rb +1 -1
- data/motion-prime/models/_base_mixin.rb +1 -1
- data/motion-prime/prime.rb +4 -0
- data/motion-prime/screens/extensions/_indicators_mixin.rb +16 -10
- data/motion-prime/screens/screen.rb +1 -1
- data/motion-prime/sections/_async_table_mixin.rb +1 -2
- data/motion-prime/sections/_draw_section_mixin.rb +3 -1
- data/motion-prime/sections/base_section.rb +37 -26
- data/motion-prime/sections/form.rb +23 -8
- data/motion-prime/sections/form/base_field_section.rb +1 -15
- data/motion-prime/sections/form/date_field_section.rb +1 -1
- data/motion-prime/sections/form/password_field_section.rb +1 -1
- data/motion-prime/sections/form/select_field_section.rb +1 -1
- data/motion-prime/sections/form/string_field_section.rb +1 -1
- data/motion-prime/sections/form/submit_field_section.rb +1 -1
- data/motion-prime/sections/form/text_field_section.rb +1 -1
- data/motion-prime/sections/table.rb +58 -27
- data/motion-prime/sections/table/refresh_mixin.rb +1 -1
- data/motion-prime/services/logger.rb +60 -21
- data/motion-prime/support/consts.rb +11 -0
- data/motion-prime/version.rb +1 -1
- data/motion-prime/views/layout.rb +5 -4
- data/motion-prime/views/view_styler.rb +3 -0
- data/spec/{helpers → factories}/delegates.rb +0 -3
- data/spec/{helpers → factories}/init.rb +0 -0
- data/spec/{helpers → factories}/models.rb +0 -0
- data/spec/factories/scaffold/models/task.rb +4 -0
- data/spec/factories/scaffold/screens/tasks.rb +45 -0
- data/spec/factories/scaffold/sections/tasks/form.rb +31 -0
- data/spec/factories/scaffold/sections/tasks/index_cell.rb +4 -0
- data/spec/factories/scaffold/sections/tasks/index_table.rb +12 -0
- data/spec/factories/scaffold/sections/tasks/show.rb +3 -0
- data/spec/factories/scaffold/styles/tasks.rb +18 -0
- data/spec/{helpers → factories}/screens.rb +0 -0
- data/spec/factories/sections.rb +9 -0
- data/spec/features/scaffold/index.rb +14 -0
- data/spec/features/screens/open_screen.rb +14 -2
- data/spec/helpers/has_content.rb +25 -0
- data/spec/unit/models/dirty_spec.rb +0 -1
- data/spec/unit/models/model_spec.rb +2 -0
- data/spec/unit/prime/logger.rb +49 -0
- data/spec/unit/sections/section_spec.rb +59 -0
- data/travis.sh +1 -1
- metadata +36 -41
- data/doc/FAQ.md +0 -2
- data/doc/SECTION.md +0 -7
- data/doc/STYLE.md +0 -39
- data/doc/code/getting_started.rb +0 -106
- data/doc/code/models.rb +0 -36
- data/doc/code/screens.rb +0 -93
- data/doc/code/sections.rb +0 -65
- data/doc/code/tables.rb +0 -54
- data/doc/docs/docco.css +0 -337
- data/doc/docs/getting_started.html +0 -195
- data/doc/docs/index.html +0 -205
- data/doc/docs/models.html +0 -115
- data/doc/docs/public/fonts/aller-bold.eot +0 -0
- data/doc/docs/public/fonts/aller-bold.ttf +0 -0
- data/doc/docs/public/fonts/aller-bold.woff +0 -0
- data/doc/docs/public/fonts/aller-light.eot +0 -0
- data/doc/docs/public/fonts/aller-light.ttf +0 -0
- data/doc/docs/public/fonts/aller-light.woff +0 -0
- data/doc/docs/public/fonts/fleurons.eot +0 -0
- data/doc/docs/public/fonts/fleurons.ttf +0 -0
- data/doc/docs/public/fonts/fleurons.woff +0 -0
- data/doc/docs/public/fonts/novecento-bold.eot +0 -0
- data/doc/docs/public/fonts/novecento-bold.ttf +0 -0
- data/doc/docs/public/fonts/novecento-bold.woff +0 -0
- data/doc/docs/public/images/gray.png +0 -0
- data/doc/docs/public/stylesheets/normalize.css +0 -375
- data/doc/docs/screens.html +0 -187
- data/doc/docs/sections.html +0 -138
- data/doc/docs/tables.html +0 -128
- data/spec/helpers/sections.rb +0 -3
@@ -1,195 +0,0 @@
|
|
1
|
-
<!DOCTYPE html>
|
2
|
-
|
3
|
-
<html>
|
4
|
-
<head>
|
5
|
-
<title>getting_started.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>getting_started.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> Why MotionPrime? </strong></p>
|
67
|
-
<p>Did you ever notice that table views in your RubyMotion application scrolls not smoothly?</p>
|
68
|
-
<p>Let's see why:</p>
|
69
|
-
<p><img src="https://s3.amazonaws.com/motionprime/prime.png" alt="MotionPrime"></p>
|
70
|
-
<p>Each table cell will create 5 UIViews inside and it's very slow operation for mobile device.
|
71
|
-
The main feature of MotionPrime is that it creates abstraction layer for "elements" in screen.
|
72
|
-
If it's possible in current context, MotionPrime will draw elements directly in table cell using CoreGraphics.
|
73
|
-
Just add 'label' element to the section:</p>
|
74
|
-
|
75
|
-
|
76
|
-
<div class='highlight'><pre><span class="class"><span class="keyword">class</span> <span class="title">MySection</span> <span class="inheritance">< <span class="parent">Prime::Section</span></span></span>
|
77
|
-
element <span class="symbol">:greeting</span>, <span class="symbol">text:</span> <span class="string">'Hello World'</span>, <span class="symbol">type:</span> <span class="symbol">:label</span>
|
78
|
-
<span class="keyword">end</span></pre></div>
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
<p>It will be rendered 5 times faster in iPhone 4/4s for cells containing 5 elements.</p>
|
83
|
-
<p>You can force it to use UIView instead of CoreGraphics:</p>
|
84
|
-
|
85
|
-
|
86
|
-
<div class='highlight'><pre><span class="class"><span class="keyword">class</span> <span class="title">MySection</span> <span class="inheritance">< <span class="parent">Prime::Section</span></span></span>
|
87
|
-
element <span class="symbol">:greeting</span>, <span class="symbol">text:</span> <span class="string">'Hello World'</span>, <span class="symbol">type:</span> <span class="symbol">:label</span>, <span class="symbol">as:</span> <span class="symbol">:view</span>
|
88
|
-
<span class="keyword">end</span></pre></div>
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
<p>MotionPrime contains other features to improve application performance, but performance is not the only feature.</p>
|
93
|
-
<p>So let's get started.</p>
|
94
|
-
<p><strong>1. Install required tools.</strong></p>
|
95
|
-
<ul>
|
96
|
-
<li>Ruby 1.9.3 or newer.</li>
|
97
|
-
</ul>
|
98
|
-
|
99
|
-
|
100
|
-
<div class='highlight'><pre><span class="variable">$ </span>rvm install <span class="number">2.0</span>.<span class="number">0</span></pre></div>
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
<ul>
|
105
|
-
<li>RubyMotion.</li>
|
106
|
-
</ul>
|
107
|
-
|
108
|
-
|
109
|
-
<div class='highlight'><pre>Visit http://www.rubymotion.com</pre></div>
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
<p><strong>2. Create MotionPrime project.</strong></p>
|
114
|
-
|
115
|
-
|
116
|
-
<div class='highlight'><pre><span class="variable">$ </span>gem install motion-prime
|
117
|
-
<span class="variable">$ </span>prime new hello</pre></div>
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
<p><strong>3. Create application delegate.</strong></p>
|
122
|
-
<p>E.g. <code>hello/app/app_delegate.rb</code></p>
|
123
|
-
<p>Inherit <code>AppDelegate</code> class from <code>Prime::BaseAppDelegate</code> and rewrite the <code>on_load</code> method, which will be runned after starting application.</p>
|
124
|
-
|
125
|
-
|
126
|
-
<div class='highlight'><pre><span class="class"><span class="keyword">class</span> <span class="title">AppDelegate</span> <span class="inheritance">< <span class="parent">Prime::BaseAppDelegate</span></span></span>
|
127
|
-
<span class="function"><span class="keyword">def</span> <span class="title">on_load</span><span class="params">(app, options)</span></span>
|
128
|
-
open_screen <span class="symbol">:main</span>
|
129
|
-
<span class="keyword">end</span>
|
130
|
-
<span class="keyword">end</span></pre></div>
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
<p><strong>4. Create the main screen.</strong></p>
|
135
|
-
<p>E.g. <code>hello/app/screens/home.rb</code></p>
|
136
|
-
<p>Inherit screen from <code>Prime::Screen</code> and rewrite the <code>render</code> method, which will be runned after first opening screen.</p>
|
137
|
-
|
138
|
-
|
139
|
-
<div class='highlight'><pre><span class="class"><span class="keyword">class</span> <span class="title">MainScreen</span> <span class="inheritance">< <span class="parent">Prime::Screen</span></span></span>
|
140
|
-
title <span class="string">'Main screen'</span>
|
141
|
-
|
142
|
-
<span class="function"><span class="keyword">def</span> <span class="title">render</span></span>
|
143
|
-
<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)
|
144
|
-
<span class="variable">@main_section</span>.render
|
145
|
-
<span class="keyword">end</span>
|
146
|
-
<span class="keyword">end</span></pre></div>
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
<p><strong>5. Create your first section.</strong></p>
|
151
|
-
<p>E.g. <code>hello/app/sections/home/section.rb</code></p>
|
152
|
-
<p>"Section" is something like helper, which contains "Elements".</p>
|
153
|
-
<p>Each element will be added to the parent screen when you run <code>section.render</code></p>
|
154
|
-
|
155
|
-
|
156
|
-
<div class='highlight'><pre><span class="class"><span class="keyword">class</span> <span class="title">HomeSection</span> <span class="inheritance">< <span class="parent">Prime::Section</span></span></span>
|
157
|
-
element <span class="symbol">:title</span>, <span class="symbol">text:</span> <span class="string">"Hello World"</span>
|
158
|
-
element <span class="symbol">:avatar</span>, <span class="symbol">image:</span> <span class="string">"images/avatar.png"</span>, <span class="symbol">type:</span> <span class="symbol">:image</span>
|
159
|
-
<span class="keyword">end</span></pre></div>
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
<p><strong>6. Create your first stylesheet file.</strong></p>
|
164
|
-
<p>E.g. <code>hello/app/styles/home.rb</code></p>
|
165
|
-
<p>Styles will be applied to each element in section.
|
166
|
-
The simplest rule by default is: <code>:section-name_:element-name</code>.</p>
|
167
|
-
<p>E.g. if you have "MyProfileSection" (the name for section by default will be - <code>my_profile</code>)
|
168
|
-
and "title" element, then you should use <code>my_profile_title</code> style name.</p>
|
169
|
-
|
170
|
-
|
171
|
-
<div class='highlight'><pre><span class="constant">Prime::Styles</span>.define <span class="keyword">do</span>
|
172
|
-
style <span class="symbol">:my_profile_title</span>, <span class="symbol">width:</span> <span class="number">300</span>, <span class="symbol">height:</span> <span class="number">20</span>
|
173
|
-
<span class="keyword">end</span></pre></div>
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
<p>You can pass namespace to <code>define</code> method.</p>
|
178
|
-
|
179
|
-
|
180
|
-
<div class='highlight'><pre><span class="constant">Prime::Styles</span>.define <span class="symbol">:my_profile</span> <span class="keyword">do</span>
|
181
|
-
style <span class="symbol">:title</span>, <span class="symbol">width:</span> <span class="number">300</span>, <span class="symbol">height:</span> <span class="number">20</span>
|
182
|
-
<span class="keyword">end</span></pre></div>
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
<p><strong> Next </strong></p>
|
187
|
-
<p><a href="screens.html">Read more about Screens</a></p>
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
<div class="fleur">h</div>
|
192
|
-
</div>
|
193
|
-
</div>
|
194
|
-
</body>
|
195
|
-
</html>
|
data/doc/docs/index.html
DELETED
@@ -1,205 +0,0 @@
|
|
1
|
-
<!DOCTYPE html>
|
2
|
-
|
3
|
-
<html>
|
4
|
-
<head>
|
5
|
-
<title>MotionPrime - the new RubyMotion framework.</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
|
-
<a href="https://github.com/droidlabs/motion-prime"><img style="position: absolute; top: 0; right: 0; border: 0;" src="https://s3.amazonaws.com/github/ribbons/forkme_right_darkblue_121621.png" alt="Fork me on GitHub"></a>
|
12
|
-
<div class="container">
|
13
|
-
<div class="page">
|
14
|
-
|
15
|
-
<div class="header">
|
16
|
-
|
17
|
-
<h1>Motion Prime</h1>
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
<div class="toc">
|
22
|
-
<h3>Table of Contents</h3>
|
23
|
-
<ol>
|
24
|
-
|
25
|
-
|
26
|
-
<li>
|
27
|
-
<a class="source" href="getting_started.html">
|
28
|
-
getting_started.rb
|
29
|
-
</a>
|
30
|
-
</li>
|
31
|
-
|
32
|
-
|
33
|
-
<li>
|
34
|
-
<a class="source" href="models.html">
|
35
|
-
models.rb
|
36
|
-
</a>
|
37
|
-
</li>
|
38
|
-
|
39
|
-
|
40
|
-
<li>
|
41
|
-
<a class="source" href="screens.html">
|
42
|
-
screens.rb
|
43
|
-
</a>
|
44
|
-
</li>
|
45
|
-
|
46
|
-
|
47
|
-
<li>
|
48
|
-
<a class="source" href="sections.html">
|
49
|
-
sections.rb
|
50
|
-
</a>
|
51
|
-
</li>
|
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> Why MotionPrime? </strong></p>
|
67
|
-
<p>Did you ever notice that table views in your RubyMotion application scrolls not smoothly?</p>
|
68
|
-
<p>Let's see why:</p>
|
69
|
-
<p><img src="https://s3.amazonaws.com/motionprime/prime.png" alt="MotionPrime"></p>
|
70
|
-
<p>Each table cell will create 5 UIViews inside and it's very slow operation for mobile device.
|
71
|
-
The main feature of MotionPrime is that it creates abstraction layer for "elements" in screen.
|
72
|
-
If it's possible in current context, MotionPrime will draw elements directly in table cell using CoreGraphics.
|
73
|
-
Just add 'label' element to the section:</p>
|
74
|
-
|
75
|
-
|
76
|
-
<div class='highlight'><pre><span class="class"><span class="keyword">class</span> <span class="title">MySection</span> <span class="inheritance">< <span class="parent">Prime::Section</span></span></span>
|
77
|
-
element <span class="symbol">:greeting</span>, <span class="symbol">text:</span> <span class="string">'Hello World'</span>, <span class="symbol">type:</span> <span class="symbol">:label</span>
|
78
|
-
<span class="keyword">end</span></pre></div>
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
<p>It will be rendered 5 times faster in iPhone 4/4s for cells containing 5 elements.</p>
|
83
|
-
<p>You can force it to use UIView instead of CoreGraphics:</p>
|
84
|
-
|
85
|
-
|
86
|
-
<div class='highlight'><pre><span class="class"><span class="keyword">class</span> <span class="title">MySection</span> <span class="inheritance">< <span class="parent">Prime::Section</span></span></span>
|
87
|
-
element <span class="symbol">:greeting</span>, <span class="symbol">text:</span> <span class="string">'Hello World'</span>, <span class="symbol">type:</span> <span class="symbol">:label</span>, <span class="symbol">as:</span> <span class="symbol">:view</span>
|
88
|
-
<span class="keyword">end</span></pre></div>
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
<p>MotionPrime contains other features to improve application performance, but performance is not the only feature.</p>
|
93
|
-
<p>So let's get started.</p>
|
94
|
-
<p><strong>1. Install required tools.</strong></p>
|
95
|
-
<ul>
|
96
|
-
<li>Ruby 1.9.3 or newer.</li>
|
97
|
-
</ul>
|
98
|
-
|
99
|
-
|
100
|
-
<div class='highlight'><pre><span class="variable">$ </span>rvm install <span class="number">2.0</span>.<span class="number">0</span></pre></div>
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
<ul>
|
105
|
-
<li>RubyMotion.</li>
|
106
|
-
</ul>
|
107
|
-
|
108
|
-
|
109
|
-
<div class='highlight'><pre>Visit http://www.rubymotion.com</pre></div>
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
<p><strong>2. Create MotionPrime project.</strong></p>
|
114
|
-
|
115
|
-
|
116
|
-
<div class='highlight'><pre><span class="variable">$ </span>gem install motion-prime
|
117
|
-
<span class="variable">$ </span>prime new hello</pre></div>
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
<p><strong>3. Create application delegate.</strong></p>
|
122
|
-
<p>E.g. <code>hello/app/app_delegate.rb</code></p>
|
123
|
-
<p>Inherit <code>AppDelegate</code> class from <code>Prime::BaseAppDelegate</code> and rewrite the <code>on_load</code> method, which will be runned after starting application.</p>
|
124
|
-
|
125
|
-
|
126
|
-
<div class='highlight'><pre><span class="class"><span class="keyword">class</span> <span class="title">AppDelegate</span> <span class="inheritance">< <span class="parent">Prime::BaseAppDelegate</span></span></span>
|
127
|
-
<span class="function"><span class="keyword">def</span> <span class="title">on_load</span><span class="params">(app, options)</span></span>
|
128
|
-
open_screen <span class="symbol">:main</span>
|
129
|
-
<span class="keyword">end</span>
|
130
|
-
<span class="keyword">end</span></pre></div>
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
<p><strong>4. Create the main screen.</strong></p>
|
135
|
-
<p>E.g. <code>hello/app/screens/home.rb</code></p>
|
136
|
-
<p>Inherit screen from <code>Prime::Screen</code> and rewrite the <code>render</code> method, which will be runned after first opening screen.</p>
|
137
|
-
|
138
|
-
|
139
|
-
<div class='highlight'><pre><span class="class"><span class="keyword">class</span> <span class="title">MainScreen</span> <span class="inheritance">< <span class="parent">Prime::Screen</span></span></span>
|
140
|
-
title <span class="string">'Main screen'</span>
|
141
|
-
|
142
|
-
<span class="function"><span class="keyword">def</span> <span class="title">render</span></span>
|
143
|
-
<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)
|
144
|
-
<span class="variable">@main_section</span>.render
|
145
|
-
<span class="keyword">end</span>
|
146
|
-
<span class="keyword">end</span></pre></div>
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
<p><strong>5. Create your first section.</strong></p>
|
151
|
-
<p>E.g. <code>hello/app/sections/home/section.rb</code></p>
|
152
|
-
<p>"Section" is something like helper, which contains "Elements".</p>
|
153
|
-
<p>Each element will be added to the parent screen when you run <code>section.render</code></p>
|
154
|
-
|
155
|
-
|
156
|
-
<div class='highlight'><pre><span class="class"><span class="keyword">class</span> <span class="title">HomeSection</span> <span class="inheritance">< <span class="parent">Prime::Section</span></span></span>
|
157
|
-
element <span class="symbol">:title</span>, <span class="symbol">text:</span> <span class="string">"Hello World"</span>
|
158
|
-
element <span class="symbol">:avatar</span>, <span class="symbol">image:</span> <span class="string">"images/avatar.png"</span>, <span class="symbol">type:</span> <span class="symbol">:image</span>
|
159
|
-
<span class="keyword">end</span></pre></div>
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
<p><strong>6. Create your first stylesheet file.</strong></p>
|
164
|
-
<p>E.g. <code>hello/app/styles/home.rb</code></p>
|
165
|
-
<p>Styles will be applied to each element in section.
|
166
|
-
The simplest rule by default is: <code>:section-name_:element-name</code>.</p>
|
167
|
-
<p>E.g. if you have "MyProfileSection" (the name for section by default will be - <code>my_profile</code>)
|
168
|
-
and "title" element, then you should use <code>my_profile_title</code> style name.</p>
|
169
|
-
|
170
|
-
|
171
|
-
<div class='highlight'><pre><span class="constant">Prime::Styles</span>.define <span class="keyword">do</span>
|
172
|
-
style <span class="symbol">:my_profile_title</span>, <span class="symbol">width:</span> <span class="number">300</span>, <span class="symbol">height:</span> <span class="number">20</span>
|
173
|
-
<span class="keyword">end</span></pre></div>
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
<p>You can pass namespace to <code>define</code> method.</p>
|
178
|
-
|
179
|
-
|
180
|
-
<div class='highlight'><pre><span class="constant">Prime::Styles</span>.define <span class="symbol">:my_profile</span> <span class="keyword">do</span>
|
181
|
-
style <span class="symbol">:title</span>, <span class="symbol">width:</span> <span class="number">300</span>, <span class="symbol">height:</span> <span class="number">20</span>
|
182
|
-
<span class="keyword">end</span></pre></div>
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
<p><strong> Next </strong></p>
|
187
|
-
<p><a href="screens.html">Read more about Screens</a></p>
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
<div class="fleur">h</div>
|
192
|
-
</div>
|
193
|
-
</div>
|
194
|
-
</body>
|
195
|
-
</html>
|
196
|
-
<script>
|
197
|
-
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
|
198
|
-
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
|
199
|
-
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
|
200
|
-
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
|
201
|
-
|
202
|
-
ga('create', 'UA-26217236-7', 'droidlabs.pro');
|
203
|
-
ga('send', 'pageview');
|
204
|
-
|
205
|
-
</script>
|
data/doc/docs/models.html
DELETED
@@ -1,115 +0,0 @@
|
|
1
|
-
<!DOCTYPE html>
|
2
|
-
|
3
|
-
<html>
|
4
|
-
<head>
|
5
|
-
<title>models.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>models.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 Model? </strong></p>
|
67
|
-
<p>"Model" will help you to store any information in database and sync this information with server.</p>
|
68
|
-
<p><strong> Create a model. </strong></p>
|
69
|
-
<p>Just inherit it from <code>Prime::Model</code>.</p>
|
70
|
-
|
71
|
-
|
72
|
-
<div class='highlight'><pre><span class="class"><span class="keyword">class</span> <span class="title">Event</span> <span class="inheritance">< <span class="parent">Prime::Model</span></span></span>
|
73
|
-
<span class="keyword">end</span></pre></div>
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
<p><strong> Add some attributes to model. </strong></p>
|
78
|
-
<p>E.g. we want event to have title and description.</p>
|
79
|
-
|
80
|
-
|
81
|
-
<div class='highlight'><pre><span class="class"><span class="keyword">class</span> <span class="title">Event</span> <span class="inheritance">< <span class="parent">Prime::Model</span></span></span>
|
82
|
-
attribute <span class="symbol">:title</span>
|
83
|
-
attribute <span class="symbol">:description</span>
|
84
|
-
<span class="keyword">end</span></pre></div>
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
<p><strong> Create some item. </strong></p>
|
89
|
-
<p>This event will be saved to database and accessible after restart of application.</p>
|
90
|
-
|
91
|
-
|
92
|
-
<div class='highlight'><pre>event = <span class="constant">Event</span>.create(
|
93
|
-
<span class="symbol">title:</span> <span class="string">'MotionPrime release.'</span>,
|
94
|
-
<span class="symbol">description:</span> <span class="string">'Check out new features.'</span>
|
95
|
-
)</pre></div>
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
<p><strong> Retrieve all events </strong></p>
|
100
|
-
|
101
|
-
|
102
|
-
<div class='highlight'><pre><span class="constant">Event</span>.all</pre></div>
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
<p><strong> Next </strong></p>
|
107
|
-
<p><a href="tables.html">Read more about Tables</a></p>
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
<div class="fleur">h</div>
|
112
|
-
</div>
|
113
|
-
</div>
|
114
|
-
</body>
|
115
|
-
</html>
|