Page API
A page orchestrates components within its response method. A Rails controller action references a page (and its corresponding app) in its render call. Thus a matestack page substitutes a typical Rails view.
Use core components
app/matestack/example_app/pages/example_page.rb
class ExampleApp::Pages < Matestack::Ui::Page
def response
div do
plain "Hello World from Example Page!"
end
end
endUse registered custom components
Imagine having created and registered a custom component card. Go ahead and use it on your page:
app/matestack/example_app/pages/example_page.rb
class ExampleApp::Pages < Matestack::Ui::Page
def response
div do
# calling your registered card component without using matestack_component helper!
card title: "hello"
end
end
endAccess request params
visit "/my_action_path/?foo=bar"
app/matestack/example_app/pages/example_page.rb
Prepare method
The prepare method is called before rendering.
app/matestack/example_app/pages/example_page.rb
Use pure Ruby on pages
app/matestack/example_app/pages/example_page.rb
Use instance methods
app/matestack/example_app/pages/example_page.rb
Use local partials
app/matestack/example_app/pages/example_page.rb
renders to:
Use partials from included modules
app/matestack/pages/my_shared_partials.rb
app/matestack/example_app/pages/example_page.rb
renders to:
Last updated
Was this helpful?