{"size": 1104, "ext": "js", "max_stars_repo_path": "VotingApplication/VotingApplication.Web/Scripts/Controllers/DashboardController.js", "max_stars_repo_name": "stevenhillcox/voting-application", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "VotingApplication/VotingApplication.Web/Scripts/Controllers/DashboardController.js", "max_issues_repo_name": "stevenhillcox/voting-application", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "VotingApplication/VotingApplication.Web/Scripts/Controllers/DashboardController.js", "max_forks_repo_name": "stevenhillcox/voting-application", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": null, "max_issues_count": null, "max_forks_count": null, "avg_line_length": 29.8378378378, "max_line_length": 81, "alphanum_fraction": 0.6240942029}
﻿/// <reference path="../Services/AccountService.js" />
/// <reference path="../Services/RoutingService.js" />
(function () {
    'use strict';

    angular
        .module('GVA.Manage')
        .controller('DashboardController', DashboardController);

    DashboardController.$inject = ['$scope', 'AccountService', 'RoutingService'];

    function DashboardController($scope, AccountService, RoutingService) {

        $scope.account = AccountService.account;
        $scope.openLoginDialog = showLoginDialog;
        $scope.openRegisterDialog = openRegisterDialog;
        $scope.signOut = AccountService.clearAccount;
        $scope.myPollsLink = RoutingService.getMyPollsUrl();
        
        activate();

        function showLoginDialog() {
            RoutingService.navigateToLoginPage();
        }

        function openRegisterDialog() {
            RoutingService.navigateToRegisterPage();
        }

        function activate() {
            AccountService.registerAccountObserver(function () {
                $scope.account = AccountService.account;
            });
        }
    }
})();
