Extract component to render heading executions
Note we're adding the `budgets-executions-heading` HTML class, which is consistent to what we do in other components.
This commit is contained in:
26
app/components/budgets/executions/heading_component.html.erb
Normal file
26
app/components/budgets/executions/heading_component.html.erb
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
<div class="budgets-executions-heading">
|
||||||
|
<h4 id="<%= heading.name.parameterize %>">
|
||||||
|
<%= heading.name %> (<%= investments.count %>)
|
||||||
|
</h4>
|
||||||
|
<div class="row" data-equalizer-on="medium" data-equalizer>
|
||||||
|
<% investments.each do |investment| %>
|
||||||
|
<div class="small-12 medium-6 large-4 column end margin-bottom">
|
||||||
|
<div class="budget-execution" data-equalizer-watch>
|
||||||
|
<%= render Budgets::Executions::ImageComponent.new(investment) %>
|
||||||
|
<div class="budget-execution-info">
|
||||||
|
<div class="budget-execution-content">
|
||||||
|
<h5>
|
||||||
|
<%= link_to investment.title,
|
||||||
|
polymorphic_path(investment, anchor: "tab-milestones") %>
|
||||||
|
</h5>
|
||||||
|
<span class="author"><%= investment.author.name %></span>
|
||||||
|
</div>
|
||||||
|
<p class="price margin-top text-center">
|
||||||
|
<strong><%= investment.formatted_price %></strong>
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<% end %>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
8
app/components/budgets/executions/heading_component.rb
Normal file
8
app/components/budgets/executions/heading_component.rb
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
class Budgets::Executions::HeadingComponent < ApplicationComponent
|
||||||
|
attr_reader :heading, :investments
|
||||||
|
|
||||||
|
def initialize(heading, investments)
|
||||||
|
@heading = heading
|
||||||
|
@investments = investments
|
||||||
|
end
|
||||||
|
end
|
||||||
@@ -1,26 +1,3 @@
|
|||||||
<% investments_by_heading.each do |heading, investments| %>
|
<% investments_by_heading.each do |heading, investments| %>
|
||||||
<h4 id="<%= heading.name.parameterize %>">
|
<%= render Budgets::Executions::HeadingComponent.new(heading, investments) %>
|
||||||
<%= heading.name %> (<%= investments.count %>)
|
|
||||||
</h4>
|
|
||||||
<div class="row" data-equalizer-on="medium" data-equalizer>
|
|
||||||
<% investments.each do |investment| %>
|
|
||||||
<div class="small-12 medium-6 large-4 column end margin-bottom">
|
|
||||||
<div class="budget-execution" data-equalizer-watch>
|
|
||||||
<%= render Budgets::Executions::ImageComponent.new(investment) %>
|
|
||||||
<div class="budget-execution-info">
|
|
||||||
<div class="budget-execution-content">
|
|
||||||
<h5>
|
|
||||||
<%= link_to investment.title,
|
|
||||||
polymorphic_path(investment, anchor: "tab-milestones") %>
|
|
||||||
</h5>
|
|
||||||
<span class="author"><%= investment.author.name %></span>
|
|
||||||
</div>
|
|
||||||
<p class="price margin-top text-center">
|
|
||||||
<strong><%= investment.formatted_price %></strong>
|
|
||||||
</p>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<% end %>
|
|
||||||
</div>
|
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|||||||
Reference in New Issue
Block a user