Clear instance variable names help understand what's going around when you're deep 2 or 3 partials. In this case @budget is only used to carry around the current_budget so @current_budget is more descriptive. Using `current_budget` directly around would be an alternative, but maybe not as maintainable in case we want to change which budget is being shown (for example the drafting one if you're admin).
14 lines
527 B
Plaintext
14 lines
527 B
Plaintext
<ul class="no-bullet budget-timeline">
|
|
<% @current_budget.published_phases.each do |phase| %>
|
|
<li class="phase <%= 'active' if phase == @current_budget.current_phase %>">
|
|
<h3><%= t("budgets.phase.#{phase.kind}") %></h3>
|
|
<span>
|
|
<%= l(phase.starts_at.to_date, format: :long) if phase.starts_at.present? %>
|
|
-
|
|
<%= l(phase.ends_at.to_date - 1.day, format: :long) if phase.ends_at.present? %>
|
|
</span>
|
|
<p><%= safe_html_with_links(phase.summary) %></p>
|
|
</li>
|
|
<% end %>
|
|
</ul>
|