Books by Vintage

How this page is built the gem renders it — this is all you write

“Cards” is a custom layout you add — the gem ships only the built-in :table. Drop one partial that receives the same collection presenter (still driven by the :index fieldset) and arrange the markup however you like; the gem still derives the fields, cells, filtering, sorting and actions for you. A card grid has no column headers, so crud_filter takes sort: true to carry the sort picker.

app/views/crud_components/layouts/_cards.html.erb
<% collection.records.each do |record| %>
  <div class="card card-body">
    <% collection.fields.each do |f| %><%= collection.cell(f, record) %><% end %>
  </div>
<% end %>
app/views/books/index.html.erb
<%= crud_collection @books, fieldset: :index, layout: :cards %>
<%= crud_filter   Book, fieldset: :index, sort: true %>   <%# headerless → carry the sort picker %>

Read more: Add a layout  ·  Views

Reset
The Endless Mirror 2
Author names
Ann Leckie, Mary Shelley, and Ursula Le Guin
Genre
Nonfiction
Price
28.63 €
Publisher
Vintage
Active
The Silent Tower 3
Author names
Stanisław Lem and Martha Wells
Genre
Scifi
Price
43.93 €
Publisher
Vintage
Active
The Broken Engine 4
Author names
Liu Cixin, Ann Leckie, and Ursula Le Guin
Genre
Fiction
Price
12.63 €
Publisher
Vintage
Active
The Endless Empire 5
Author names
Ann Leckie
Genre
Nonfiction
Price
25.88 €
Publisher
Vintage
Active
Filter
Cover
Title
Author names
Genre
Price
Publisher
Active
Sort by
Reset