2015-06-29 22:51:29 +00:00
|
|
|
'use strict';
|
|
|
|
|
2015-11-23 19:19:02 +00:00
|
|
|
// SubmitForm controller
|
2016-05-05 13:00:58 +00:00
|
|
|
angular.module('forms').controller('SubmitFormController', [
|
|
|
|
'$scope', '$rootScope', '$state', '$translate', 'myForm', 'Auth',
|
|
|
|
function($scope, $rootScope, $state, $translate, myForm, Auth) {
|
2015-11-23 19:19:02 +00:00
|
|
|
$scope.authentication = Auth;
|
2015-10-30 18:40:02 +00:00
|
|
|
$scope.myform = myForm;
|
2016-05-19 17:58:05 +00:00
|
|
|
|
2016-05-05 13:00:58 +00:00
|
|
|
$translate.use(myForm.language);
|
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-06-29 22:51:29 +00:00
|
|
|
}
|
2016-04-27 14:09:04 +00:00
|
|
|
]);
|