2015-06-29 22:51:29 +00:00
|
|
|
'use strict';
|
|
|
|
|
|
|
|
// Forms controller
|
2015-11-11 20:29:16 +00:00
|
|
|
angular.module('forms').controller('SubmitFormController', ['$scope', '$rootScope', '$state', 'myForm',
|
|
|
|
function($scope, $rootScope, $state, myForm) {
|
|
|
|
$scope.authentication = $rootScope.authentication;
|
2015-10-30 18:40:02 +00:00
|
|
|
$scope.myform = myForm;
|
2015-07-28 22:29:07 +00:00
|
|
|
|
2015-10-30 18:40:02 +00:00
|
|
|
if(!$scope.myform.isLive){
|
|
|
|
// Show navbar if form is not public AND user IS loggedin
|
2015-11-13 03:31:02 +00:00
|
|
|
if($scope.authentication.isAuthenticated()){
|
2015-10-30 18:40:02 +00:00
|
|
|
$scope.hideNav = $rootScope.hideNav = false;
|
|
|
|
}
|
|
|
|
// Redirect if form is not public user IS NOT loggedin
|
|
|
|
else {
|
|
|
|
$scope.hideNav = $rootScope.hideNav = true;
|
|
|
|
$state.go('access_denied');
|
|
|
|
}
|
|
|
|
}else{
|
|
|
|
$scope.hideNav = $rootScope.hideNav = true;
|
|
|
|
}
|
2015-08-06 05:52:59 +00:00
|
|
|
|
2015-06-29 22:51:29 +00:00
|
|
|
}
|
|
|
|
]);
|