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:]]' ```
17 lines
678 B
Plaintext
17 lines
678 B
Plaintext
<%# locals: (title:, icon:, description:, button_link: nil, button_title: nil) %>
|
|
|
|
<div class="text-center empty-state">
|
|
<%== part("components/icon", name: icon, classes: "mx-auto h-12 w-12 text-gray-400") %>
|
|
<h3 class="mt-2 text-sm font-semibold text-gray-900"><%= title %></h3>
|
|
<p class="mt-1 text-sm text-gray-500"><%= description %></p>
|
|
<div class="mt-6">
|
|
<% if button_link %>
|
|
<%== part("components/button", link: button_link, text: button_title) %>
|
|
<% elsif button_title %>
|
|
<div class="flex justify-center">
|
|
<%== part("components/button", text: button_title, attributes: { type: "submit" }) %>
|
|
</div>
|
|
<% end %>
|
|
</div>
|
|
</div>
|