Merge branch 'master' into feature/budget_phases

This commit is contained in:
BertoCQ
2018-01-16 17:47:47 +01:00
committed by GitHub
26 changed files with 166 additions and 76 deletions

View File

@@ -2,7 +2,7 @@ class Admin::BudgetsController < Admin::BaseController
include FeatureFlags
feature_flag :budgets
has_filters %w{current finished}, only: :index
has_filters %w{open finished}, only: :index
load_and_authorize_resource

View File

@@ -25,6 +25,7 @@ class ApplicationController < ActionController::Base
layout :set_layout
respond_to :html
helper_method :current_budget
private
@@ -120,4 +121,8 @@ class ApplicationController < ActionController::Base
params[:filter] ||= "selected"
end
end
def current_budget
Budget.current
end
end

View File

@@ -19,7 +19,7 @@ class Management::BudgetsController < Management::BaseController
end
def print_investments
@budgets = Budget.current.order(created_at: :desc).page(params[:page])
@budget = Budget.current
end
private

View File

@@ -5,10 +5,10 @@ class Valuation::BudgetsController < Valuation::BaseController
load_and_authorize_resource
def index
@budgets = @budgets.current.order(created_at: :desc).page(params[:page])
@investments_with_valuation_open = {}
@budgets.each do |b|
@investments_with_valuation_open[b.id] = b.investments
@budget = Budget.current
if @budget.present?
@investments_with_valuation_open = {}
@investments_with_valuation_open = @budget.investments
.by_valuator(current_user.valuator.try(:id))
.valuation_open
.count