Page

Partial to wrap an app page, like a #show view.

It's composed of three content sections:

  1. render "shared/title", with the title and actions provided.
  2. render "shared/notices", for any account level notices.
  3. Outputs the passed body.

Samples

Basic

0.7ms 484 allocs
Lorem ipsum dolor sit amet…
View Source
<%= render "shared/page" do |page| %>
  <% page.title "Title" %>
  <% page.actions do %>
    <%= link_to "Home", root_url, class: "border-2 p-2 rounded-full border-indigo-300" %>
    <%= link_to "Another link", root_url, class: "border-2 p-2 rounded-full border-indigo-300" %>
  <% end %>
  <% page.body "Lorem ipsum dolor sit amet…" %>
<% end %>

With box

0.3ms 425 allocs

Page Title

Box Title

Description

Lorem ipsum dolor sit amet…
View Source
<%= render "shared/page", title: "Page Title" do |page| %>
  <% page.body.render "shared/box" do |box| %>
    <% box.title "Box Title" %>
    <% box.description "Description" %>
    <% box.body "Lorem ipsum dolor sit amet…" %>
  <% end %>
<% end %>

With notices

0.4ms 689 allocs

Title

Success Notice

Error Notice

View Source
<% flash.now[:notice] = "Success Notice" %>
<% flash.now[:error] = "Error Notice" %>
<%= render "shared/page", title: "Title" %>

Options

Name Required Type Default Description
title
Content Block
actions
Content Block
body
Content Block