fixed delete modal bug
This commit is contained in:
parent
853c818df0
commit
ad9df818e6
|
@ -41,6 +41,10 @@
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
<link rel="stylesheet" href="/lib/angular-input-stars/angular-input-stars.css">
|
<link rel="stylesheet" href="/lib/angular-input-stars/angular-input-stars.css">
|
||||||
<link rel="stylesheet" href="/lib/jquery-ui/themes/flick/jquery-ui.css"/>
|
<link rel="stylesheet" href="/lib/jquery-ui/themes/flick/jquery-ui.css"/>
|
||||||
|
<link rel="stylesheet" href="/modules/core/css/github-fork-ribbon.css"/>
|
||||||
|
<!--[if lt IE 9]>
|
||||||
|
<link rel="stylesheet" href="gh-fork-ribbon.ie.css">
|
||||||
|
<![endif]-->
|
||||||
<!-- end Bower CSS dependencies-->
|
<!-- end Bower CSS dependencies-->
|
||||||
|
|
||||||
<!--Application CSS Files-->
|
<!--Application CSS Files-->
|
||||||
|
@ -57,7 +61,7 @@
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
<body ng-cloak>
|
<body ng-cloak>
|
||||||
<div class="github-fork-ribbon-wrapper right">
|
<div class="github-fork-ribbon-wrapper right-bottom hidden-xs hidden-sm">
|
||||||
<div class="github-fork-ribbon">
|
<div class="github-fork-ribbon">
|
||||||
<a href="https://github.com/whitef0x0/nodeforms">Fork me on GitHub</a>
|
<a href="https://github.com/whitef0x0/nodeforms">Fork me on GitHub</a>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -32,8 +32,7 @@
|
||||||
"file-saver.js": "~1.20150507.2",
|
"file-saver.js": "~1.20150507.2",
|
||||||
"angular-bootstrap-colorpicker": "~3.0.19",
|
"angular-bootstrap-colorpicker": "~3.0.19",
|
||||||
"components-font-awesome": "~4.4.0",
|
"components-font-awesome": "~4.4.0",
|
||||||
"angular-ui-router-tabs": "~1.7.0",
|
"angular-ui-router-tabs": "~1.7.0"
|
||||||
"github-fork-ribbon-css": "~0.1.1"
|
|
||||||
},
|
},
|
||||||
"resolutions": {
|
"resolutions": {
|
||||||
"angular": "~1.3.20",
|
"angular": "~1.3.20",
|
||||||
|
|
538
public/dist/application.js
vendored
538
public/dist/application.js
vendored
|
@ -114,7 +114,7 @@ ApplicationConfiguration.registerModule('core', ['users']);
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
// Use Application configuration module to register a new module
|
// Use Application configuration module to register a new module
|
||||||
ApplicationConfiguration.registerModule('forms', ['ngFileUpload', 'colorpicker.module', 'ui.date', 'ui.sortable', 'angular-input-stars', 'users']);
|
ApplicationConfiguration.registerModule('forms', ['ngFileUpload', 'ui.router.tabs', 'colorpicker.module', 'ui.date', 'ui.sortable', 'angular-input-stars', 'users']);
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
// Use Application configuration module to register a new module
|
// Use Application configuration module to register a new module
|
||||||
|
@ -134,11 +134,6 @@ angular.module('core').config(['$stateProvider', '$urlRouterProvider',
|
||||||
templateUrl: 'modules/core/views/home.client.view.html'
|
templateUrl: 'modules/core/views/home.client.view.html'
|
||||||
});
|
});
|
||||||
|
|
||||||
// $urlRouterProvider.otherwise( function($injector) {
|
|
||||||
// var $state = $injector.get('$state');
|
|
||||||
// $state.go('home');
|
|
||||||
// });
|
|
||||||
|
|
||||||
}
|
}
|
||||||
]);
|
]);
|
||||||
'use strict';
|
'use strict';
|
||||||
|
@ -386,9 +381,6 @@ angular.module('forms').run(['Menus',
|
||||||
});
|
});
|
||||||
|
|
||||||
var fields = formObj.form_fields;
|
var fields = formObj.form_fields;
|
||||||
// fieldKeys.map(function(key){
|
|
||||||
// return formObj[key];
|
|
||||||
// });
|
|
||||||
|
|
||||||
var valid_count = fields.filter(function(field){
|
var valid_count = fields.filter(function(field){
|
||||||
if(typeof field === 'object'){
|
if(typeof field === 'object'){
|
||||||
|
@ -400,11 +392,11 @@ angular.module('forms').run(['Menus',
|
||||||
return 0;
|
return 0;
|
||||||
};
|
};
|
||||||
}).config(['$provide', function ($provide){
|
}).config(['$provide', function ($provide){
|
||||||
$provide.decorator('accordionDirective', function($delegate) {
|
$provide.decorator('accordionDirective', ["$delegate", function($delegate) {
|
||||||
var directive = $delegate[0];
|
var directive = $delegate[0];
|
||||||
directive.replace = true;
|
directive.replace = true;
|
||||||
return $delegate;
|
return $delegate;
|
||||||
});
|
}]);
|
||||||
}]);
|
}]);
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
|
@ -429,13 +421,12 @@ angular.module('forms').config(['$stateProvider',
|
||||||
},
|
},
|
||||||
resolve: {
|
resolve: {
|
||||||
Forms: 'Forms',
|
Forms: 'Forms',
|
||||||
myForm: function (Forms, $stateParams) {
|
myForm: ["Forms", "$stateParams", function (Forms, $stateParams) {
|
||||||
return Forms.get({formId: $stateParams.formId}).$promise;
|
return Forms.get({formId: $stateParams.formId}).$promise;
|
||||||
},
|
}],
|
||||||
},
|
},
|
||||||
controller: 'SubmitFormController'
|
controller: 'SubmitFormController'
|
||||||
}).
|
}).state('viewForm', {
|
||||||
state('viewForm', {
|
|
||||||
url: '/forms/:formId/admin',
|
url: '/forms/:formId/admin',
|
||||||
templateUrl: 'modules/forms/views/admin-form.client.view.html',
|
templateUrl: 'modules/forms/views/admin-form.client.view.html',
|
||||||
data: {
|
data: {
|
||||||
|
@ -443,13 +434,24 @@ angular.module('forms').config(['$stateProvider',
|
||||||
},
|
},
|
||||||
resolve: {
|
resolve: {
|
||||||
Forms: 'Forms',
|
Forms: 'Forms',
|
||||||
myForm: function (Forms, $stateParams) {
|
myForm: ["Forms", "$stateParams", function (Forms, $stateParams) {
|
||||||
return Forms.get({formId: $stateParams.formId}).$promise;
|
return Forms.get({formId: $stateParams.formId}).$promise;
|
||||||
},
|
}],
|
||||||
},
|
},
|
||||||
controller: 'AdminFormController'
|
controller: 'AdminFormController'
|
||||||
});
|
}).state('viewForm.configure', {
|
||||||
|
url: '/configure',
|
||||||
|
templateUrl: 'modules/forms/views/adminTabs/configure.html'
|
||||||
|
}).state('viewForm.design', {
|
||||||
|
url: '/design',
|
||||||
|
templateUrl: 'modules/forms/views/adminTabs/design.html'
|
||||||
|
}).state('viewForm.analyze', {
|
||||||
|
url: '/analyze',
|
||||||
|
templateUrl: 'modules/forms/views/adminTabs/analyze.html'
|
||||||
|
}).state('viewForm.create', {
|
||||||
|
url: '/create',
|
||||||
|
templateUrl: 'modules/forms/views/adminTabs/create.html'
|
||||||
|
});
|
||||||
}
|
}
|
||||||
]);
|
]);
|
||||||
'use strict';
|
'use strict';
|
||||||
|
@ -464,8 +466,25 @@ angular.module('forms').controller('AdminFormController', ['$rootScope', '$scope
|
||||||
$rootScope.saveInProgress = false;
|
$rootScope.saveInProgress = false;
|
||||||
CurrentForm.setForm($scope.myform);
|
CurrentForm.setForm($scope.myform);
|
||||||
|
|
||||||
// console.log($scope.myform);
|
$scope.tabData = [
|
||||||
|
{
|
||||||
|
heading: 'Create',
|
||||||
|
route: 'viewForm.create'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
heading: 'Design',
|
||||||
|
route: 'viewForm.design',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
heading: 'Configure',
|
||||||
|
route: 'viewForm.configure',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
heading: 'Analyze',
|
||||||
|
route: 'viewForm.analyze',
|
||||||
|
}
|
||||||
|
];
|
||||||
|
|
||||||
// Find a specific Form
|
// Find a specific Form
|
||||||
$scope.findOne = function(){
|
$scope.findOne = function(){
|
||||||
Forms.get({
|
Forms.get({
|
||||||
|
@ -600,24 +619,24 @@ angular.module('forms').controller('ListFormsController', ['$rootScope', '$scope
|
||||||
$state.go(route, {'formId': id}, {reload: true});
|
$state.go(route, {'formId': id}, {reload: true});
|
||||||
};
|
};
|
||||||
|
|
||||||
$scope.duplicate = function(form_index){
|
$scope.duplicateForm = function(form_index){
|
||||||
var form = _.clone($scope.myforms[form_index]);
|
var form = _.cloneDeep($scope.myforms[form_index]);
|
||||||
form._id = '';
|
delete form._id;
|
||||||
|
|
||||||
$http.post('/forms', {form: form})
|
$http.post('/forms', {form: form})
|
||||||
.success(function(data, status, headers){
|
.success(function(data, status, headers){
|
||||||
console.log('form duplicated');
|
|
||||||
$scope.myforms.splice(form_index+1, 0, data);
|
$scope.myforms.splice(form_index+1, 0, data);
|
||||||
console.log($scope.myforms[3]._id);
|
|
||||||
}).error(function(errorResponse){
|
}).error(function(errorResponse){
|
||||||
console.log(errorResponse);
|
console.error(errorResponse);
|
||||||
if(errorResponse == null) $scope.error = errorResponse.data.message;
|
if(errorResponse === null){
|
||||||
|
$scope.error = errorResponse.data.message;
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
};
|
||||||
|
|
||||||
// Create new Form
|
// Create new Form
|
||||||
$scope.createNew = function(){
|
$scope.createNewForm = function(){
|
||||||
console.log($scope.forms.createForm);
|
// console.log($scope.forms.createForm);
|
||||||
|
|
||||||
var form = {};
|
var form = {};
|
||||||
form.title = $scope.forms.createForm.title.$modelValue;
|
form.title = $scope.forms.createForm.title.$modelValue;
|
||||||
|
@ -627,9 +646,8 @@ angular.module('forms').controller('ListFormsController', ['$rootScope', '$scope
|
||||||
$http.post('/forms', {form: form})
|
$http.post('/forms', {form: form})
|
||||||
.success(function(data, status, headers){
|
.success(function(data, status, headers){
|
||||||
console.log('new form created');
|
console.log('new form created');
|
||||||
|
|
||||||
// Redirect after save
|
// Redirect after save
|
||||||
$scope.goToWithId('viewForm', data._id+'');
|
$scope.goToWithId('viewForm.create', data._id+'');
|
||||||
}).error(function(errorResponse){
|
}).error(function(errorResponse){
|
||||||
console.error(errorResponse);
|
console.error(errorResponse);
|
||||||
$scope.error = errorResponse.data.message;
|
$scope.error = errorResponse.data.message;
|
||||||
|
@ -645,9 +663,7 @@ angular.module('forms').controller('ListFormsController', ['$rootScope', '$scope
|
||||||
$http.delete('/forms/'+$scope.myforms[form_index]._id)
|
$http.delete('/forms/'+$scope.myforms[form_index]._id)
|
||||||
.success(function(data, status, headers){
|
.success(function(data, status, headers){
|
||||||
console.log('form deleted successfully');
|
console.log('form deleted successfully');
|
||||||
|
|
||||||
$scope.myforms.splice(form_index, 1);
|
$scope.myforms.splice(form_index, 1);
|
||||||
|
|
||||||
}).error(function(error){
|
}).error(function(error){
|
||||||
console.log('ERROR: Form could not be deleted.');
|
console.log('ERROR: Form could not be deleted.');
|
||||||
console.error(error);
|
console.error(error);
|
||||||
|
@ -682,132 +698,129 @@ angular.module('forms').controller('SubmitFormController', ['$scope', '$rootScop
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
_.mixin({ removeDateFields : function(o){
|
_.mixin({ removeDateFields : function(o){
|
||||||
var clone = _.clone(o);
|
var clone = _.clone(o);
|
||||||
for(var i=0; i<clone.length; i++){
|
for(var i=0; i<clone.length; i++){
|
||||||
_.each(clone[i], function(v,k){
|
_.each(clone[i], function(v,k){
|
||||||
// console.log('key: '+k);
|
if(k === 'lastModified' || k === 'created'){
|
||||||
if(k === 'lastModified' || k === 'created'){
|
delete clone[i][k];
|
||||||
delete clone[i][k];
|
}
|
||||||
}
|
});
|
||||||
});
|
}
|
||||||
}
|
return clone;
|
||||||
return clone;
|
|
||||||
}});
|
}});
|
||||||
|
|
||||||
angular.module('forms').directive('autoSaveForm', ['$rootScope', '$timeout', function($rootScope, $timeout) {
|
angular.module('forms').directive('autoSaveForm', ['$rootScope', '$timeout', function($rootScope, $timeout) {
|
||||||
|
|
||||||
return {
|
return {
|
||||||
require: ['^form'],
|
require: ['^form'],
|
||||||
restrict: 'AE',
|
restrict: 'AE',
|
||||||
link: function($scope, $element, $attrs, $ctrls) {
|
link: function($scope, $element, $attrs, $ctrls) {
|
||||||
|
//DAVID: TODO: Do we really need to check if our directive element is ready everytime
|
||||||
|
angular.element(document).ready(function() {
|
||||||
|
|
||||||
//DAVID: TODO: Do we really need to check if our directive element is ready everytime
|
var $formCtrl = $ctrls[0],
|
||||||
angular.element(document).ready(function() {
|
savePromise = null;
|
||||||
|
|
||||||
var $formCtrl = $ctrls[0],
|
|
||||||
savePromise = null;
|
|
||||||
|
|
||||||
$rootScope.finishedRender = false;
|
$rootScope.finishedRender = false;
|
||||||
$scope.$on('editFormFields Started', function(ngRepeatFinishedEvent) {
|
$scope.$on('editFormFields Started', function(ngRepeatFinishedEvent) {
|
||||||
$rootScope.finishedRender = false;
|
// console.log('hello');
|
||||||
});
|
$rootScope.finishedRender = false;
|
||||||
$scope.$on('editFormFields Finished', function(ngRepeatFinishedEvent) {
|
});
|
||||||
$rootScope.finishedRender = true;
|
$scope.$on('editFormFields Finished', function(ngRepeatFinishedEvent) {
|
||||||
});
|
$rootScope.finishedRender = true;
|
||||||
|
});
|
||||||
|
|
||||||
$scope.anyDirtyAndTouched = function(form){
|
$scope.anyDirtyAndTouched = function(form){
|
||||||
var propCount = 0;
|
var propCount = 0;
|
||||||
for(var prop in form) {
|
for(var prop in form) {
|
||||||
if(form.hasOwnProperty(prop) && prop[0] !== '$') {
|
if(form.hasOwnProperty(prop) && prop[0] !== '$') {
|
||||||
propCount++;
|
propCount++;
|
||||||
if(form[prop].$touched && form[prop].$dirty) {
|
if(form[prop].$touched && form[prop].$dirty) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
};
|
};
|
||||||
|
|
||||||
var debounceSave = function () {
|
var debounceSave = function () {
|
||||||
$rootScope.saveInProgress = true;
|
$rootScope.saveInProgress = true;
|
||||||
$rootScope[$attrs.autoSaveCallback](true,
|
|
||||||
function(err){
|
|
||||||
if(!err){
|
|
||||||
console.log('\n\nForm data persisted -- setting pristine flag');
|
|
||||||
$formCtrl.$setPristine();
|
|
||||||
}else{
|
|
||||||
console.error('Error form data NOT persisted');
|
|
||||||
console.error(err);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
//Update/Save Form if any Form fields are Dirty and Touched
|
$rootScope[$attrs.autoSaveCallback](true,
|
||||||
$scope.$watch(function(newValue, oldValue) {
|
function(err){
|
||||||
// console.log($scope);
|
if(!err){
|
||||||
console.log($scope.editForm);
|
console.log('\n\nForm data persisted -- setting pristine flag');
|
||||||
if($rootScope.finishedRender && $scope.anyDirtyAndTouched($scope.editForm) && !$rootScope.saveInProgress){
|
$formCtrl.$setPristine();
|
||||||
console.log('Form saving started');
|
}else{
|
||||||
debounceSave();
|
console.error('Error form data NOT persisted');
|
||||||
}
|
console.error(err);
|
||||||
});
|
}
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
//Autosave Form when model (specificed in $attrs.autoSaveWatch) changes
|
//Update/Save Form if any Form fields are Dirty and Touched
|
||||||
$scope.$watch($attrs.autoSaveWatch, function(newValue, oldValue) {
|
$scope.$watch(function(newValue, oldValue) {
|
||||||
|
// console.log($scope);
|
||||||
|
// console.log($scope.editForm);
|
||||||
|
if($rootScope.finishedRender && $scope.anyDirtyAndTouched($scope.editForm) && !$rootScope.saveInProgress){
|
||||||
|
// console.log('Form saving started');
|
||||||
|
debounceSave();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
newValue = angular.copy(newValue);
|
//Autosave Form when model (specificed in $attrs.autoSaveWatch) changes
|
||||||
oldValue = angular.copy(oldValue);
|
$scope.$watch($attrs.autoSaveWatch, function(newValue, oldValue) {
|
||||||
|
|
||||||
newValue.form_fields = _.removeDateFields(newValue.form_fields);
|
newValue = angular.copy(newValue);
|
||||||
oldValue.form_fields = _.removeDateFields(oldValue.form_fields);
|
oldValue = angular.copy(oldValue);
|
||||||
|
|
||||||
var changedFields = !_.isEqual(oldValue.form_fields,newValue.form_fields) || !_.isEqual(oldValue.startPage, newValue.startPage);
|
newValue.form_fields = _.removeDateFields(newValue.form_fields);
|
||||||
|
oldValue.form_fields = _.removeDateFields(oldValue.form_fields);
|
||||||
|
|
||||||
var changedFieldMap = !!oldValue.plugins.oscarhost.settings.fieldMap && !_.isEqual(oldValue.plugins.oscarhost.settings.fieldMap,newValue.plugins.oscarhost.settings.fieldMap);
|
var changedFields = !_.isEqual(oldValue.form_fields,newValue.form_fields) || !_.isEqual(oldValue.startPage, newValue.startPage);
|
||||||
if( (!newValue && !oldValue) || !oldValue ){
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// console.log('Autosaving');
|
|
||||||
// console.log('\n\n----------');
|
|
||||||
// console.log('!$dirty: '+ !$formCtrl.$dirty );
|
|
||||||
// console.log('changedFields: '+changedFields);
|
|
||||||
// console.log('changedFieldMap: '+changedFieldMap);
|
|
||||||
// console.log('finishedRender: '+$rootScope.finishedRender);
|
|
||||||
// console.log('!saveInProgress: '+!$rootScope.saveInProgress);
|
|
||||||
// console.log('newValue: '+newValue);
|
|
||||||
// console.log('oldValue: '+oldValue);
|
|
||||||
// console.log(oldValue.form_fields);
|
|
||||||
// console.log(newValue.form_fields);
|
|
||||||
if(oldValue.form_fields.length === 0) $rootScope.finishedRender = true
|
|
||||||
|
|
||||||
//Save form ONLY IF rendering is finished, form_fields have been changed AND currently not save in progress
|
var changedFieldMap = !!oldValue.plugins.oscarhost.settings.fieldMap && !_.isEqual(oldValue.plugins.oscarhost.settings.fieldMap,newValue.plugins.oscarhost.settings.fieldMap);
|
||||||
if( $rootScope.finishedRender && ((changedFields && !$formCtrl.$dirty) || changedFieldMap) && !$rootScope.saveInProgress) {
|
if( (!newValue && !oldValue) || !oldValue ){
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// console.log('Autosaving');
|
||||||
|
// console.log('\n\n----------');
|
||||||
|
// console.log('!$dirty: '+ !$formCtrl.$dirty );
|
||||||
|
// console.log('changedFields: '+changedFields);
|
||||||
|
// console.log('changedFieldMap: '+changedFieldMap);
|
||||||
|
// console.log('finishedRender: '+$rootScope.finishedRender);
|
||||||
|
// console.log('!saveInProgress: '+!$rootScope.saveInProgress);
|
||||||
|
// console.log('newValue: '+newValue);
|
||||||
|
// console.log('oldValue: '+oldValue);
|
||||||
|
// console.log(oldValue.form_fields);
|
||||||
|
// console.log(newValue.form_fields);
|
||||||
|
|
||||||
// console.log('saving form now');
|
if(oldValue.form_fields.length === 0) {
|
||||||
if(savePromise) {
|
$rootScope.finishedRender = true
|
||||||
$timeout.cancel(savePromise);
|
}
|
||||||
savePromise = null;
|
|
||||||
}
|
|
||||||
|
|
||||||
savePromise = $timeout(function() {
|
//Save form ONLY IF rendering is finished, form_fields have been changed AND currently not save in progress
|
||||||
// console.log('Saving Form');
|
if( $rootScope.finishedRender && ((changedFields && !$formCtrl.$dirty) || changedFieldMap) && !$rootScope.saveInProgress) {
|
||||||
debounceSave();
|
|
||||||
});
|
|
||||||
}
|
|
||||||
//If we are finished rendering then form saving should be finished
|
|
||||||
else if($rootScope.finishedRender && $rootScope.saveInProgress){
|
|
||||||
$rootScope.saveInProgress = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
}, true);
|
if(savePromise) {
|
||||||
|
$timeout.cancel(savePromise);
|
||||||
|
savePromise = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
savePromise = $timeout(function() {
|
||||||
|
debounceSave();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
//If we are finished rendering then form saving should be finished
|
||||||
|
else if($rootScope.finishedRender && $rootScope.saveInProgress){
|
||||||
|
$rootScope.saveInProgress = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
}, true);
|
||||||
});
|
});
|
||||||
|
}
|
||||||
}
|
};
|
||||||
};
|
|
||||||
|
|
||||||
}]);
|
}]);
|
||||||
|
|
||||||
|
@ -824,7 +837,7 @@ angular.module('forms').directive('configureFormDirective', ['$rootScope', '$htt
|
||||||
pdfFields:'@',
|
pdfFields:'@',
|
||||||
formFields:'@'
|
formFields:'@'
|
||||||
},
|
},
|
||||||
controller: function($scope){
|
controller: ["$scope", function($scope){
|
||||||
console.log($scope.myform);
|
console.log($scope.myform);
|
||||||
if( CurrentForm.getForm().plugins){
|
if( CurrentForm.getForm().plugins){
|
||||||
if(CurrentForm.getForm().plugins.oscarhost.baseUrl) $scope.oscarhostAPI = true;
|
if(CurrentForm.getForm().plugins.oscarhost.baseUrl) $scope.oscarhostAPI = true;
|
||||||
|
@ -902,7 +915,7 @@ angular.module('forms').directive('configureFormDirective', ['$rootScope', '$htt
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}]
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
]);
|
]);
|
||||||
|
@ -916,7 +929,7 @@ angular.module('forms').directive('editFormDirective', ['$rootScope', '$q', '$ht
|
||||||
scope: {
|
scope: {
|
||||||
myform:'=',
|
myform:'=',
|
||||||
},
|
},
|
||||||
controller: function($scope){
|
controller: ["$scope", function($scope){
|
||||||
var field_ids = _($scope.myform.form_fields).pluck('_id');
|
var field_ids = _($scope.myform.form_fields).pluck('_id');
|
||||||
for(var i=0; i<field_ids.length; i++){
|
for(var i=0; i<field_ids.length; i++){
|
||||||
$scope.myform.plugins.oscarhost.settings.fieldMap[field_ids[i]] = null;
|
$scope.myform.plugins.oscarhost.settings.fieldMap[field_ids[i]] = null;
|
||||||
|
@ -955,7 +968,6 @@ angular.module('forms').directive('editFormDirective', ['$rootScope', '$q', '$ht
|
||||||
currentFields = _(currentFields).difference($scope.myform.plugins.oscarhost.settings.fieldMap[field_id]);
|
currentFields = _(currentFields).difference($scope.myform.plugins.oscarhost.settings.fieldMap[field_id]);
|
||||||
}
|
}
|
||||||
|
|
||||||
// console.log($scope.myform.plugins.oscarhost.settings.fieldMap);
|
|
||||||
//Get all oscarhostFields that haven't been mapped to a formfield
|
//Get all oscarhostFields that haven't been mapped to a formfield
|
||||||
return _(oscarhostFields).difference(currentFields).value();
|
return _(oscarhostFields).difference(currentFields).value();
|
||||||
}
|
}
|
||||||
|
@ -966,54 +978,11 @@ angular.module('forms').directive('editFormDirective', ['$rootScope', '$q', '$ht
|
||||||
** FormFields (ui-sortable) drag-and-drop configuration
|
** FormFields (ui-sortable) drag-and-drop configuration
|
||||||
*/
|
*/
|
||||||
$scope.dropzone = {
|
$scope.dropzone = {
|
||||||
handle: ' .handle'
|
handle: ' .handle',
|
||||||
|
containment: '.dropzoneContainer',
|
||||||
|
cursor: 'grabbing',
|
||||||
};
|
};
|
||||||
|
|
||||||
// $scope.draggable = {
|
|
||||||
// connectWith: ".dropzone",
|
|
||||||
// start: function (e, ui) {
|
|
||||||
// // $scope.$apply(function() {
|
|
||||||
// // $scope.dragging = true
|
|
||||||
// // });
|
|
||||||
// $('.dropzone').sortable('refresh');
|
|
||||||
// },
|
|
||||||
// update: function (e, ui) {
|
|
||||||
// var isInDropzone = $(e.target).parentsUntil('.panel-group').hasClass('dropzone');
|
|
||||||
|
|
||||||
// console.log('isInDropzone: '+isInDropzone);
|
|
||||||
// //Disable drag and drop if we aren't in dropzone
|
|
||||||
// if(!isInDropzone){
|
|
||||||
// ui.item.sortable.cancel();
|
|
||||||
// }
|
|
||||||
// },
|
|
||||||
// stop: function (e, ui) {
|
|
||||||
// var isInDropzone = $(e.target).parentsUntil('.panel-group').hasClass('dropzone');
|
|
||||||
|
|
||||||
// //Disable drag and drop if we aren't in dropzone
|
|
||||||
// if(isInDropzone){
|
|
||||||
// console.log($(e.target));
|
|
||||||
// }
|
|
||||||
|
|
||||||
// // if (ui.item.sortable.droptarget === undefined) {
|
|
||||||
// // $scope.$apply($scope.dragging = false);
|
|
||||||
// // return;
|
|
||||||
// // }else if (ui.item.sortable.droptarget[0].classList[0] === "dropzone") {
|
|
||||||
// // // run code when item is dropped in the dropzone
|
|
||||||
// // $scope.$apply($scope.dragging = false);
|
|
||||||
// // }else{
|
|
||||||
// // // $scope.$apply($scope.dragging = false);
|
|
||||||
// // }
|
|
||||||
// // console.log('has class .dropzone :'+);
|
|
||||||
// // if ($(e.target).hasClass('dropzone') && ui.item.sortable.droptarget && e.target != ui.item.sortable.droptarget[0] ) {
|
|
||||||
// // // restore original types
|
|
||||||
// // $scope.addField.types = FormFields.types;
|
|
||||||
// // }
|
|
||||||
|
|
||||||
|
|
||||||
// }
|
|
||||||
// };
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
** Field CRUD Methods
|
** Field CRUD Methods
|
||||||
*/
|
*/
|
||||||
|
@ -1052,7 +1021,7 @@ angular.module('forms').directive('editFormDirective', ['$rootScope', '$q', '$ht
|
||||||
|
|
||||||
// Delete particular field on button click
|
// Delete particular field on button click
|
||||||
$scope.deleteField = function (field_index){
|
$scope.deleteField = function (field_index){
|
||||||
console.log(field_index);
|
|
||||||
//Delete field from field map
|
//Delete field from field map
|
||||||
var currFieldId = $scope.myform.form_fields[field_index]._id
|
var currFieldId = $scope.myform.form_fields[field_index]._id
|
||||||
if($scope.myform.plugins.oscarhost.baseUrl) delete $scope.myform.plugins.oscarhost.settings.fieldMap[currFieldId];
|
if($scope.myform.plugins.oscarhost.baseUrl) delete $scope.myform.plugins.oscarhost.settings.fieldMap[currFieldId];
|
||||||
|
@ -1061,7 +1030,8 @@ angular.module('forms').directive('editFormDirective', ['$rootScope', '$q', '$ht
|
||||||
$scope.myform.form_fields.splice(field_index, 1);
|
$scope.myform.form_fields.splice(field_index, 1);
|
||||||
};
|
};
|
||||||
$scope.duplicateField = function (field_index){
|
$scope.duplicateField = function (field_index){
|
||||||
var currField = $scope.myform.form_fields[field_index];
|
var currField = _.cloneDeep($scope.myform.form_fields[field_index]);
|
||||||
|
currField._id = '';
|
||||||
|
|
||||||
//Insert field at selected index
|
//Insert field at selected index
|
||||||
$scope.myform.form_fields.splice(field_index+1, 0, currField);
|
$scope.myform.form_fields.splice(field_index+1, 0, currField);
|
||||||
|
@ -1146,7 +1116,7 @@ angular.module('forms').directive('editFormDirective', ['$rootScope', '$q', '$ht
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
},
|
}],
|
||||||
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -1162,7 +1132,7 @@ angular.module('forms').directive('editSubmissionsFormDirective', ['$rootScope',
|
||||||
myform:'=',
|
myform:'=',
|
||||||
user:'='
|
user:'='
|
||||||
},
|
},
|
||||||
controller: function($scope){
|
controller: ["$scope", function($scope){
|
||||||
$scope.table = {
|
$scope.table = {
|
||||||
masterChecker: false,
|
masterChecker: false,
|
||||||
rows: []
|
rows: []
|
||||||
|
@ -1201,7 +1171,6 @@ angular.module('forms').directive('editSubmissionsFormDirective', ['$rootScope',
|
||||||
var _tmpSubFormFields,
|
var _tmpSubFormFields,
|
||||||
defaultFormFields = _.cloneDeep($scope.myform.form_fields);
|
defaultFormFields = _.cloneDeep($scope.myform.form_fields);
|
||||||
|
|
||||||
|
|
||||||
//Iterate through form's submissions
|
//Iterate through form's submissions
|
||||||
for(var i=0; i<data.length; i++){
|
for(var i=0; i<data.length; i++){
|
||||||
_tmpSubFormFields = _.merge(defaultFormFields, data[i].form_fields);
|
_tmpSubFormFields = _.merge(defaultFormFields, data[i].form_fields);
|
||||||
|
@ -1263,13 +1232,13 @@ angular.module('forms').directive('editSubmissionsFormDirective', ['$rootScope',
|
||||||
saveAs(blob, $scope.myform.title+'_sumbissions_export_'+Date.now()+'.'+type);
|
saveAs(blob, $scope.myform.title+'_sumbissions_export_'+Date.now()+'.'+type);
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}]
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
]);
|
]);
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
angular.module('forms').directive('fieldIconDirective', function($http, $compile) {
|
angular.module('forms').directive('fieldIconDirective', ["$http", "$compile", function($http, $compile) {
|
||||||
|
|
||||||
return {
|
return {
|
||||||
template: '<i class="{{typeIcon}}"></i>',
|
template: '<i class="{{typeIcon}}"></i>',
|
||||||
|
@ -1277,7 +1246,7 @@ angular.module('forms').directive('fieldIconDirective', function($http, $compile
|
||||||
scope: {
|
scope: {
|
||||||
typeName: '@'
|
typeName: '@'
|
||||||
},
|
},
|
||||||
controller: function($scope){
|
controller: ["$scope", function($scope){
|
||||||
var iconTypeMap = {
|
var iconTypeMap = {
|
||||||
'textfield': 'fa fa-pencil-square-o',
|
'textfield': 'fa fa-pencil-square-o',
|
||||||
'dropdown': 'fa fa-th-list',
|
'dropdown': 'fa fa-th-list',
|
||||||
|
@ -1297,10 +1266,10 @@ angular.module('forms').directive('fieldIconDirective', function($http, $compile
|
||||||
'number': 'fa fa-slack'
|
'number': 'fa fa-slack'
|
||||||
};
|
};
|
||||||
$scope.typeIcon = iconTypeMap[$scope.typeName];
|
$scope.typeIcon = iconTypeMap[$scope.typeName];
|
||||||
},
|
}],
|
||||||
|
|
||||||
};
|
};
|
||||||
});
|
}]);
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
// coffeescript's for in loop
|
// coffeescript's for in loop
|
||||||
|
@ -1316,7 +1285,6 @@ angular.module('forms').directive('fieldDirective', ['$templateCache', '$http',
|
||||||
|
|
||||||
|
|
||||||
var getTemplateUrl = function(field) {
|
var getTemplateUrl = function(field) {
|
||||||
console.log(field.validFieldTypes);
|
|
||||||
var type = field.fieldType;
|
var type = field.fieldType;
|
||||||
var templateUrl = 'modules/forms/views/directiveViews/field/';
|
var templateUrl = 'modules/forms/views/directiveViews/field/';
|
||||||
var supported_fields = [
|
var supported_fields = [
|
||||||
|
@ -1343,50 +1311,76 @@ angular.module('forms').directive('fieldDirective', ['$templateCache', '$http',
|
||||||
return templateUrl;
|
return templateUrl;
|
||||||
};
|
};
|
||||||
|
|
||||||
var linker = function(scope, element) {
|
|
||||||
|
|
||||||
scope.setActiveField = $rootScope.setActiveField;
|
|
||||||
//Set format only if field is a date
|
|
||||||
if(scope.field.fieldType === 'date'){
|
|
||||||
scope.dateOptions = {
|
|
||||||
changeYear: true,
|
|
||||||
changeMonth: true,
|
|
||||||
altFormat: 'mm/dd/yyyy',
|
|
||||||
yearRange: '1900:-0',
|
|
||||||
defaultDate: 0,
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
// GET template content from path
|
|
||||||
var templateUrl = getTemplateUrl(scope.field);
|
|
||||||
$http.get(templateUrl).success(function(data) {
|
|
||||||
element.html(data).show();
|
|
||||||
$compile(element.contents())(scope);
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
return {
|
return {
|
||||||
template: '<div>{{field.title}}</div>',
|
template: '<div>{{field.title}}</div>',
|
||||||
restrict: 'E',
|
restrict: 'E',
|
||||||
scope: {
|
scope: {
|
||||||
field: '=',
|
field: '=',
|
||||||
required: '&',
|
required: '&',
|
||||||
design: '='
|
design: '=',
|
||||||
|
index: '=',
|
||||||
|
},
|
||||||
|
link: function(scope, element) {
|
||||||
|
scope.setActiveField = $rootScope.setActiveField;
|
||||||
|
|
||||||
|
//Set format only if field is a date
|
||||||
|
if(scope.field.fieldType === 'date'){
|
||||||
|
scope.dateOptions = {
|
||||||
|
changeYear: true,
|
||||||
|
changeMonth: true,
|
||||||
|
altFormat: 'mm/dd/yyyy',
|
||||||
|
yearRange: '1900:-0',
|
||||||
|
defaultDate: 0,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
// GET template content from path
|
||||||
|
var templateUrl = getTemplateUrl(scope.field);
|
||||||
|
$http.get(templateUrl).success(function(data) {
|
||||||
|
element.html(data).show();
|
||||||
|
$compile(element.contents())(scope);
|
||||||
|
});
|
||||||
},
|
},
|
||||||
link: linker
|
|
||||||
};
|
};
|
||||||
}]);
|
}]);
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
angular.module('forms').directive('onFinishRender', function ($rootScope, $timeout) {
|
angular.module('forms').directive('focusOn',function() {
|
||||||
|
return {
|
||||||
|
restrict : 'A',
|
||||||
|
link : function($scope, $element, $attr) {
|
||||||
|
$scope.$watch($attr.focusOn,function(focusVal) {
|
||||||
|
if(focusVal === true) {
|
||||||
|
setTimeout(function() {
|
||||||
|
var $input_element;
|
||||||
|
|
||||||
|
if($element[0].querySelector('input')){
|
||||||
|
$input_element = $element[0].querySelector('input');
|
||||||
|
}else if($element[0].querySelector('select')){
|
||||||
|
$input_element = $element[0].querySelector('select');
|
||||||
|
}else if($element[0].querySelector('textarea')){
|
||||||
|
$input_element = $element[0].querySelector('textarea');
|
||||||
|
}else if($element[0].querySelector('.angular-input-stars')){
|
||||||
|
$input_element = $element[0].querySelector('.angular-input-stars');
|
||||||
|
}else{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
$input_element.focus();
|
||||||
|
},50);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
'use strict';
|
||||||
|
|
||||||
|
angular.module('forms').directive('onFinishRender', ["$rootScope", "$timeout", function ($rootScope, $timeout) {
|
||||||
return {
|
return {
|
||||||
restrict: 'A',
|
restrict: 'A',
|
||||||
link: function (scope, element, attrs) {
|
link: function (scope, element, attrs) {
|
||||||
|
|
||||||
// $rootScope.$broadcast(' Started');
|
|
||||||
|
|
||||||
//Don't do anything if we don't have a ng-repeat on the current element
|
//Don't do anything if we don't have a ng-repeat on the current element
|
||||||
if(!element.attr('ng-repeat')){
|
if(!element.attr('ng-repeat') && !element.attr('data-ng-repeat')){
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1408,7 +1402,7 @@ angular.module('forms').directive('onFinishRender', function ($rootScope, $timeo
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
});
|
}]);
|
||||||
|
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
|
@ -1420,25 +1414,53 @@ angular.module('forms').directive('submitFormDirective', ['$http', '$timeout', '
|
||||||
scope: {
|
scope: {
|
||||||
myform:'='
|
myform:'='
|
||||||
},
|
},
|
||||||
controller: function($scope){
|
controller: ["$scope", function($scope){
|
||||||
angular.element(document).ready(function() {
|
// angular.element(document).ready(function() {
|
||||||
$scope.error = '';
|
$scope.error = '';
|
||||||
$scope.selected = null;
|
$scope.selected = {
|
||||||
|
_id: $scope.myform.form_fields[0]._id,
|
||||||
|
index: 0,
|
||||||
|
};
|
||||||
|
|
||||||
$scope.submitted = false;
|
$scope.submitted = false;
|
||||||
|
|
||||||
TimeCounter.startClock()
|
TimeCounter.startClock()
|
||||||
|
|
||||||
$scope.exitStartPage = function(){
|
$scope.exitStartPage = function(){
|
||||||
$scope.myform.startPage.showStart = false;
|
$scope.myform.startPage.showStart = false;
|
||||||
}
|
|
||||||
$rootScope.setActiveField = function (field_id) {
|
|
||||||
$scope.selected = field_id;
|
|
||||||
};
|
};
|
||||||
$scope.hideOverlay = function (){
|
|
||||||
|
$scope.nextField = function(){
|
||||||
|
if($scope.selected.index < $scope.myform.form_fields.length){
|
||||||
|
$scope.selected.index++;
|
||||||
|
$scope.selected._id = $scope.myform.form_fields[$scope.selected.index]._id;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
$scope.prevField = function(){
|
||||||
|
if($scope.selected.index > 0){
|
||||||
|
$scope.selected.index = $scope.selected.index - 1;
|
||||||
|
$scope.selected._id = $scope.myform.form_fields[$scope.selected.index]._id;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
$rootScope.setActiveField = function(field_id, field_index) {
|
||||||
|
if($scope.selected === null){
|
||||||
|
$scope.selected = {
|
||||||
|
_id: '',
|
||||||
|
index: 0,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
console.log('field_id: '+field_id);
|
||||||
|
console.log('field_index: '+field_index);
|
||||||
|
console.log($scope.selected);
|
||||||
|
$scope.selected._id = field_id;
|
||||||
|
$scope.selected.index = field_index;
|
||||||
|
};
|
||||||
|
$scope.hideOverlay = function(){
|
||||||
$scope.selected = null;
|
$scope.selected = null;
|
||||||
};
|
};
|
||||||
|
|
||||||
$scope.submit = function(){
|
$scope.submitForm = function(){
|
||||||
var _timeElapsed = TimeCounter.stopClock();
|
var _timeElapsed = TimeCounter.stopClock();
|
||||||
|
|
||||||
var form = _.cloneDeep($scope.myform);
|
var form = _.cloneDeep($scope.myform);
|
||||||
|
@ -1446,7 +1468,6 @@ angular.module('forms').directive('submitFormDirective', ['$http', '$timeout', '
|
||||||
|
|
||||||
// console.log('percentageComplete: '+$filter('formValidity')($scope.myform)/$scope.myform.visible_form_fields.length*100+'%');
|
// console.log('percentageComplete: '+$filter('formValidity')($scope.myform)/$scope.myform.visible_form_fields.length*100+'%');
|
||||||
form.percentageComplete = $filter('formValidity')($scope.myform)/$scope.myform.visible_form_fields.length*100;
|
form.percentageComplete = $filter('formValidity')($scope.myform)/$scope.myform.visible_form_fields.length*100;
|
||||||
console.log(form.percentageComplete)
|
|
||||||
delete form.visible_form_fields;
|
delete form.visible_form_fields;
|
||||||
|
|
||||||
$scope.authentication = Auth;
|
$scope.authentication = Auth;
|
||||||
|
@ -1474,9 +1495,9 @@ angular.module('forms').directive('submitFormDirective', ['$http', '$timeout', '
|
||||||
return field;
|
return field;
|
||||||
}).value();
|
}).value();
|
||||||
};
|
};
|
||||||
});
|
// });
|
||||||
|
|
||||||
}
|
}]
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
]);
|
]);
|
||||||
|
@ -1672,10 +1693,9 @@ angular.module('forms').service('TimeCounter', [
|
||||||
// Config HTTP Error Handling
|
// Config HTTP Error Handling
|
||||||
angular.module('users').config(['$httpProvider',
|
angular.module('users').config(['$httpProvider',
|
||||||
function($httpProvider) {
|
function($httpProvider) {
|
||||||
$httpProvider.interceptors.push(function($q, $location) {
|
$httpProvider.interceptors.push(["$q", "$location", function($q, $location) {
|
||||||
return {
|
return {
|
||||||
responseError: function(response) {
|
responseError: function(response) {
|
||||||
// console.log($location.path());
|
|
||||||
if( $location.path() !== '/users/me' && response.config){
|
if( $location.path() !== '/users/me' && response.config){
|
||||||
if(response.config.url !== '/users/me'){
|
if(response.config.url !== '/users/me'){
|
||||||
console.log('intercepted rejection of ', response.config.url, response.status);
|
console.log('intercepted rejection of ', response.config.url, response.status);
|
||||||
|
@ -1692,7 +1712,7 @@ angular.module('users').config(['$httpProvider',
|
||||||
return $q.reject(response);
|
return $q.reject(response);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
});
|
}]);
|
||||||
}]);
|
}]);
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
|
@ -1722,6 +1742,7 @@ angular.module('users').config(['$stateProvider',
|
||||||
|
|
||||||
return deferred.promise;
|
return deferred.promise;
|
||||||
};
|
};
|
||||||
|
checkLoggedin.$inject = ["$q", "$timeout", "$state", "User", "Auth"];
|
||||||
|
|
||||||
// Users state routing
|
// Users state routing
|
||||||
$stateProvider.
|
$stateProvider.
|
||||||
|
@ -1847,6 +1868,7 @@ angular.module('users').controller('AuthenticationController', ['$scope', '$loca
|
||||||
|
|
||||||
angular.module('users').controller('PasswordController', ['$scope', '$stateParams', '$state', 'User',
|
angular.module('users').controller('PasswordController', ['$scope', '$stateParams', '$state', 'User',
|
||||||
function($scope, $stateParams, $state, User) {
|
function($scope, $stateParams, $state, User) {
|
||||||
|
$scope.error = '';
|
||||||
|
|
||||||
// Submit forgotten password account id
|
// Submit forgotten password account id
|
||||||
$scope.askForPasswordReset = function() {
|
$scope.askForPasswordReset = function() {
|
||||||
|
@ -1955,23 +1977,25 @@ angular.module('users').controller('SettingsController', ['$scope', '$rootScope'
|
||||||
angular.module('users').controller('VerifyController', ['$scope', '$state', '$rootScope', 'User', 'Auth', '$stateParams',
|
angular.module('users').controller('VerifyController', ['$scope', '$state', '$rootScope', 'User', 'Auth', '$stateParams',
|
||||||
function($scope, $state, $rootScope, User, Auth, $stateParams) {
|
function($scope, $state, $rootScope, User, Auth, $stateParams) {
|
||||||
|
|
||||||
$scope.isReset = false;
|
$scope.isResetSent = false;
|
||||||
$scope.credentials = {};
|
$scope.credentials = {};
|
||||||
|
$scope.error = '';
|
||||||
|
|
||||||
// Submit forgotten password account id
|
// Submit forgotten password account id
|
||||||
$scope.resendVerifyEmail = function() {
|
$scope.resendVerifyEmail = function() {
|
||||||
console.log($scope.credentials.email);
|
// console.log($scope.credentials);
|
||||||
|
// console.log($scope.credentials.email);
|
||||||
User.resendVerifyEmail($scope.credentials.email).then(
|
User.resendVerifyEmail($scope.credentials.email).then(
|
||||||
function(response){
|
function(response){
|
||||||
|
console.log(response);
|
||||||
$scope.success = response.message;
|
$scope.success = response.message;
|
||||||
$scope.credentials = null;
|
$scope.credentials = null;
|
||||||
$scope.isResetSent = true;
|
$scope.isResetSent = true;
|
||||||
},
|
},
|
||||||
function(error){
|
function(error){
|
||||||
$scope.error = error;
|
$scope.error = error;
|
||||||
$scope.credentials = null;
|
$scope.credentials.email = null;
|
||||||
$scope.isReset = false;
|
$scope.isResetSent = false;
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
@ -1984,14 +2008,14 @@ angular.module('users').controller('VerifyController', ['$scope', '$state', '$ro
|
||||||
function(response){
|
function(response){
|
||||||
console.log('Success: '+response.message);
|
console.log('Success: '+response.message);
|
||||||
$scope.success = response.message;
|
$scope.success = response.message;
|
||||||
$scope.isReset = true;
|
$scope.isResetSent = true;
|
||||||
$scope.credentials = null;
|
$scope.credentials.email = null;
|
||||||
},
|
},
|
||||||
function(error){
|
function(error){
|
||||||
console.log('Error: '+error.message);
|
console.log('Error: '+error.message);
|
||||||
$scope.isReset = false;
|
$scope.isResetSent = false;
|
||||||
$scope.error = error;
|
$scope.error = error;
|
||||||
$scope.credentials = null;
|
$scope.credentials.email = null;
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -2073,7 +2097,7 @@ angular.module('users').factory('Auth', ['$window',
|
||||||
|
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
angular.module('users').service('Authorizer', function(APP_PERMISSIONS, USER_ROLES) {
|
angular.module('users').service('Authorizer', ["APP_PERMISSIONS", "USER_ROLES", function(APP_PERMISSIONS, USER_ROLES) {
|
||||||
return function(user) {
|
return function(user) {
|
||||||
return {
|
return {
|
||||||
canAccess: function(permissions) {
|
canAccess: function(permissions) {
|
||||||
|
@ -2104,7 +2128,7 @@ angular.module('users').service('Authorizer', function(APP_PERMISSIONS, USER_ROL
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
});
|
}]);
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
angular.module('users').factory('User', ['$window', '$q', '$timeout', '$http', '$state',
|
angular.module('users').factory('User', ['$window', '$q', '$timeout', '$http', '$state',
|
||||||
|
|
2
public/dist/application.min.css
vendored
2
public/dist/application.min.css
vendored
File diff suppressed because one or more lines are too long
4
public/dist/application.min.js
vendored
4
public/dist/application.min.js
vendored
File diff suppressed because one or more lines are too long
133
public/modules/core/css/github-fork-ribbon.css
Normal file
133
public/modules/core/css/github-fork-ribbon.css
Normal file
|
@ -0,0 +1,133 @@
|
||||||
|
/*!
|
||||||
|
* "Fork me on GitHub" CSS ribbon v0.1.1 | MIT License
|
||||||
|
* https://github.com/simonwhitaker/github-fork-ribbon-css
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* Left will inherit from right (so we don't need to duplicate code) */
|
||||||
|
.github-fork-ribbon {
|
||||||
|
/* The right and left classes determine the side we attach our banner to */
|
||||||
|
position: absolute;
|
||||||
|
|
||||||
|
/* Add a bit of padding to give some substance outside the "stitching" */
|
||||||
|
padding: 2px 0;
|
||||||
|
|
||||||
|
/* Set the base colour */
|
||||||
|
background-color: #a00;
|
||||||
|
|
||||||
|
/* Set a gradient: transparent black at the top to almost-transparent black at the bottom */
|
||||||
|
background-image: -webkit-gradient(linear, left top, left bottom, from(rgba(0, 0, 0, 0)), to(rgba(0, 0, 0, 0.15)));
|
||||||
|
background-image: -webkit-linear-gradient(top, rgba(0, 0, 0, 0), rgba(0, 0, 0, 0.15));
|
||||||
|
background-image: -moz-linear-gradient(top, rgba(0, 0, 0, 0), rgba(0, 0, 0, 0.15));
|
||||||
|
background-image: -ms-linear-gradient(top, rgba(0, 0, 0, 0), rgba(0, 0, 0, 0.15));
|
||||||
|
background-image: -o-linear-gradient(top, rgba(0, 0, 0, 0), rgba(0, 0, 0, 0.15));
|
||||||
|
background-image: linear-gradient(to bottom, rgba(0, 0, 0, 0), rgba(0, 0, 0, 0.15));
|
||||||
|
|
||||||
|
/* Add a drop shadow */
|
||||||
|
-webkit-box-shadow: 0 2px 3px 0 rgba(0, 0, 0, 0.5);
|
||||||
|
-moz-box-shadow: 0 2px 3px 0 rgba(0, 0, 0, 0.5);
|
||||||
|
box-shadow: 0 2px 3px 0 rgba(0, 0, 0, 0.5);
|
||||||
|
|
||||||
|
/* Set the font */
|
||||||
|
font: 700 13px "Helvetica Neue", Helvetica, Arial, sans-serif;
|
||||||
|
|
||||||
|
z-index: 9999;
|
||||||
|
pointer-events: auto;
|
||||||
|
}
|
||||||
|
|
||||||
|
.github-fork-ribbon a,
|
||||||
|
.github-fork-ribbon a:hover {/* Set the text properties */
|
||||||
|
color: #fff;
|
||||||
|
text-decoration: none;
|
||||||
|
text-shadow: 0 -1px rgba(0, 0, 0, 0.5);
|
||||||
|
text-align: center;/* Set the geometry. If you fiddle with these you'll also need
|
||||||
|
to tweak the top and right values in .github-fork-ribbon. */
|
||||||
|
width: 200px;
|
||||||
|
line-height: 20px;/* Set the layout properties */
|
||||||
|
display: inline-block;
|
||||||
|
padding: 2px 0;/* Add "stitching" effect */
|
||||||
|
border-width: 1px 0;
|
||||||
|
border-style: dotted;
|
||||||
|
border-color: #fff;
|
||||||
|
border-color: rgba(255, 255, 255, 0.7);
|
||||||
|
}
|
||||||
|
|
||||||
|
.github-fork-ribbon-wrapper {
|
||||||
|
width: 150px;
|
||||||
|
height: 150px;
|
||||||
|
position: absolute;
|
||||||
|
overflow: hidden;
|
||||||
|
top: 0;
|
||||||
|
z-index: 9999;
|
||||||
|
pointer-events: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.github-fork-ribbon-wrapper.fixed {
|
||||||
|
position: fixed;
|
||||||
|
}
|
||||||
|
|
||||||
|
.github-fork-ribbon-wrapper.left {
|
||||||
|
left: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.github-fork-ribbon-wrapper.right {
|
||||||
|
right: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.github-fork-ribbon-wrapper.left-bottom {
|
||||||
|
position: fixed;
|
||||||
|
top: inherit;
|
||||||
|
bottom: 0;
|
||||||
|
left: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.github-fork-ribbon-wrapper.right-bottom {
|
||||||
|
position: fixed;
|
||||||
|
top: inherit;
|
||||||
|
bottom: 0;
|
||||||
|
right: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.github-fork-ribbon-wrapper.right .github-fork-ribbon {
|
||||||
|
top: 42px;
|
||||||
|
right: -43px;
|
||||||
|
|
||||||
|
-webkit-transform: rotate(45deg);
|
||||||
|
-moz-transform: rotate(45deg);
|
||||||
|
-ms-transform: rotate(45deg);
|
||||||
|
-o-transform: rotate(45deg);
|
||||||
|
transform: rotate(45deg);
|
||||||
|
}
|
||||||
|
|
||||||
|
.github-fork-ribbon-wrapper.left .github-fork-ribbon {
|
||||||
|
top: 42px;
|
||||||
|
left: -43px;
|
||||||
|
|
||||||
|
-webkit-transform: rotate(-45deg);
|
||||||
|
-moz-transform: rotate(-45deg);
|
||||||
|
-ms-transform: rotate(-45deg);
|
||||||
|
-o-transform: rotate(-45deg);
|
||||||
|
transform: rotate(-45deg);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
.github-fork-ribbon-wrapper.left-bottom .github-fork-ribbon {
|
||||||
|
top: 80px;
|
||||||
|
left: -43px;
|
||||||
|
|
||||||
|
-webkit-transform: rotate(45deg);
|
||||||
|
-moz-transform: rotate(45deg);
|
||||||
|
-ms-transform: rotate(45deg);
|
||||||
|
-o-transform: rotate(45deg);
|
||||||
|
transform: rotate(45deg);
|
||||||
|
}
|
||||||
|
|
||||||
|
.github-fork-ribbon-wrapper.right-bottom .github-fork-ribbon {
|
||||||
|
top: 80px;
|
||||||
|
right: -43px;
|
||||||
|
|
||||||
|
-webkit-transform: rotate(-45deg);
|
||||||
|
-moz-transform: rotate(-45deg);
|
||||||
|
-ms-transform: rotate(-45deg);
|
||||||
|
-o-transform: rotate(-45deg);
|
||||||
|
transform: rotate(-45deg);
|
||||||
|
}
|
|
@ -35,6 +35,7 @@ angular.module('forms').config(['$stateProvider',
|
||||||
resolve: {
|
resolve: {
|
||||||
Forms: 'Forms',
|
Forms: 'Forms',
|
||||||
myForm: function (Forms, $stateParams) {
|
myForm: function (Forms, $stateParams) {
|
||||||
|
console.log('getting form');
|
||||||
return Forms.get({formId: $stateParams.formId}).$promise;
|
return Forms.get({formId: $stateParams.formId}).$promise;
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
|
@ -56,10 +56,10 @@ angular.module('forms').controller('AdminFormController', ['$rootScope', '$scope
|
||||||
** DeleteModal Functions
|
** DeleteModal Functions
|
||||||
*/
|
*/
|
||||||
$scope.openDeleteModal = function(){
|
$scope.openDeleteModal = function(){
|
||||||
|
console.log('hello');
|
||||||
$scope.deleteModal = $modal.open({
|
$scope.deleteModal = $modal.open({
|
||||||
animation: $scope.animationsEnabled,
|
animation: $scope.animationsEnabled,
|
||||||
templateUrl: 'myModalContent.html',
|
templateUrl: 'myModalContent.html',
|
||||||
controller: 'AdminFormController',
|
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
$scope.cancelDeleteModal = function(){
|
$scope.cancelDeleteModal = function(){
|
||||||
|
|
|
@ -9,11 +9,12 @@ angular.module('forms').directive('submitFormDirective', ['$http', '$timeout', '
|
||||||
myform:'='
|
myform:'='
|
||||||
},
|
},
|
||||||
controller: function($scope){
|
controller: function($scope){
|
||||||
// angular.element(document).ready(function() {
|
angular.element(document).ready(function() {
|
||||||
|
|
||||||
$scope.error = '';
|
$scope.error = '';
|
||||||
$scope.selected = {
|
$scope.selected = {
|
||||||
_id: $scope.myform.form_fields[0]._id,
|
_id: '',
|
||||||
index: 0,
|
index: null,
|
||||||
};
|
};
|
||||||
|
|
||||||
$scope.submitted = false;
|
$scope.submitted = false;
|
||||||
|
@ -22,6 +23,9 @@ angular.module('forms').directive('submitFormDirective', ['$http', '$timeout', '
|
||||||
|
|
||||||
$scope.exitStartPage = function(){
|
$scope.exitStartPage = function(){
|
||||||
$scope.myform.startPage.showStart = false;
|
$scope.myform.startPage.showStart = false;
|
||||||
|
if($scope.myform.form_fields.length > 0){
|
||||||
|
$scope.selected._id = $scope.myform.form_fields[0]._id;
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
$scope.nextField = function(){
|
$scope.nextField = function(){
|
||||||
|
@ -51,7 +55,10 @@ angular.module('forms').directive('submitFormDirective', ['$http', '$timeout', '
|
||||||
$scope.selected.index = field_index;
|
$scope.selected.index = field_index;
|
||||||
};
|
};
|
||||||
$scope.hideOverlay = function(){
|
$scope.hideOverlay = function(){
|
||||||
$scope.selected = null;
|
$scope.selected = {
|
||||||
|
_id: '',
|
||||||
|
index: null,
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
$scope.submitForm = function(){
|
$scope.submitForm = function(){
|
||||||
|
@ -89,7 +96,7 @@ angular.module('forms').directive('submitFormDirective', ['$http', '$timeout', '
|
||||||
return field;
|
return field;
|
||||||
}).value();
|
}).value();
|
||||||
};
|
};
|
||||||
// });
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
<div cg-busy="{promise:submitPromise,message:'Submitting form...',backdrop:true}"></div>
|
<div cg-busy="{promise:submitPromise,message:'Submitting form...',backdrop:true}"></div>
|
||||||
|
|
||||||
<section class="overlay submitform" ng-if="selected" ng-click="hideOverlay()"></section>
|
<section class="overlay submitform" ng-if="selected.index" ng-click="hideOverlay()"></section>
|
||||||
|
|
||||||
<div ng-show="!myform.submitted && myform.startPage.showStart" class="form-submitted">
|
<div ng-show="!myform.submitted && myform.startPage.showStart" class="form-submitted">
|
||||||
<div class="field row text-center">
|
<div class="field row text-center">
|
||||||
|
@ -21,11 +21,11 @@
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
<div class="row form-actions">
|
<div class="row form-actions">
|
||||||
<p class="col-xs-3 col-xs-offset-3 text-center">
|
<!-- <p class="col-sm-2 col-sm-offset-5"> -->
|
||||||
<button class="btn btn-info" type="button">
|
<button class="btn btn-info col-sm-4 col-sm-offset-4" type="button">
|
||||||
<a ng-click="exitStartPage()" style="color:white; font-size: 1.6em; text-decoration: none;">Continue to Form</a>
|
<a ng-click="exitStartPage()" style="color:white; font-size: 1.6em; text-decoration: none;">Continue to Form</a>
|
||||||
</button>
|
</button>
|
||||||
</p>
|
<!-- </p> -->
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
@ -64,7 +64,7 @@
|
||||||
<a href="/#!/forms" class="btn btn-default">Create a NodeForm</a>
|
<a href="/#!/forms" class="btn btn-default">Create a NodeForm</a>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-md-4 col-md-offset-2" ng-if="authentication.isAuthenticated()" class="hidden-sm hidden-xs">
|
<div class="col-md-4 col-md-offset-2" ng-if="authentication.isAuthenticated()" class="hidden-sm hidden-xs">
|
||||||
<a href="/#!/forms/{{myform._id}}/admin" class="btn btn-default">Edit this NodeForm</a>
|
<a href="/#!/forms/{{myform._id}}/admin/create" class="btn btn-default">Edit this NodeForm</a>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-md-1 col-md-offset-2" style="padding-left:5px" class="hidden-sm hidden-xs">
|
<div class="col-md-1 col-md-offset-2" style="padding-left:5px" class="hidden-sm hidden-xs">
|
||||||
<div class="btn btn-info" id="focusDownButton" ng-click="nextField()">\/</div>
|
<div class="btn btn-info" id="focusDownButton" ng-click="nextField()">\/</div>
|
||||||
|
|
Loading…
Reference in a new issue