Module: Unmagic
- Defined in:
- lib/unmagic/component_partial.rb,
lib/unmagic/component_partial/helper.rb,
lib/unmagic/component_partial/partial.rb,
lib/unmagic/component_partial/railtie.rb,
lib/unmagic/component_partial/version.rb
Overview
Component-partial slots, after Dom Christie’s “Component partials” (domchristie.co.uk/posts/component-partials/).
Render a partial as a layout and yield it a Partial object. The block fills named slots that the partial reads back wherever it likes — handy for content that isn’t the main body, e.g. a card footer:
<%= render layout: "shared/card" do |card| %>
...body...
<% card.content_for :footer do %><%= form.submit %><% end %>
<% end %>
and in the partial: ‘<%= partial.content_for(:footer) %>`, where `partial = component_partial`.
Defined Under Namespace
Modules: ComponentPartial