tellform/public/modules/forms/controllers/submit-form.client.controller.js

24 lines
678 B
JavaScript
Raw Normal View History

2015-06-29 22:51:29 +00:00
'use strict';
2015-11-23 19:19:02 +00:00
// SubmitForm controller
angular.module('forms').controller('SubmitFormController', ['$scope', '$rootScope', '$state', 'myForm', 'Auth',
function($scope, $rootScope, $state, myForm, Auth) {
$scope.authentication = Auth;
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
}
]);