Rails Controller Integration
Just like a Rails layout would yield a Rails view, a Matestack layout yields a Matestack page. The layout uses Matestack's HTML rendering mechanism in a
responsemethod and may additionally call other components in order to define a specific UI.
class SomeApp::SomeLayout < Matestack::Ui::Layout
h1 "Some App"
In this basic example the layout is using the methods
mainin order to create the markup as well as a
yieldin order to yield a page on a specific position.
Usually a layout implies a specific context of your application. Multiple pages are then scoped within that context, which could lead to a file structure like:
│ │ some_layout.rb
│ │ │ page1.rb
│ │ │ page2.rb
│ │ │ page3.rb
and then used in a controller like this:
class SomeController < ApplicationController
render SomeApp::Pages::Page3, matestack_layout: false # skip app layout on this page