doc/code/getting_started.rb in motion-prime-0.4.5 vs doc/code/getting_started.rb in motion-prime-0.5.0
- old
+ new
@@ -13,21 +13,21 @@
#
# NOTE: you should always use AppDelegate class name.
class AppDelegate < Prime::BaseAppDelegate
def on_load(app, options)
- open_screen MainScreen.new
+ open_screen :main
end
end
# **3. Create the main screen.**
#
# You should rewrite the `render` method, which will be runned after first opening screen.
#
# NOTE: it's recommended to use instance variables for sections, e.g. `@main_section` instead of `main_section`.
-class MainScreen < Prime::BaseScreen
+class MainScreen < Prime::Screen
title 'Main screen'
def render
@main_section = MyProfileSection.new(screen: self, model: User.first)
@main_section.render
@@ -38,10 +38,10 @@
#
# "Section" is something like helper, which contains "Elements".
#
# Each element will be added to the parent screen when you run `section.render`
-class MyProfileSection < Prime::BaseSection
+class MyProfileSection < Prime::Section
element :title, text: "Hello World"
element :avatar, image: "images/avatar.png", type: :image
end
# **5. Create your first stylesheet file.**
\ No newline at end of file