Adds missing content to budget investments mode view

This feature was already on Madrid fork and missing on backport
This commit is contained in:
decabeza
2018-04-05 14:53:22 +02:00
parent b101b28d0f
commit ef00eaa765
4 changed files with 33 additions and 8 deletions

View File

@@ -16,6 +16,7 @@ module Budgets
before_action :set_random_seed, only: :index before_action :set_random_seed, only: :index
before_action :load_categories, only: [:index, :new, :create] before_action :load_categories, only: [:index, :new, :create]
before_action :set_default_budget_filter, only: :index before_action :set_default_budget_filter, only: :index
before_action :set_view, only: :index
skip_authorization_check only: :json_data skip_authorization_check only: :json_data

View File

@@ -8,4 +8,23 @@ module BudgetInvestmentsHelper
def budget_investments_advanced_filters(params) def budget_investments_advanced_filters(params)
params.map { |af| t("admin.budget_investments.index.filters.#{af}") }.join(', ') params.map { |af| t("admin.budget_investments.index.filters.#{af}") }.join(', ')
end end
def investments_minimal_view_path
budget_investments_path(id: @heading.group.to_param,
heading_id: @heading.to_param,
filter: @current_filter,
view: investments_secondary_view)
end
def investments_default_view?
@view == "default"
end
def investments_current_view
@view
end
def investments_secondary_view
investments_current_view == "default" ? "minimal" : "default"
end
end end

View File

@@ -0,0 +1,13 @@
<div id="<%= dom_id(investment) %>" class="budget-investment minimal clear">
<div class="panel">
<div class="row">
<div class="small-12 column">
<div class="budget-investment-content">
<% cache [locale_and_user_status(investment), 'index_minimal', investment, investment.author] do %>
<h3><%= link_to investment.title, namespaced_budget_investment_path(investment) %></h3>
<% end %>
</div>
</div>
</div>
</div>
</div>

View File

@@ -70,20 +70,12 @@
ballot: @ballot ballot: @ballot
} %> } %>
<% end %> <% end %>
<%= render "banners" if @budget.selecting? || @budget.balloting? %>
<%= paginate @investments %>
<% else %> <% else %>
<% @investments.each do |investment| %> <% @investments.each do |investment| %>
<%= render partial: '/budgets/investments/investment_minimal', <%= render partial: '/budgets/investments/investment_minimal',
locals: { investment: investment } %> locals: { investment: investment } %>
<% end %> <% end %>
<%= render "banners" if @budget.selecting? || @budget.balloting? %>
<%= paginate @investments %>
<% end %> <% end %>
<%= paginate @investments %> <%= paginate @investments %>