motion-prime 0.4.5 → 0.5.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +14 -6
- data/.gitignore +1 -0
- data/CHANGELOG.md +14 -0
- data/Gemfile.lock +1 -1
- data/README.md +10 -8
- data/ROADMAP.md +9 -10
- data/Rakefile +1 -1
- data/doc/code/getting_started.rb +3 -3
- data/doc/code/screens.rb +25 -10
- data/doc/code/sections.rb +41 -0
- data/doc/docs/getting_started.html +8 -3
- data/doc/docs/screens.html +58 -19
- data/doc/docs/sections.html +134 -0
- data/files/Gemfile +7 -1
- data/files/Gemfile.lock +18 -9
- data/files/Rakefile +2 -11
- data/files/app/app_delegate.rb +2 -2
- data/files/app/config/base.rb +0 -4
- data/files/app/screens/application_screen.rb +2 -2
- data/files/app/screens/home_screen.rb +2 -0
- data/files/app/screens/sidebar_screen.rb +3 -3
- data/files/app/sections/home/section.rb +3 -0
- data/files/app/sections/sidebar/action.rb +1 -1
- data/files/app/styles/home.rb +9 -0
- data/files/app/styles/sidebar.rb +3 -3
- data/lib/motion-prime.rb +9 -0
- data/motion-prime/api_client.rb +5 -1
- data/motion-prime/app_delegate.rb +40 -45
- data/motion-prime/core_ext/kernel.rb +8 -0
- data/motion-prime/elements/_content_text_mixin.rb +3 -1
- data/motion-prime/elements/_text_mixin.rb +1 -1
- data/motion-prime/elements/base_element.rb +6 -5
- data/motion-prime/elements/draw/image.rb +6 -1
- data/motion-prime/elements/view_with_section.rb +7 -0
- data/motion-prime/helpers/has_style_chain_builder.rb +4 -1
- data/motion-prime/models/_association_mixin.rb +139 -0
- data/motion-prime/models/_base_mixin.rb +184 -0
- data/motion-prime/models/_dirty_mixin.rb +31 -0
- data/motion-prime/models/_finder_mixin.rb +208 -0
- data/motion-prime/models/{bag.rb → _nano_bag_mixin.rb} +4 -4
- data/motion-prime/models/{sync.rb → _sync_mixin.rb} +75 -76
- data/motion-prime/models/json.rb +6 -9
- data/motion-prime/models/model.rb +24 -172
- data/motion-prime/{mp.rb → prime.rb} +0 -1
- data/motion-prime/screens/_base_mixin.rb +9 -10
- data/motion-prime/screens/_navigation_mixin.rb +12 -17
- data/motion-prime/screens/extensions/_indicators_mixin.rb +1 -1
- data/motion-prime/screens/extensions/_navigation_bar_mixin.rb +3 -3
- data/motion-prime/screens/{base_screen.rb → screen.rb} +11 -5
- data/motion-prime/sections/_cell_section_mixin.rb +13 -0
- data/motion-prime/sections/_draw_section_mixin.rb +17 -0
- data/motion-prime/sections/base_section.rb +51 -16
- data/motion-prime/sections/form/base_field_section.rb +27 -16
- data/motion-prime/sections/form/base_header_section.rb +4 -3
- data/motion-prime/sections/form/password_field_section.rb +4 -0
- data/motion-prime/sections/form/select_field_section.rb +4 -0
- data/motion-prime/sections/form/string_field_section.rb +4 -0
- data/motion-prime/sections/form/submit_field_section.rb +4 -0
- data/motion-prime/sections/form/text_field_section.rb +4 -0
- data/motion-prime/sections/form.rb +7 -1
- data/motion-prime/sections/tabbed.rb +1 -1
- data/motion-prime/sections/table/table_delegate.rb +5 -0
- data/motion-prime/sections/table.rb +71 -51
- data/motion-prime/services/logger.rb +37 -0
- data/motion-prime/support/mp_cell_with_section.rb +9 -4
- data/motion-prime/support/tab_bar_controller.rb +2 -1
- data/motion-prime/version.rb +1 -1
- data/motion-prime/views/layout.rb +1 -1
- data/motion-prime/views/view_builder.rb +7 -0
- data/motion-prime.gemspec +1 -1
- data/spec/delegate/{base_delegate_spec.rb → delegate_spec.rb} +1 -1
- data/spec/helpers/{base_delegate.rb → delegates.rb} +0 -0
- data/spec/helpers/models.rb +11 -18
- data/spec/helpers/{base_screen.rb → screens.rb} +1 -1
- data/spec/models/{association_spec.rb → associations_spec.rb} +1 -1
- data/spec/models/bag_spec.rb +1 -1
- data/spec/models/errors_spec.rb +1 -1
- data/spec/models/finder_spec.rb +1 -1
- data/spec/models/json.rb +87 -0
- data/spec/models/model_spec.rb +23 -3
- data/spec/models/store_extension_spec.rb +1 -1
- data/spec/models/store_spec.rb +1 -1
- data/spec/screens/{base_screen_spec.rb → screen_spec.rb} +5 -1
- metadata +52 -43
- data/motion-prime/models/association.rb +0 -134
- data/motion-prime/models/base.rb +0 -27
- data/motion-prime/models/finder.rb +0 -202
- data/motion-prime/screens/sidebar_container_screen.rb +0 -80
checksums.yaml
CHANGED
@@ -1,7 +1,15 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
2
|
+
!binary "U0hBMQ==":
|
3
|
+
metadata.gz: !binary |-
|
4
|
+
NDU3YTA1M2Q5YjkyMDM0OTcwNDlkNWUxNDIwM2MwY2I3NWY0NjY3Nw==
|
5
|
+
data.tar.gz: !binary |-
|
6
|
+
NDdkNTIwOTc5ZDA0NmJmY2JiN2RlMmZiMWVjMzkxYmUwNTI0YTc3MQ==
|
7
|
+
!binary "U0hBNTEy":
|
8
|
+
metadata.gz: !binary |-
|
9
|
+
MmQ2OGQ0Y2M0NzFkMDZlMmM4ODZmMTlkMGNiODczNWQwZGE5YmQxOTM2MjM0
|
10
|
+
ZmM1MWNlNzVlZmQ5NzgwN2QxM2IyMDc2MTQzYjY5M2FiOTg4N2I2MDkyNzUx
|
11
|
+
NTU5MmNmMTZhZGE4MWM1ZjY5MGUyZmQxM2Y1NjZiMmRiYWIwMjQ=
|
12
|
+
data.tar.gz: !binary |-
|
13
|
+
MWMxM2RiMjM5M2QyZWVjNWNmOWU4ZjI3MGM3ZmM4OWQ4YmIwZDFhMzU1MTQ0
|
14
|
+
ZjgzYjg1NjY5ZGExNmQ0MTU4NDhmYzI4NzQ4MzlkNTk2ZDRmZTIwNTdjOGJi
|
15
|
+
Y2MyNzg5ZDM4Nzg4MzUyNGU5YTBkMWY0YzNiZDViNWMzMDRhNWM=
|
data/.gitignore
CHANGED
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,17 @@
|
|
1
|
+
=== 0.5.0
|
2
|
+
* renamed Prime::BaseModel to Prime::Model.
|
3
|
+
* renamed Prime::BaseScreen to Prime::Screen.
|
4
|
+
* renamed Prime::BaseSection to Prime::Section.
|
5
|
+
* Model: sync/sync! separated to update/update! and fetch/fetch!
|
6
|
+
* Model: `fetch_associations` option on fetch renamed to `associations` option.
|
7
|
+
* Model: `update_from_response` option on update renamed to `save_response` option.
|
8
|
+
* Screen: `navigation: true` by default for screen initialization.
|
9
|
+
* Model.new with invalid parameter will not raise exception by default now.
|
10
|
+
* "id" attribute always being added to model by default now.
|
11
|
+
* screen.open_screen do not support root screen opening now. use app_delegate.open_screen for that.
|
12
|
+
* added shorter syntax for opening screens.
|
13
|
+
* fix rendering draw section without table.
|
14
|
+
|
1
15
|
=== 0.4.4
|
2
16
|
* Added Prime.env support
|
3
17
|
* Added Prime.root support
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -2,10 +2,7 @@
|
|
2
2
|
|
3
3
|
![Prime](https://s3-us-west-2.amazonaws.com/webmate/assets/prime.jpg)
|
4
4
|
|
5
|
-
MotionPrime is yet another framework written on RubyMotion.
|
6
|
-
|
7
|
-
The main feature of MotionPrime is one more layer on UI elements: Section.
|
8
|
-
"Section" is something like "Partial" in Ruby On Rails, but it's smarter and will help you build application UI.
|
5
|
+
MotionPrime is yet another framework written on RubyMotion for creating really fast iOS applications.
|
9
6
|
|
10
7
|
## Getting Started
|
11
8
|
|
@@ -27,12 +24,12 @@ The main feature of MotionPrime is one more layer on UI elements: Section.
|
|
27
24
|
# app/app_delegate.rb
|
28
25
|
class AppDelegate < Prime::BaseAppDelegate
|
29
26
|
def on_load(app, options)
|
30
|
-
open_screen
|
27
|
+
open_screen :main
|
31
28
|
end
|
32
29
|
end
|
33
30
|
|
34
31
|
# app/screens/main_screen.rb
|
35
|
-
class MainScreen < Prime::
|
32
|
+
class MainScreen < Prime::Screen
|
36
33
|
title 'Main screen'
|
37
34
|
|
38
35
|
def render
|
@@ -42,7 +39,7 @@ The main feature of MotionPrime is one more layer on UI elements: Section.
|
|
42
39
|
end
|
43
40
|
|
44
41
|
# app/sections/my_profile.rb
|
45
|
-
class MyProfileSection < Prime::
|
42
|
+
class MyProfileSection < Prime::Section
|
46
43
|
element :title, text: "Hello World"
|
47
44
|
element :avatar, image: "images/avatar.png", type: :image
|
48
45
|
end
|
@@ -58,6 +55,11 @@ The main feature of MotionPrime is one more layer on UI elements: Section.
|
|
58
55
|
end
|
59
56
|
```
|
60
57
|
|
58
|
+
## Extensions
|
59
|
+
|
60
|
+
* [ECSlidingViewController 2 integration](https://github.com/droidlabs/prime_sliding_menu) (Sidebar)
|
61
|
+
* [RESideMenu integration](https://github.com/droidlabs/prime_reside_menu) (Sidebar)
|
62
|
+
|
61
63
|
## Contributing
|
62
64
|
|
63
65
|
1. Fork it
|
@@ -68,7 +70,7 @@ The main feature of MotionPrime is one more layer on UI elements: Section.
|
|
68
70
|
|
69
71
|
## Documentation
|
70
72
|
|
71
|
-
We are using Docco
|
73
|
+
We are using [Docco](http://jashkenas.github.io/docco/) to generate documentation.
|
72
74
|
|
73
75
|
Please install the tool and run this to update documentation:
|
74
76
|
|
data/ROADMAP.md
CHANGED
@@ -1,17 +1,16 @@
|
|
1
|
-
=== 0.5.0
|
2
|
-
* "id" attribute should always be added to model by default
|
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
|
9
|
-
|
10
1
|
=== 0.6.0
|
2
|
+
* add configuration initializer.
|
3
|
+
* add cleanup for section events
|
4
|
+
* add computed_options.get(), this will allow to make sure that options is computed.
|
5
|
+
* add dsl for push notifications
|
6
|
+
* add some extensions/middleware system, at least for networking.
|
7
|
+
* create "display_network_error" extension.
|
8
|
+
|
9
|
+
=== 0.7.0
|
11
10
|
* add testing framework
|
12
11
|
* add auth backends to ApiClient: password auth and facebook auth
|
13
12
|
|
14
|
-
=== 0.
|
13
|
+
=== 0.8.0
|
15
14
|
* add sections/screens/models generator
|
16
15
|
* add DSL for ViewStyles#setValue conditions
|
17
16
|
* add auto-symbol-value for Prime::Config.color items
|
data/Rakefile
CHANGED
data/doc/code/getting_started.rb
CHANGED
@@ -15,7 +15,7 @@ Visit http://www.rubymotion.com
|
|
15
15
|
|
16
16
|
class AppDelegate < Prime::BaseAppDelegate
|
17
17
|
def on_load(app, options)
|
18
|
-
open_screen
|
18
|
+
open_screen :main
|
19
19
|
end
|
20
20
|
end
|
21
21
|
|
@@ -25,7 +25,7 @@ end
|
|
25
25
|
#
|
26
26
|
# NOTE: it's recommended to use instance variables for sections, e.g. `@main_section` instead of `main_section`.
|
27
27
|
|
28
|
-
class MainScreen < Prime::
|
28
|
+
class MainScreen < Prime::Screen
|
29
29
|
title 'Main screen'
|
30
30
|
|
31
31
|
def render
|
@@ -40,7 +40,7 @@ end
|
|
40
40
|
#
|
41
41
|
# Each element will be added to the parent screen when you run `section.render`
|
42
42
|
|
43
|
-
class MyProfileSection < Prime::
|
43
|
+
class MyProfileSection < Prime::Section
|
44
44
|
element :title, text: "Hello World"
|
45
45
|
element :avatar, image: "images/avatar.png", type: :image
|
46
46
|
end
|
data/doc/code/screens.rb
CHANGED
@@ -5,11 +5,18 @@
|
|
5
5
|
# For RubyOnRails developers the nearest analogy would be "Controllers".
|
6
6
|
---
|
7
7
|
|
8
|
+
# ** Create a screen. **
|
9
|
+
#
|
10
|
+
# Just inherit it from `Prime::Screen`.
|
11
|
+
|
12
|
+
class FooScreen < Prime::Screen
|
13
|
+
end
|
14
|
+
|
8
15
|
# ** Render the screen. **
|
9
16
|
#
|
10
|
-
# You should rewrite the `render` method of `Prime::
|
17
|
+
# You should rewrite the `render` method of `Prime::Screen`, which will be runned after first opening screen.
|
11
18
|
|
12
|
-
class FooScreen < Prime::
|
19
|
+
class FooScreen < Prime::Screen
|
13
20
|
def render
|
14
21
|
@main_section = MyProfileSection.new(screen: self, model: User.first)
|
15
22
|
@main_section.render
|
@@ -22,13 +29,13 @@ end
|
|
22
29
|
#
|
23
30
|
# NOTE: screen should be created with enabled navigation (see "Initialize screen" block).
|
24
31
|
|
25
|
-
class FooScreen < Prime::
|
32
|
+
class FooScreen < Prime::Screen
|
26
33
|
title 'Foo screen'
|
27
34
|
end
|
28
35
|
|
29
36
|
# You can pass block to define screen's title
|
30
37
|
|
31
|
-
class FooScreen < Prime::
|
38
|
+
class FooScreen < Prime::Screen
|
32
39
|
title { params[:title] }
|
33
40
|
end
|
34
41
|
|
@@ -36,10 +43,10 @@ end
|
|
36
43
|
#
|
37
44
|
# Available options:
|
38
45
|
# * `:navigation`. When this options is true, screen will be created with navigation support: it will allow adding title and left/right buttons.
|
39
|
-
# This option is
|
46
|
+
# This option is true by default.
|
40
47
|
|
41
48
|
def open_foo_screen
|
42
|
-
foo_screen = FooScreen.new(navigation:
|
49
|
+
foo_screen = FooScreen.new(navigation: false)
|
43
50
|
end
|
44
51
|
|
45
52
|
# ** Open screen: using app delegate. **
|
@@ -51,12 +58,13 @@ end
|
|
51
58
|
# You can use root: true when you have already opened screen with sidebar, and you want to open new screen without sidebar.
|
52
59
|
# This option is false by default if you already have root screen and true if not.
|
53
60
|
#
|
54
|
-
# * `:sidebar`. Send `Prime::
|
55
|
-
# Value of this options will be used as sidebar controller.
|
61
|
+
# * `:sidebar`. Send `Prime::Screen` instance to this option if you want to create root screen with sidebar.
|
62
|
+
# Value of this options will be used as sidebar controller.
|
63
|
+
# NOTE: you should install some gem providing sidebar functionality, e.g. 'prime_reside_menu'
|
56
64
|
|
57
65
|
def open_foo_screen
|
58
|
-
foo_screen = FooScreen.new
|
59
|
-
sidebar = MySidebar.new
|
66
|
+
foo_screen = FooScreen.new
|
67
|
+
sidebar = MySidebar.new(navigation: false)
|
60
68
|
app_delegate.open_screen foo_screen, sidebar: sidebar
|
61
69
|
end
|
62
70
|
|
@@ -70,3 +78,10 @@ def open_second_screen
|
|
70
78
|
foo_screen.open_screen second_screen
|
71
79
|
end
|
72
80
|
|
81
|
+
# ** Open screen: using short version. **
|
82
|
+
|
83
|
+
# Opening screen using short syntax available both for opening via app delegate and via parent screen.
|
84
|
+
|
85
|
+
foo_screen.open_screen :hello_world
|
86
|
+
app_delegate.open_screen :foo_bar, sidebar: true
|
87
|
+
|
@@ -0,0 +1,41 @@
|
|
1
|
+
# ** What is a Section? **
|
2
|
+
#
|
3
|
+
# "Section" is something like "partial" which you may know from RubyOnRails.
|
4
|
+
# In the first look it's just a list of elements which will be added to the "Screen".
|
5
|
+
# But the magic is inside.
|
6
|
+
# When you add "Element" to a "Section", e.g. image or label,
|
7
|
+
# it will try to draw it using CALayer/CGContext/etc, instead of adding new UIView.
|
8
|
+
# That way increases application speed (especially on Table elements) by 5-10 times.
|
9
|
+
#
|
10
|
+
# Let's get started.
|
11
|
+
---
|
12
|
+
|
13
|
+
# ** Create a section. **
|
14
|
+
#
|
15
|
+
# Just inherit it from `Prime::Section`.
|
16
|
+
|
17
|
+
class FooSection < Prime::Section
|
18
|
+
end
|
19
|
+
|
20
|
+
# ** Add some elements to the section. **
|
21
|
+
#
|
22
|
+
# Each element should have name and type: "image", "label", "button", etc.
|
23
|
+
# When you send `:text` option, type will be "label" by default.
|
24
|
+
# When you send `:image` option, type will be "image" by default.
|
25
|
+
|
26
|
+
class FooSection < Prime::Section
|
27
|
+
element :welcome, text: 'Hello World!'
|
28
|
+
element :avatar, image: 'images/users/avatar.jpg'
|
29
|
+
element :cheer, type: :button
|
30
|
+
end
|
31
|
+
|
32
|
+
# ** Render Section in Screen **
|
33
|
+
#
|
34
|
+
# NOTE: You must send "screen" option on section initialization.
|
35
|
+
|
36
|
+
class FooScreen < Prime::Screen
|
37
|
+
def render
|
38
|
+
@main_section = FooSection.new(screen: self)
|
39
|
+
@main_section.render
|
40
|
+
end
|
41
|
+
end
|
@@ -28,6 +28,11 @@
|
|
28
28
|
screens.rb
|
29
29
|
</a>
|
30
30
|
|
31
|
+
|
32
|
+
<a class="source" href="sections.html">
|
33
|
+
sections.rb
|
34
|
+
</a>
|
35
|
+
|
31
36
|
</div>
|
32
37
|
</li>
|
33
38
|
</ul>
|
@@ -105,7 +110,7 @@
|
|
105
110
|
|
106
111
|
<div class="content"><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>
|
107
112
|
<span class="function"><span class="keyword">def</span> <span class="title">on_load</span><span class="params">(app, options)</span></span>
|
108
|
-
open_screen <span class="
|
113
|
+
open_screen <span class="symbol">:main</span>
|
109
114
|
<span class="keyword">end</span>
|
110
115
|
<span class="keyword">end</span></pre></div></div>
|
111
116
|
|
@@ -124,7 +129,7 @@
|
|
124
129
|
|
125
130
|
</div>
|
126
131
|
|
127
|
-
<div class="content"><div class='highlight'><pre><span class="class"><span class="keyword">class</span> <span class="title">MainScreen</span> <span class="inheritance">< <span class="parent">Prime::
|
132
|
+
<div class="content"><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>
|
128
133
|
title <span class="string">'Main screen'</span>
|
129
134
|
|
130
135
|
<span class="function"><span class="keyword">def</span> <span class="title">render</span></span>
|
@@ -148,7 +153,7 @@
|
|
148
153
|
|
149
154
|
</div>
|
150
155
|
|
151
|
-
<div class="content"><div class='highlight'><pre><span class="class"><span class="keyword">class</span> <span class="title">MyProfileSection</span> <span class="inheritance">< <span class="parent">Prime::
|
156
|
+
<div class="content"><div class='highlight'><pre><span class="class"><span class="keyword">class</span> <span class="title">MyProfileSection</span> <span class="inheritance">< <span class="parent">Prime::Section</span></span></span>
|
152
157
|
element <span class="symbol">:title</span>, <span class="symbol">text:</span> <span class="string">"Hello World"</span>
|
153
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>
|
154
159
|
<span class="keyword">end</span></pre></div></div>
|
data/doc/docs/screens.html
CHANGED
@@ -28,6 +28,11 @@
|
|
28
28
|
screens.rb
|
29
29
|
</a>
|
30
30
|
|
31
|
+
|
32
|
+
<a class="source" href="sections.html">
|
33
|
+
sections.rb
|
34
|
+
</a>
|
35
|
+
|
31
36
|
</div>
|
32
37
|
</li>
|
33
38
|
</ul>
|
@@ -66,12 +71,29 @@ For RubyOnRails developers the nearest analogy would be "Controllers".
|
|
66
71
|
<div class="pilwrap ">
|
67
72
|
<a class="pilcrow" href="#section-2">¶</a>
|
68
73
|
</div>
|
74
|
+
<p><strong> Create a screen. </strong></p>
|
75
|
+
<p>Just inherit it from <code>Prime::Screen</code>.</p>
|
76
|
+
|
77
|
+
</div>
|
78
|
+
|
79
|
+
<div class="content"><div class='highlight'><pre><span class="class"><span class="keyword">class</span> <span class="title">FooScreen</span> <span class="inheritance">< <span class="parent">Prime::Screen</span></span></span>
|
80
|
+
<span class="keyword">end</span></pre></div></div>
|
81
|
+
|
82
|
+
</li>
|
83
|
+
|
84
|
+
|
85
|
+
<li id="section-3">
|
86
|
+
<div class="annotation">
|
87
|
+
|
88
|
+
<div class="pilwrap ">
|
89
|
+
<a class="pilcrow" href="#section-3">¶</a>
|
90
|
+
</div>
|
69
91
|
<p><strong> Render the screen. </strong></p>
|
70
|
-
<p>You should rewrite the <code>render</code> method of <code>Prime::
|
92
|
+
<p>You should rewrite the <code>render</code> method of <code>Prime::Screen</code>, which will be runned after first opening screen.</p>
|
71
93
|
|
72
94
|
</div>
|
73
95
|
|
74
|
-
<div class="content"><div class='highlight'><pre><span class="class"><span class="keyword">class</span> <span class="title">FooScreen</span> <span class="inheritance">< <span class="parent">Prime::
|
96
|
+
<div class="content"><div class='highlight'><pre><span class="class"><span class="keyword">class</span> <span class="title">FooScreen</span> <span class="inheritance">< <span class="parent">Prime::Screen</span></span></span>
|
75
97
|
<span class="function"><span class="keyword">def</span> <span class="title">render</span></span>
|
76
98
|
<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)
|
77
99
|
<span class="variable">@main_section</span>.render
|
@@ -81,11 +103,11 @@ For RubyOnRails developers the nearest analogy would be "Controllers".
|
|
81
103
|
</li>
|
82
104
|
|
83
105
|
|
84
|
-
<li id="section-
|
106
|
+
<li id="section-4">
|
85
107
|
<div class="annotation">
|
86
108
|
|
87
109
|
<div class="pilwrap ">
|
88
|
-
<a class="pilcrow" href="#section-
|
110
|
+
<a class="pilcrow" href="#section-4">¶</a>
|
89
111
|
</div>
|
90
112
|
<p><strong> Set screen's title </strong></p>
|
91
113
|
<p>Title will be used in screen's navigation controller and will be shown on top of screen.</p>
|
@@ -93,57 +115,57 @@ For RubyOnRails developers the nearest analogy would be "Controllers".
|
|
93
115
|
|
94
116
|
</div>
|
95
117
|
|
96
|
-
<div class="content"><div class='highlight'><pre><span class="class"><span class="keyword">class</span> <span class="title">FooScreen</span> <span class="inheritance">< <span class="parent">Prime::
|
118
|
+
<div class="content"><div class='highlight'><pre><span class="class"><span class="keyword">class</span> <span class="title">FooScreen</span> <span class="inheritance">< <span class="parent">Prime::Screen</span></span></span>
|
97
119
|
title <span class="string">'Foo screen'</span>
|
98
120
|
<span class="keyword">end</span></pre></div></div>
|
99
121
|
|
100
122
|
</li>
|
101
123
|
|
102
124
|
|
103
|
-
<li id="section-
|
125
|
+
<li id="section-5">
|
104
126
|
<div class="annotation">
|
105
127
|
|
106
128
|
<div class="pilwrap ">
|
107
|
-
<a class="pilcrow" href="#section-
|
129
|
+
<a class="pilcrow" href="#section-5">¶</a>
|
108
130
|
</div>
|
109
131
|
<p>You can pass block to define screen's title</p>
|
110
132
|
|
111
133
|
</div>
|
112
134
|
|
113
|
-
<div class="content"><div class='highlight'><pre><span class="class"><span class="keyword">class</span> <span class="title">FooScreen</span> <span class="inheritance">< <span class="parent">Prime::
|
135
|
+
<div class="content"><div class='highlight'><pre><span class="class"><span class="keyword">class</span> <span class="title">FooScreen</span> <span class="inheritance">< <span class="parent">Prime::Screen</span></span></span>
|
114
136
|
title { params[<span class="symbol">:title</span>] }
|
115
137
|
<span class="keyword">end</span></pre></div></div>
|
116
138
|
|
117
139
|
</li>
|
118
140
|
|
119
141
|
|
120
|
-
<li id="section-
|
142
|
+
<li id="section-6">
|
121
143
|
<div class="annotation">
|
122
144
|
|
123
145
|
<div class="pilwrap ">
|
124
|
-
<a class="pilcrow" href="#section-
|
146
|
+
<a class="pilcrow" href="#section-6">¶</a>
|
125
147
|
</div>
|
126
148
|
<p><strong> Initialize screen. </strong></p>
|
127
149
|
<p>Available options:</p>
|
128
150
|
<ul>
|
129
151
|
<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.
|
130
|
-
This option is
|
152
|
+
This option is true by default.</li>
|
131
153
|
</ul>
|
132
154
|
|
133
155
|
</div>
|
134
156
|
|
135
157
|
<div class="content"><div class='highlight'><pre><span class="function"><span class="keyword">def</span> <span class="title">open_foo_screen</span></span>
|
136
|
-
foo_screen = <span class="constant">FooScreen</span>.new(<span class="symbol">navigation:</span> <span class="keyword">
|
158
|
+
foo_screen = <span class="constant">FooScreen</span>.new(<span class="symbol">navigation:</span> <span class="keyword">false</span>)
|
137
159
|
<span class="keyword">end</span></pre></div></div>
|
138
160
|
|
139
161
|
</li>
|
140
162
|
|
141
163
|
|
142
|
-
<li id="section-
|
164
|
+
<li id="section-7">
|
143
165
|
<div class="annotation">
|
144
166
|
|
145
167
|
<div class="pilwrap ">
|
146
|
-
<a class="pilcrow" href="#section-
|
168
|
+
<a class="pilcrow" href="#section-7">¶</a>
|
147
169
|
</div>
|
148
170
|
<p><strong> Open screen: using app delegate. </strong></p>
|
149
171
|
<p>Opening screen using app delegate is the most basic way, you would use it at least on app load.</p>
|
@@ -153,7 +175,7 @@ This option is false by default.</li>
|
|
153
175
|
You can use root: true when you have already opened screen with sidebar, and you want to open new screen without sidebar.
|
154
176
|
This option is false by default if you already have root screen and true if not.</p>
|
155
177
|
</li>
|
156
|
-
<li><p><code>:sidebar</code>. Send <code>Prime::
|
178
|
+
<li><p><code>:sidebar</code>. Send <code>Prime::Screen</code> instance to this option if you want to create root screen with sidebar.
|
157
179
|
Value of this options will be used as sidebar controller.</p>
|
158
180
|
</li>
|
159
181
|
</ul>
|
@@ -161,19 +183,19 @@ Value of this options will be used as sidebar controller.</p>
|
|
161
183
|
</div>
|
162
184
|
|
163
185
|
<div class="content"><div class='highlight'><pre><span class="function"><span class="keyword">def</span> <span class="title">open_foo_screen</span></span>
|
164
|
-
foo_screen = <span class="constant">FooScreen</span>.new
|
165
|
-
sidebar = <span class="constant">MySidebar</span>.new
|
186
|
+
foo_screen = <span class="constant">FooScreen</span>.new
|
187
|
+
sidebar = <span class="constant">MySidebar</span>.new(<span class="symbol">navigation:</span> <span class="keyword">false</span>)
|
166
188
|
app_delegate.open_screen foo_screen, <span class="symbol">sidebar:</span> sidebar
|
167
189
|
<span class="keyword">end</span></pre></div></div>
|
168
190
|
|
169
191
|
</li>
|
170
192
|
|
171
193
|
|
172
|
-
<li id="section-
|
194
|
+
<li id="section-8">
|
173
195
|
<div class="annotation">
|
174
196
|
|
175
197
|
<div class="pilwrap ">
|
176
|
-
<a class="pilcrow" href="#section-
|
198
|
+
<a class="pilcrow" href="#section-8">¶</a>
|
177
199
|
</div>
|
178
200
|
<p><strong> Open screen: using parent screen. </strong></p>
|
179
201
|
<p>Opening screen using parent screen is usefull if you want to create inherited screen.
|
@@ -188,6 +210,23 @@ Parent screen should have been initialized with navigation support.</p>
|
|
188
210
|
|
189
211
|
</li>
|
190
212
|
|
213
|
+
|
214
|
+
<li id="section-9">
|
215
|
+
<div class="annotation">
|
216
|
+
|
217
|
+
<div class="pilwrap ">
|
218
|
+
<a class="pilcrow" href="#section-9">¶</a>
|
219
|
+
</div>
|
220
|
+
<p><strong> Open screen: using short version. </strong></p>
|
221
|
+
<p>Opening screen using short syntax available both for opening via app delegate and via parent screen.</p>
|
222
|
+
|
223
|
+
</div>
|
224
|
+
|
225
|
+
<div class="content"><div class='highlight'><pre>foo_screen.open_screen <span class="symbol">:hello_world</span>
|
226
|
+
app_delegate.open_screen <span class="symbol">:foo_bar</span>, <span class="symbol">sidebar:</span> <span class="keyword">true</span></pre></div></div>
|
227
|
+
|
228
|
+
</li>
|
229
|
+
|
191
230
|
</ul>
|
192
231
|
</div>
|
193
232
|
</body>
|