This uses the new part plugin to simplify and optimize render calls with locals. ```ruby render(:template, locals: {foo: 'bar'}) part(:template, foo: 'bar') ``` This simplifies a large number of calls in Clover, since rendering with locals is one of the most common method calls in the templates. The main advantage of this is simplicity, but the part method is also more optimized, and will be even more optimized when we upgrade to Ruby 3.4. Diff best reviewed with: ``` git diff -b --color-words --word-diff-regex='\\w+|[^[:space:]]' ```
19 lines
717 B
Plaintext
19 lines
717 B
Plaintext
<div class="-mt-6 mb-2 space-y-2">
|
|
<% [
|
|
["notice", "hero-check-circle-mini", "bg-green-50", "text-green-800", "text-green-400"],
|
|
["error", "hero-x-circle-mini", "bg-red-50", "text-red-800", "text-red-400"]
|
|
].each do |type, icon, bg_color, text_color, icon_color| %>
|
|
<% next unless flash[type] %>
|
|
<div class="rounded-md <%= bg_color %> p-4">
|
|
<div class="flex">
|
|
<div class="flex-shrink-0">
|
|
<%== part("components/icon", name: icon, classes: "h-5 w-5 #{icon_color}") %>
|
|
</div>
|
|
<div class="ml-3">
|
|
<h3 id="flash-<%= type %>" class="text-sm font-medium <%= text_color %>"><%= flash[type] %></h3>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<% end %>
|
|
</div>
|