updated eslint
This commit is contained in:
parent
ed9eb42468
commit
3afc770153
|
@ -33,9 +33,9 @@ exports.uploadPDF = function(req, res, next) {
|
||||||
|
|
||||||
|
|
||||||
if (req.file.size === 0) {
|
if (req.file.size === 0) {
|
||||||
next(new Error('File uploaded is EMPTY'));
|
return next(new Error('File uploaded is EMPTY'));
|
||||||
}else if(req.file.size > 100000000){
|
}else if(req.file.size > 100000000){
|
||||||
next(new Error('File uploaded exceeds MAX SIZE of 100MB'));
|
return next(new Error('File uploaded exceeds MAX SIZE of 100MB'));
|
||||||
}else {
|
}else {
|
||||||
fs.exists(_path, function(exists) {
|
fs.exists(_path, function(exists) {
|
||||||
|
|
||||||
|
@ -52,14 +52,14 @@ exports.uploadPDF = function(req, res, next) {
|
||||||
|
|
||||||
if (stat && !stat.isDirectory()) {
|
if (stat && !stat.isDirectory()) {
|
||||||
console.log('Directory cannot be created');
|
console.log('Directory cannot be created');
|
||||||
next(new Error('Directory cannot be created because an inode of a different type exists at "' + newDestination + '"'));
|
return next(new Error('Directory cannot be created because an inode of a different type exists at "' + newDestination + '"'));
|
||||||
}
|
}
|
||||||
|
|
||||||
console.log(path.join(newDestination, pdfFile.filename));
|
console.log(path.join(newDestination, pdfFile.filename));
|
||||||
|
|
||||||
fs.move(pdfFile.path, path.join(newDestination, pdfFile.filename), function (err) {
|
fs.move(pdfFile.path, path.join(newDestination, pdfFile.filename), function (err) {
|
||||||
if (err) {
|
if (err) {
|
||||||
next(new Error(err.message));
|
return next(new Error(err.message));
|
||||||
}
|
}
|
||||||
pdfFile.path = path.join(newDestination, pdfFile.filename);
|
pdfFile.path = path.join(newDestination, pdfFile.filename);
|
||||||
console.log(pdfFile.filename + ' uploaded to ' + pdfFile.path);
|
console.log(pdfFile.filename + ' uploaded to ' + pdfFile.path);
|
||||||
|
@ -67,12 +67,12 @@ exports.uploadPDF = function(req, res, next) {
|
||||||
});
|
});
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
next(new Error('Did NOT get your file!'));
|
return next(new Error('Did NOT get your file!'));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}else {
|
}else {
|
||||||
next(new Error('Uploaded files were NOT detected'));
|
return next(new Error('Uploaded files were NOT detected'));
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -303,7 +303,7 @@ exports.formByID = function(req, res, next, id) {
|
||||||
else {
|
else {
|
||||||
Form.findById(id).populate('admin').exec(function(err, form) {
|
Form.findById(id).populate('admin').exec(function(err, form) {
|
||||||
if (err) {
|
if (err) {
|
||||||
return next(err);
|
return return next(err);
|
||||||
} else if (form === undefined || form === null) {
|
} else if (form === undefined || form === null) {
|
||||||
res.status(400).send({
|
res.status(400).send({
|
||||||
message: 'Form not found'
|
message: 'Form not found'
|
||||||
|
@ -316,7 +316,7 @@ exports.formByID = function(req, res, next, id) {
|
||||||
form.provider = undefined;
|
form.provider = undefined;
|
||||||
|
|
||||||
req.form = form;
|
req.form = form;
|
||||||
next();
|
return next();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -332,5 +332,5 @@ exports.hasAuthorization = function(req, res, next) {
|
||||||
message: 'User '+req.user.username+' is not authorized to edit Form: '+form.title
|
message: 'User '+req.user.username+' is not authorized to edit Form: '+form.title
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
next();
|
return next();
|
||||||
};
|
};
|
||||||
|
|
|
@ -241,31 +241,31 @@ function getDeletedIndexes(needle, haystack){
|
||||||
FormSchema.pre('save', function (next) {
|
FormSchema.pre('save', function (next) {
|
||||||
var that = this;
|
var that = this;
|
||||||
|
|
||||||
async.series([function(cb) {
|
async.series([function(return cb) {
|
||||||
that.constructor
|
that.constructor
|
||||||
.findOne({_id: that._id}).exec(function (err, original) {
|
.findOne({_id: that._id}).exec(function (err, original) {
|
||||||
if (err) {
|
if (err) {
|
||||||
console.log(err);
|
console.log(err);
|
||||||
cb(err);
|
return cb(err);
|
||||||
} else {
|
} else {
|
||||||
_original = original;
|
_original = original;
|
||||||
//console.log('_original');
|
//console.log('_original');
|
||||||
//console.log(_original);
|
//console.log(_original);
|
||||||
cb(null);
|
return cb(null);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}, function(cb) {
|
}, function(return cb) {
|
||||||
//DAVID: TODO: Make this so we don't have to update the validFields property ever save
|
//DAVID: TODO: Make this so we don't have to update the validFields property ever save
|
||||||
if (that.plugins.oscarhost.hasOwnProperty('baseUrl')) {
|
if (that.plugins.oscarhost.hasOwnProperty('baseUrl')) {
|
||||||
var validUpdateTypes = mongoose.model('Form').schema.path('plugins.oscarhost.settings.updateType').enumValues;
|
var validUpdateTypes = mongoose.model('Form').schema.path('plugins.oscarhost.settings.updateType').enumValues;
|
||||||
that.plugins.oscarhost.settings.validUpdateTypes = validUpdateTypes;
|
that.plugins.oscarhost.settings.validUpdateTypes = validUpdateTypes;
|
||||||
}
|
}
|
||||||
cb(null);
|
return cb(null);
|
||||||
},
|
},
|
||||||
function(cb) {
|
function(return cb) {
|
||||||
if (that.pdf) {
|
if (that.pdf) {
|
||||||
async.series([
|
async.series([
|
||||||
function (callback) {
|
function (return callback) {
|
||||||
if (that.isModified('pdf') && that.pdf.path) {
|
if (that.isModified('pdf') && that.pdf.path) {
|
||||||
|
|
||||||
var new_filename = that.title.replace(/ /g, '') + '_template.pdf';
|
var new_filename = that.title.replace(/ /g, '') + '_template.pdf';
|
||||||
|
@ -279,26 +279,26 @@ FormSchema.pre('save', function (next) {
|
||||||
mkdirp.sync(newDestination);
|
mkdirp.sync(newDestination);
|
||||||
}
|
}
|
||||||
if (stat && !stat.isDirectory()) {
|
if (stat && !stat.isDirectory()) {
|
||||||
return callback(new Error('Directory cannot be created because an inode of a different type exists at "' + config.pdfUploadPath + '"'), null);
|
return return callback(new Error('Directory cannot be created because an inode of a different type exists at "' + config.pdfUploadPath + '"'), null);
|
||||||
}
|
}
|
||||||
|
|
||||||
var old_path = that.pdf.path;
|
var old_path = that.pdf.path;
|
||||||
fs.move(old_path, path.join(newDestination, new_filename), {clobber: true}, function (err) {
|
fs.move(old_path, path.join(newDestination, new_filename), {clobber: true}, function (err) {
|
||||||
if (err) {
|
if (err) {
|
||||||
console.error(err);
|
console.error(err);
|
||||||
callback(new Error(err.message), 'task1');
|
return callback(new Error(err.message), 'task1');
|
||||||
} else {
|
} else {
|
||||||
that.pdf.path = path.join(newDestination, new_filename);
|
that.pdf.path = path.join(newDestination, new_filename);
|
||||||
that.pdf.name = new_filename;
|
that.pdf.name = new_filename;
|
||||||
|
|
||||||
callback(null, 'task1');
|
return callback(null, 'task1');
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
callback(null, 'task1');
|
return callback(null, 'task1');
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
function (callback) {
|
function (return callback) {
|
||||||
if (that.isGenerated) {
|
if (that.isGenerated) {
|
||||||
that.pdf.path = config.pdfUploadPath + that.admin.username.replace(/ /g, '') + '/' + that.title.replace(/ /g, '') + '/' + that.title.replace(/ /g, '') + '_template.pdf';
|
that.pdf.path = config.pdfUploadPath + that.admin.username.replace(/ /g, '') + '/' + that.title.replace(/ /g, '') + '/' + that.title.replace(/ /g, '') + '_template.pdf';
|
||||||
that.pdf.name = that.title.replace(/ /g, '') + '_template.pdf';
|
that.pdf.name = that.title.replace(/ /g, '') + '_template.pdf';
|
||||||
|
@ -318,9 +318,9 @@ FormSchema.pre('save', function (next) {
|
||||||
//console.log(that.pdf.path);
|
//console.log(that.pdf.path);
|
||||||
|
|
||||||
if (err) {
|
if (err) {
|
||||||
callback(new Error(err.message), null);
|
return callback(new Error(err.message), null);
|
||||||
} else if (!_form_fields.length || _form_fields === undefined || _form_fields === null) {
|
} else if (!_form_fields.length || _form_fields === undefined || _form_fields === null) {
|
||||||
callback(new Error('Generated formfields is empty'), null);
|
return callback(new Error('Generated formfields is empty'), null);
|
||||||
}
|
}
|
||||||
|
|
||||||
console.log('autogenerating form');
|
console.log('autogenerating form');
|
||||||
|
@ -347,36 +347,36 @@ FormSchema.pre('save', function (next) {
|
||||||
that.form_fields = _form_fields;
|
that.form_fields = _form_fields;
|
||||||
|
|
||||||
that.isGenerated = false;
|
that.isGenerated = false;
|
||||||
callback(null, 'task2');
|
return callback(null, 'task2');
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
callback(null, 'task2');
|
return callback(null, 'task2');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
], function (err, results) {
|
], function (err, results) {
|
||||||
if (err) {
|
if (err) {
|
||||||
cb(new Error({
|
return cb(new Error({
|
||||||
message: err.message
|
message: err.message
|
||||||
}));
|
}));
|
||||||
} else {
|
} else {
|
||||||
//console.log('ending form save1');
|
//console.log('ending form save1');
|
||||||
cb();
|
return cb();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
else if (_original) {
|
else if (_original) {
|
||||||
if (_original.hasOwnProperty('pdf')) {
|
if (_original.hasOwnProperty('pdf')) {
|
||||||
fs.remove(_original.pdf.path, function (err) {
|
fs.remove(_original.pdf.path, function (err) {
|
||||||
if (err) cb(err);
|
if (err) return cb(err);
|
||||||
console.log('file at ' + _original.pdf.path + ' successfully deleted');
|
console.log('file at ' + _original.pdf.path + ' successfully deleted');
|
||||||
cb();
|
return cb();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
else cb();
|
else return cb();
|
||||||
}
|
}
|
||||||
else cb();
|
else return cb();
|
||||||
},
|
},
|
||||||
function(cb) {
|
function(return cb) {
|
||||||
|
|
||||||
if(that.isModified('form_fields') && that.form_fields && _original){
|
if(that.isModified('form_fields') && that.form_fields && _original){
|
||||||
|
|
||||||
|
@ -391,7 +391,7 @@ FormSchema.pre('save', function (next) {
|
||||||
var modifiedSubmissions = [];
|
var modifiedSubmissions = [];
|
||||||
|
|
||||||
async.forEachOfSeries(deletedIds,
|
async.forEachOfSeries(deletedIds,
|
||||||
function (deletedIdIndex, key, cb_id) {
|
function (deletedIdIndex, key, return cb_id) {
|
||||||
|
|
||||||
var deleted_id = old_ids[deletedIdIndex];
|
var deleted_id = old_ids[deletedIdIndex];
|
||||||
|
|
||||||
|
@ -401,7 +401,7 @@ FormSchema.pre('save', function (next) {
|
||||||
exec(function(err, submissions){
|
exec(function(err, submissions){
|
||||||
if(err) {
|
if(err) {
|
||||||
console.error(err);
|
console.error(err);
|
||||||
cb_id(err);
|
return cb_id(err);
|
||||||
} else {
|
} else {
|
||||||
//Delete field if there are no submission(s) found
|
//Delete field if there are no submission(s) found
|
||||||
if (submissions.length) {
|
if (submissions.length) {
|
||||||
|
@ -409,18 +409,18 @@ FormSchema.pre('save', function (next) {
|
||||||
modifiedSubmissions.push.apply(modifiedSubmissions, submissions);
|
modifiedSubmissions.push.apply(modifiedSubmissions, submissions);
|
||||||
}
|
}
|
||||||
|
|
||||||
cb_id(null);
|
return cb_id(null);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
function (err) {
|
function (err) {
|
||||||
if(err){
|
if(err){
|
||||||
console.error(err.message);
|
console.error(err.message);
|
||||||
cb(err);
|
return cb(err);
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
//Iterate through all submissions with modified form_fields
|
//Iterate through all submissions with modified form_fields
|
||||||
async.forEachOfSeries(modifiedSubmissions, function (submission, key, callback) {
|
async.forEachOfSeries(modifiedSubmissions, function (submission, key, return callback) {
|
||||||
|
|
||||||
//Iterate through ids of deleted fields
|
//Iterate through ids of deleted fields
|
||||||
for (var i = 0; i < deletedIds.length; i++) {
|
for (var i = 0; i < deletedIds.length; i++) {
|
||||||
|
@ -450,27 +450,27 @@ FormSchema.pre('save', function (next) {
|
||||||
}
|
}
|
||||||
|
|
||||||
submission.save(function (err) {
|
submission.save(function (err) {
|
||||||
if (err) callback(err);
|
if (err) return callback(err);
|
||||||
else callback(null);
|
else return callback(null);
|
||||||
});
|
});
|
||||||
}, function (err) {
|
}, function (err) {
|
||||||
if (err) {
|
if (err) {
|
||||||
console.error(err.message);
|
console.error(err.message);
|
||||||
cb(err);
|
return cb(err);
|
||||||
}
|
}
|
||||||
else cb();
|
else return cb();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
else cb(null);
|
else return cb(null);
|
||||||
}
|
}
|
||||||
else cb(null);
|
else return cb(null);
|
||||||
}],
|
}],
|
||||||
function(err, results){
|
function(err, results){
|
||||||
if (err) next(err);
|
if (err) return next(err);
|
||||||
next();
|
return next();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -106,7 +106,7 @@ describe('FormSubmission Model Unit Tests:', function() {
|
||||||
{'fieldType':'textfield', 'title':'And your last name', 'fieldValue': ''},
|
{'fieldType':'textfield', 'title':'And your last name', 'fieldValue': ''},
|
||||||
{'fieldType':'radio', 'title':'And your sex', 'fieldOptions': [{ 'option_id': 0, 'option_title': 'Male', 'option_value': 'M' }, { 'option_id': 1, 'option_title': 'Female', 'option_value': 'F' }], 'fieldValue': ''},
|
{'fieldType':'radio', 'title':'And your sex', 'fieldOptions': [{ 'option_id': 0, 'option_title': 'Male', 'option_value': 'M' }, { 'option_id': 1, 'option_title': 'Female', 'option_value': 'F' }], 'fieldValue': ''},
|
||||||
{'fieldType':'date', 'title':'When were you born?', 'fieldValue': ''},
|
{'fieldType':'date', 'title':'When were you born?', 'fieldValue': ''},
|
||||||
{'fieldType':'number', 'title':'What\'s your phone #?', 'fieldValue': ''},
|
{'fieldType':'number', 'title':'What\'s your phone #?', 'fieldValue': ''}
|
||||||
],
|
],
|
||||||
plugins: {
|
plugins: {
|
||||||
oscarhost: {
|
oscarhost: {
|
||||||
|
|
|
@ -9,18 +9,18 @@ var multiFact = {
|
||||||
{
|
{
|
||||||
left:"user 4",
|
left:"user 4",
|
||||||
right:"something something user something",
|
right:"something something user something",
|
||||||
logicOp: "AND",
|
logicOp: "AND"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
left:"something something user something",
|
left:"something something user something",
|
||||||
right:"something",
|
right:"something",
|
||||||
logicOp: "OR",
|
logicOp: "OR"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
left:"",
|
left:"",
|
||||||
right:"",
|
right:"",
|
||||||
logicOp:"",
|
logicOp:"",
|
||||||
prevResult: null,
|
prevResult: null
|
||||||
};
|
};
|
||||||
|
|
||||||
var _globalRules = function(){};
|
var _globalRules = function(){};
|
||||||
|
@ -59,7 +59,7 @@ _globalRules.NotEqual = {
|
||||||
"consequence" : function(R) {
|
"consequence" : function(R) {
|
||||||
this.result = false;
|
this.result = false;
|
||||||
R.next();
|
R.next();
|
||||||
},
|
}
|
||||||
};
|
};
|
||||||
_globalRules.AND = {
|
_globalRules.AND = {
|
||||||
"condition" : function(R) {
|
"condition" : function(R) {
|
||||||
|
@ -74,7 +74,7 @@ _globalRules.AND = {
|
||||||
"consequence" : function(R) {
|
"consequence" : function(R) {
|
||||||
this.result = false;
|
this.result = false;
|
||||||
R.next();
|
R.next();
|
||||||
},
|
}
|
||||||
};
|
};
|
||||||
_globalRules.OR = {
|
_globalRules.OR = {
|
||||||
"condition" : function(R) {
|
"condition" : function(R) {
|
||||||
|
@ -157,7 +157,7 @@ _stringRules.EndsWith = {
|
||||||
"consequence" : function(R) {
|
"consequence" : function(R) {
|
||||||
this.result = false;
|
this.result = false;
|
||||||
R.next();
|
R.next();
|
||||||
},
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
var _numberRules = function(){};
|
var _numberRules = function(){};
|
||||||
|
@ -176,7 +176,7 @@ _numberRules.GreaterThan = {
|
||||||
"consequence" : function(R) {
|
"consequence" : function(R) {
|
||||||
this.result = false;
|
this.result = false;
|
||||||
R.next();
|
R.next();
|
||||||
},
|
}
|
||||||
};
|
};
|
||||||
_numberRules.SmallerThan = {
|
_numberRules.SmallerThan = {
|
||||||
"condition" : function(R) {
|
"condition" : function(R) {
|
||||||
|
@ -208,7 +208,7 @@ _numberRules.GreaterThanOrEqual = {
|
||||||
"consequence" : function(R) {
|
"consequence" : function(R) {
|
||||||
this.result = false;
|
this.result = false;
|
||||||
R.next();
|
R.next();
|
||||||
},
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
_numberRules.SmallerThanOrEqual = {
|
_numberRules.SmallerThanOrEqual = {
|
||||||
|
@ -225,7 +225,7 @@ _numberRules.SmallerThanOrEqual = {
|
||||||
"consequence" : function(R) {
|
"consequence" : function(R) {
|
||||||
this.result = false;
|
this.result = false;
|
||||||
R.next();
|
R.next();
|
||||||
},
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
|
|
|
@ -13,7 +13,7 @@ angular.module('core').service('Menus', [
|
||||||
// A private function for rendering decision
|
// A private function for rendering decision
|
||||||
var shouldRender = function(user) {
|
var shouldRender = function(user) {
|
||||||
if (user) {
|
if (user) {
|
||||||
if (!!~this.roles.indexOf('*')) {
|
if (~this.roles.indexOf('*')) {
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
for (var userRoleIndex in user.roles) {
|
for (var userRoleIndex in user.roles) {
|
||||||
|
|
|
@ -18,15 +18,15 @@ angular.module('forms').controller('AdminFormController', ['$rootScope', '$scope
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
heading: 'Design',
|
heading: 'Design',
|
||||||
route: 'viewForm.design',
|
route: 'viewForm.design'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
heading: 'Configure',
|
heading: 'Configure',
|
||||||
route: 'viewForm.configure',
|
route: 'viewForm.configure'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
heading: 'Analyze',
|
heading: 'Analyze',
|
||||||
route: 'viewForm.analyze',
|
route: 'viewForm.analyze'
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
|
|
||||||
|
@ -116,7 +116,7 @@ angular.module('forms').controller('AdminFormController', ['$rootScope', '$scope
|
||||||
if(!updateImmediately){$rootScope.saveInProgress = false; }
|
if(!updateImmediately){$rootScope.saveInProgress = false; }
|
||||||
|
|
||||||
if( (typeof cb) === 'function'){
|
if( (typeof cb) === 'function'){
|
||||||
cb(err);
|
return cb(err);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -77,7 +77,7 @@ angular.module('forms').directive('configureFormDirective', ['$rootScope', '$htt
|
||||||
console.log('Error occured during upload.\n');
|
console.log('Error occured during upload.\n');
|
||||||
console.log(resp.status);
|
console.log(resp.status);
|
||||||
}, function (evt) {
|
}, function (evt) {
|
||||||
var progressPercentage = parseInt(100.0 * evt.loaded / evt.total);
|
var progressPercentage = parseInt(100.0 * evt.loaded / evt.total, 10);
|
||||||
$scope.log = 'progress: ' + progressPercentage + '% ' +
|
$scope.log = 'progress: ' + progressPercentage + '% ' +
|
||||||
evt.config.data.file.name + '\n' + $scope.log;
|
evt.config.data.file.name + '\n' + $scope.log;
|
||||||
|
|
||||||
|
|
|
@ -6,7 +6,7 @@ angular.module('forms').directive('editFormDirective', ['$rootScope', 'FormField
|
||||||
templateUrl: 'modules/forms/views/directiveViews/form/edit-form.client.view.html',
|
templateUrl: 'modules/forms/views/directiveViews/form/edit-form.client.view.html',
|
||||||
restrict: 'E',
|
restrict: 'E',
|
||||||
scope: {
|
scope: {
|
||||||
myform:'=',
|
myform:'='
|
||||||
},
|
},
|
||||||
controller: function($scope){
|
controller: function($scope){
|
||||||
var field_ids = _($scope.myform.form_fields).pluck('_id');
|
var field_ids = _($scope.myform.form_fields).pluck('_id');
|
||||||
|
@ -59,7 +59,7 @@ angular.module('forms').directive('editFormDirective', ['$rootScope', 'FormField
|
||||||
$scope.dropzone = {
|
$scope.dropzone = {
|
||||||
handle: ' .handle',
|
handle: ' .handle',
|
||||||
containment: '.dropzoneContainer',
|
containment: '.dropzoneContainer',
|
||||||
cursor: 'grabbing',
|
cursor: 'grabbing'
|
||||||
};
|
};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -175,7 +175,7 @@ angular.module('forms').directive('editFormDirective', ['$rootScope', 'FormField
|
||||||
var newOption = {
|
var newOption = {
|
||||||
'option_id' : Math.floor(100000*Math.random()),
|
'option_id' : Math.floor(100000*Math.random()),
|
||||||
'option_title' : 'Option '+lastOptionID,
|
'option_title' : 'Option '+lastOptionID,
|
||||||
'option_value' : 'Option ' +lastOptionID,
|
'option_value' : 'Option ' +lastOptionID
|
||||||
};
|
};
|
||||||
|
|
||||||
// put new option into fieldOptions array
|
// put new option into fieldOptions array
|
||||||
|
@ -208,7 +208,7 @@ angular.module('forms').directive('editFormDirective', ['$rootScope', 'FormField
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
},
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -105,7 +105,7 @@ angular.module('forms').directive('editSubmissionsFormDirective', ['$rootScope',
|
||||||
var fileMIMETypeMap = {
|
var fileMIMETypeMap = {
|
||||||
'xls': 'vnd.openxmlformats-officedocument.spreadsheetml.sheet',
|
'xls': 'vnd.openxmlformats-officedocument.spreadsheetml.sheet',
|
||||||
'json': 'json',
|
'json': 'json',
|
||||||
'csv': 'csv',
|
'csv': 'csv'
|
||||||
};
|
};
|
||||||
|
|
||||||
var blob = new Blob([document.getElementById('table-submission-data').innerHTM], {
|
var blob = new Blob([document.getElementById('table-submission-data').innerHTM], {
|
||||||
|
|
|
@ -32,7 +32,6 @@ angular.module('forms').directive('fieldDirective', ['$http', '$compile', '$root
|
||||||
if (__indexOf.call(supported_fields, type) >= 0) {
|
if (__indexOf.call(supported_fields, type) >= 0) {
|
||||||
templateUrl = templateUrl+type+'.html';
|
templateUrl = templateUrl+type+'.html';
|
||||||
}
|
}
|
||||||
|
|
||||||
return $templateCache.get('../public/'+templateUrl);
|
return $templateCache.get('../public/'+templateUrl);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -48,28 +48,30 @@ angular.module('forms').directive('submitFormDirective', ['$http', 'TimeCounter'
|
||||||
$scope.fieldBottom = elemBox.bottom;
|
$scope.fieldBottom = elemBox.bottom;
|
||||||
|
|
||||||
//console.log($scope.forms.myForm);
|
//console.log($scope.forms.myForm);
|
||||||
|
var field_id;
|
||||||
|
var field_index;
|
||||||
|
|
||||||
if(!$scope.noscroll){
|
if(!$scope.noscroll){
|
||||||
//Focus on submit button
|
//Focus on submit button
|
||||||
if( $scope.selected.index === $scope.myform.form_fields.length-1 && $scope.fieldBottom < 200){
|
if( $scope.selected.index === $scope.myform.form_fields.length-1 && $scope.fieldBottom < 200){
|
||||||
var field_index = $scope.selected.index+1;
|
field_index = $scope.selected.index+1;
|
||||||
var field_id = 'submit_field';
|
field_id = 'submit_field';
|
||||||
$scope.setActiveField(field_id, field_index, false);
|
$scope.setActiveField(field_id, field_index, false);
|
||||||
}
|
}
|
||||||
//Focus on field above submit button
|
//Focus on field above submit button
|
||||||
else if($scope.selected.index === $scope.myform.form_fields.length){
|
else if($scope.selected.index === $scope.myform.form_fields.length){
|
||||||
if($scope.fieldTop > 200){
|
if($scope.fieldTop > 200){
|
||||||
var field_index = $scope.selected.index-1;
|
field_index = $scope.selected.index-1;
|
||||||
var field_id = $scope.myform.form_fields[field_index]._id;
|
field_id = $scope.myform.form_fields[field_index]._id;
|
||||||
$scope.setActiveField(field_id, field_index, false);
|
$scope.setActiveField(field_id, field_index, false);
|
||||||
}
|
}
|
||||||
}else if( $scope.fieldBottom < 0){
|
}else if( $scope.fieldBottom < 0){
|
||||||
var field_index = $scope.selected.index+1;
|
field_index = $scope.selected.index+1;
|
||||||
var field_id = $scope.myform.form_fields[field_index]._id;
|
field_id = $scope.myform.form_fields[field_index]._id;
|
||||||
$scope.setActiveField(field_id, field_index, false);
|
$scope.setActiveField(field_id, field_index, false);
|
||||||
}else if ( $scope.selected.index !== 0 && $scope.fieldTop > 0) {
|
}else if ( $scope.selected.index !== 0 && $scope.fieldTop > 0) {
|
||||||
var field_index = $scope.selected.index-1;
|
field_index = $scope.selected.index-1;
|
||||||
var field_id = $scope.myform.form_fields[field_index]._id;
|
field_id = $scope.myform.form_fields[field_index]._id;
|
||||||
$scope.setActiveField(field_id, field_index, false);
|
$scope.setActiveField(field_id, field_index, false);
|
||||||
}
|
}
|
||||||
//console.log('$scope.selected.index: '+$scope.selected.index);
|
//console.log('$scope.selected.index: '+$scope.selected.index);
|
||||||
|
|
|
@ -205,7 +205,7 @@
|
||||||
$modelValue: 'Test Form5'
|
$modelValue: 'Test Form5'
|
||||||
},
|
},
|
||||||
$dirty: true,
|
$dirty: true,
|
||||||
$valid: true,
|
$valid: true
|
||||||
};
|
};
|
||||||
|
|
||||||
//Set $state transition
|
//Set $state transition
|
||||||
|
|
|
@ -38,7 +38,7 @@
|
||||||
{'fieldType':'textfield', 'title':'First Name', 'fieldValue': '', 'deletePreserved': false},
|
{'fieldType':'textfield', 'title':'First Name', 'fieldValue': '', 'deletePreserved': false},
|
||||||
{'fieldType':'checkbox', 'title':'nascar', 'fieldValue': '', 'deletePreserved': false},
|
{'fieldType':'checkbox', 'title':'nascar', 'fieldValue': '', 'deletePreserved': false},
|
||||||
{'fieldType':'checkbox', 'title':'hockey', 'fieldValue': '', 'deletePreserved': false}
|
{'fieldType':'checkbox', 'title':'hockey', 'fieldValue': '', 'deletePreserved': false}
|
||||||
],
|
]
|
||||||
};
|
};
|
||||||
|
|
||||||
//Mock Users Service
|
//Mock Users Service
|
||||||
|
|
|
@ -14,7 +14,7 @@
|
||||||
password: 'password',
|
password: 'password',
|
||||||
provider: 'local',
|
provider: 'local',
|
||||||
roles: ['user'],
|
roles: ['user'],
|
||||||
_id: 'ed873933b1f1dea0ce12fab9',
|
_id: 'ed873933b1f1dea0ce12fab9'
|
||||||
};
|
};
|
||||||
|
|
||||||
var pdfObj = {
|
var pdfObj = {
|
||||||
|
@ -48,7 +48,7 @@
|
||||||
isGenerated: false,
|
isGenerated: false,
|
||||||
isLive: false,
|
isLive: false,
|
||||||
autofillPDFs: false,
|
autofillPDFs: false,
|
||||||
_id: '525a8422f6d0f87f0e407a33',
|
_id: '525a8422f6d0f87f0e407a33'
|
||||||
};
|
};
|
||||||
|
|
||||||
// The $resource service augments the response object with methods for updating and deleting the resource.
|
// The $resource service augments the response object with methods for updating and deleting the resource.
|
||||||
|
|
|
@ -14,7 +14,7 @@
|
||||||
password: 'password',
|
password: 'password',
|
||||||
provider: 'local',
|
provider: 'local',
|
||||||
roles: ['user'],
|
roles: ['user'],
|
||||||
_id: 'ed873933b1f1dea0ce12fab9',
|
_id: 'ed873933b1f1dea0ce12fab9'
|
||||||
};
|
};
|
||||||
|
|
||||||
var pdfObj = {
|
var pdfObj = {
|
||||||
|
@ -48,7 +48,7 @@
|
||||||
isGenerated: false,
|
isGenerated: false,
|
||||||
isLive: false,
|
isLive: false,
|
||||||
autofillPDFs: false,
|
autofillPDFs: false,
|
||||||
_id: '525a8422f6d0f87f0e407a33',
|
_id: '525a8422f6d0f87f0e407a33'
|
||||||
};
|
};
|
||||||
|
|
||||||
var sampleSubmission = {
|
var sampleSubmission = {
|
||||||
|
|
|
@ -14,7 +14,7 @@
|
||||||
password: 'password',
|
password: 'password',
|
||||||
provider: 'local',
|
provider: 'local',
|
||||||
roles: ['user'],
|
roles: ['user'],
|
||||||
_id: 'ed873933b1f1dea0ce12fab9',
|
_id: 'ed873933b1f1dea0ce12fab9'
|
||||||
};
|
};
|
||||||
|
|
||||||
var pdfObj = {
|
var pdfObj = {
|
||||||
|
@ -51,7 +51,7 @@
|
||||||
isGenerated: false,
|
isGenerated: false,
|
||||||
isLive: false,
|
isLive: false,
|
||||||
autofillPDFs: false,
|
autofillPDFs: false,
|
||||||
_id: '525a8422f6d0f87f0e407a33',
|
_id: '525a8422f6d0f87f0e407a33'
|
||||||
};
|
};
|
||||||
|
|
||||||
var sampleSubmission = {
|
var sampleSubmission = {
|
||||||
|
|
|
@ -64,7 +64,7 @@ angular.module('users').factory('Auth', ['$window',
|
||||||
$window.user = null;
|
$window.user = null;
|
||||||
userState.isLoggedIn = false;
|
userState.isLoggedIn = false;
|
||||||
service._currentUser = null;
|
service._currentUser = null;
|
||||||
},
|
}
|
||||||
};
|
};
|
||||||
return service;
|
return service;
|
||||||
|
|
||||||
|
|
|
@ -106,7 +106,7 @@ angular.module('users').factory('User', ['$window', '$q', '$timeout', '$http', '
|
||||||
});
|
});
|
||||||
|
|
||||||
return deferred.promise;
|
return deferred.promise;
|
||||||
},
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue