Beautifying Our Markup with Haml
Let’s take a look once again at a simple view that we use in the Depot application, in this case, one that presents our storefront:
| <p id="notice"><%= notice %></p> |
| |
| <h1><%= t('.title_html') %></h1> |
| |
| <% cache @products do %> |
| <% @products.each do |product| %> |
| <% cache product do %> |
| <div class="entry"> |
| <%= image_tag(product.image_url) %> |
| <h3><%= product.title %></h3> |
| <%= sanitize(product.description) %> |
| <div class="price_line"> |
| <span class="price"><%= number_to_currency(product.price) %></span> |
| <%= button_to t('.add_html'), |
| line_items_path(product_id: product, locale: I18n.locale), ... |
Get Agile Web Development with Rails 5, 1st Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.