Use current_budget directly instead of instance variable
This commit is contained in:
@@ -15,7 +15,6 @@ class BudgetsController < ApplicationController
|
||||
|
||||
def index
|
||||
@finished_budgets = @budgets.finished.order(created_at: :desc)
|
||||
@current_budget = current_budget
|
||||
@budgets_coordinates = current_budget_map_locations
|
||||
end
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<ul class="no-bullet budget-timeline">
|
||||
<% @current_budget.published_phases.each do |phase| %>
|
||||
<li class="phase <%= 'active' if phase == @current_budget.current_phase %>">
|
||||
<% 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? %>
|
||||
|
||||
@@ -7,9 +7,9 @@
|
||||
<div class="row" data-equalizer data-equalizer-on="medium">
|
||||
<div class="small-12 medium-9 column padding" data-equalizer-watch>
|
||||
|
||||
<h1><%= @current_budget.name %></h1>
|
||||
<h1><%= current_budget.name %></h1>
|
||||
<div class="description">
|
||||
<%= safe_html_with_links(@current_budget.description) %>
|
||||
<%= safe_html_with_links(current_budget.description) %>
|
||||
</div>
|
||||
<p>
|
||||
<%= link_to t("budgets.index.section_header.help"), "#section_help" %>
|
||||
@@ -19,11 +19,11 @@
|
||||
<p>
|
||||
<strong><%= t('budgets.show.phase') %></strong>
|
||||
</p>
|
||||
<h2><%= t("budgets.phase.#{@current_budget.phase}") %></h2>
|
||||
<h2><%= t("budgets.phase.#{current_budget.phase}") %></h2>
|
||||
|
||||
<%= link_to t("budgets.index.section_header.all_phases"), "#all_phases" %>
|
||||
|
||||
<% if @current_budget.accepting? %>
|
||||
<% if current_budget.accepting? %>
|
||||
<% if current_user %>
|
||||
<% if current_user.level_two_or_three_verified? %>
|
||||
<%= link_to t("budgets.investments.index.sidebar.create"),
|
||||
@@ -48,9 +48,9 @@
|
||||
<% end %>
|
||||
|
||||
|
||||
<% if @current_budget.finished? || (@current_budget.balloting? && can?(:read_results, @current_budget)) %>
|
||||
<% if current_budget.finished? || (current_budget.balloting? && can?(:read_results, current_budget)) %>
|
||||
<%= link_to t("budgets.show.see_results"),
|
||||
budget_results_path(@current_budget, heading_id: @current_budget.headings.first),
|
||||
budget_results_path(current_budget, heading_id: current_budget.headings.first),
|
||||
class: "button margin-top expanded" %>
|
||||
<% end %>
|
||||
</div>
|
||||
@@ -62,18 +62,18 @@
|
||||
<div class="small-12 column">
|
||||
|
||||
<div id="groups_and_headings" class="groups-and-headings">
|
||||
<% @current_budget.groups.each do |group| %>
|
||||
<% current_budget.groups.each do |group| %>
|
||||
<h2><%= group.name %></h2>
|
||||
<ul class="no-bullet">
|
||||
<% group.headings.order_by_group_name.each do |heading| %>
|
||||
<li class="heading small-12 medium-4 large-2">
|
||||
<% unless @budget.informing? %>
|
||||
<%= link_to budget_investments_path(@current_budget.id, heading_id: heading.id) do %>
|
||||
<%= heading_name_and_price_html(heading, @current_budget) %>
|
||||
<% unless current_budget.informing? %>
|
||||
<%= link_to budget_investments_path(current_budget.id, heading_id: heading.id) do %>
|
||||
<%= heading_name_and_price_html(heading, current_budget) %>
|
||||
<% end %>
|
||||
<% else %>
|
||||
<div>
|
||||
<%= heading_name_and_price_html(heading, @current_budget) %>
|
||||
<%= heading_name_and_price_html(heading, current_budget) %>
|
||||
</div>
|
||||
<% end %>
|
||||
</li>
|
||||
@@ -82,20 +82,20 @@
|
||||
<% end %>
|
||||
</div>
|
||||
|
||||
<% unless @budget.informing? %>
|
||||
<% unless current_budget.informing? %>
|
||||
<div id="map">
|
||||
<h3><%= t("budgets.index.map") %></h3>
|
||||
<%= render_map(nil, "budgets", false, nil, @budgets_coordinates) %>
|
||||
</div>
|
||||
|
||||
<p>
|
||||
<%= link_to budget_investments_path(@current_budget.id) do %>
|
||||
<%= link_to budget_investments_path(current_budget.id) do %>
|
||||
<small><%= t("budgets.index.investment_proyects") %></small>
|
||||
<% end %><br>
|
||||
<%= link_to budget_investments_path(budget_id: @current_budget.id, filter: 'unfeasible') do %>
|
||||
<%= link_to budget_investments_path(budget_id: current_budget.id, filter: 'unfeasible') do %>
|
||||
<small><%= t("budgets.index.unfeasible_investment_proyects") %></small>
|
||||
<% end %><br>
|
||||
<%= link_to budget_investments_path(budget_id: @current_budget.id, filter: 'unselected') do %>
|
||||
<%= link_to budget_investments_path(budget_id: current_budget.id, filter: 'unselected') do %>
|
||||
<small><%= t("budgets.index.not_selected_investment_proyects") %></small>
|
||||
<% end %>
|
||||
</p>
|
||||
@@ -103,7 +103,7 @@
|
||||
|
||||
<div id="all_phases">
|
||||
<h2><%= t("budgets.index.all_phases") %></h2>
|
||||
<%= render "phases", budget: @current_budget %>
|
||||
<%= render "phases", budget: current_budget %>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user