-
-
Notifications
You must be signed in to change notification settings - Fork 0
Pages
Mattia Roccoberton edited this page May 2, 2023
·
1 revision
A page is presented using a View object.
Sample:
sections:
- slug: stats
name: Stats
type: page
page: StatsPage
Then define your view object page:
class Stats < TinyAdmin::Views::DefaultLayout
def template
super do
h1 { 'Stats page' }
end
end
def title
'A stats page'
end
end
A Content object is a like a Page but its content is defined directly in the configuration itself.
Sample:
sections:
- slug: test-content
name: Test content
type: content
content: >
<h1>Test content!</h1>
<p>Some test content</p>
You can customise also the page for missing pages (PageNotFound
) and the page for missing records (RecordNotFound
) using your own View objects.
Sample:
page_not_found: PageNotFound
record_not_found: RecordNotFound
And then:
class PageNotFound < TinyAdmin::Views::DefaultLayout
def template
super do
h1 { 'Page not found!' }
end
end
end
class RecordNotFound < TinyAdmin::Views::DefaultLayout
def template
super do
h1 { 'Record not found!' }
end
end
end