/**
 * Navigation controls within a quiz
 *
 * @author Simon Willan <simon.willan@claromentis.com>
 */
(function () {
    'use strict';

    angular.module('cla.quiz')
        .directive('claFinishModal', finishModal);

    //finishModal.$inject = [];

    /**
     *
     * @constructor
     */
    function finishModal() {
        return {
            bindToController: true,
            controller: controller,
            controllerAs: 'fin',
            replace: true,
            restrict: 'E',
            scope: {},
            templateUrl: '/intranet/quiz/html/modals/finish_quiz.html'
        };

        function controller($rootScope) {

            this.finish = finish;

            /**
             * Finish the quiz
             */
            function finish() {
                $rootScope.$broadcast('quiz.finished');
            }
        }
    }
}());
