# frozen_string_literal: true module Pages module Library class Collections < ApplicationPage def template render Layout.new(title: "Getting started with Rails") do render Markdown.new <<~MD # Collections Phlex comes with an abstract pattern for views that represent collections of resources — lists, grids, tables, etc. Collections have two parts: one part wraps the whole collection, the other part is repeated once for each item in that collection. When you include `Phlex::Collection` in a `Phlex::HTML`, the `template` and `initialize` methods are defined for you. You don't need to define these. Instead, you define a `collection_template` and `item_template`. ## Collection template The `collection_template` method should accept a content block which is used to yield the items. We can yield this block or pass it to another element, such as `