# Include all Methods that are needed when a controller contains the dashboard.
#
module ApplicationController::HasDashboard
  extend ActiveSupport::Concern

  included do
    before_filter :load_constraints, :load_goals
  end

  module InstanceMethods
    def load_constraints
      @constraints = Current.view.constraints
    end

    def load_goals
      @goals = Current.view.policy_goals
    end
  end
end
# Include all Methods that are needed when a controller contains the dashboard.
#
module ApplicationController::HasDashboard
  extend ActiveSupport::Concern

  included do
    before_filter :load_constraints, :load_goals
  end

  module InstanceMethods
    def load_constraints
      @constraints = if session[:dashboard].any?
        Constraint.for_dashboard(session[:dashboard])
      else
        Current.view.constraints
      end
    end

    def load_goals
      @goals = Current.view.policy_goals
    end
  end
end

Use the custom dashboard choices when available.
Use the custom dashboard choices when available.

load_constraints will still fall back to using the Interface default
constraints whenever the user has not set their own constraint
preferences.
