commit
bed26ab214
7
.gitignore
vendored
7
.gitignore
vendored
|
@ -1,9 +1,4 @@
|
||||||
<<<<<<< HEAD
|
|
||||||
ecosystem.js
|
|
||||||
=======
|
|
||||||
dist/
|
|
||||||
npm-debug.*
|
npm-debug.*
|
||||||
>>>>>>> 08a672a87432ca61efb3613b22e5a8b16698f722
|
|
||||||
docs/Oscar_Credentials.md
|
docs/Oscar_Credentials.md
|
||||||
scripts/test_oscarhost.js
|
scripts/test_oscarhost.js
|
||||||
scripts/oscarhost/private/
|
scripts/oscarhost/private/
|
||||||
|
@ -20,7 +15,6 @@ Oscar_Credentials.*
|
||||||
|
|
||||||
# Node and related ecosystem
|
# Node and related ecosystem
|
||||||
# ==========================
|
# ==========================
|
||||||
ecosystem.json
|
|
||||||
.nodemonignore
|
.nodemonignore
|
||||||
.sass-cache/
|
.sass-cache/
|
||||||
npm-debug.log
|
npm-debug.log
|
||||||
|
@ -34,7 +28,6 @@ app/tests/coverage/
|
||||||
# ======================
|
# ======================
|
||||||
config/sslcerts/*.pem
|
config/sslcerts/*.pem
|
||||||
access.log
|
access.log
|
||||||
public/dist/
|
|
||||||
public/dist/populate_template_cache.js
|
public/dist/populate_template_cache.js
|
||||||
uploads/
|
uploads/
|
||||||
# API keys file
|
# API keys file
|
||||||
|
|
|
@ -17,6 +17,8 @@ TellForm is an *opensource alternative to TypeForm* built ontop of nodejs that c
|
||||||
|
|
||||||
[Contact Form Example](https://stage.tellform.com/#!/forms/57196d592601ed12074eecc0)
|
[Contact Form Example](https://stage.tellform.com/#!/forms/57196d592601ed12074eecc0)
|
||||||
|
|
||||||
|
[Patient Registration Example](https://stage.tellform.com/#!/forms/573f8329d18419854559c29c)
|
||||||
|
|
||||||
##Screenshots
|
##Screenshots
|
||||||
![screenshot](design/screenshots/tellform_screenshot1.png)
|
![screenshot](design/screenshots/tellform_screenshot1.png)
|
||||||
|
|
||||||
|
|
2
config/env/production.js
vendored
2
config/env/production.js
vendored
|
@ -56,7 +56,7 @@ module.exports = {
|
||||||
options: {
|
options: {
|
||||||
service: process.env.MAILER_SERVICE_PROVIDER || '',
|
service: process.env.MAILER_SERVICE_PROVIDER || '',
|
||||||
ssl: false,
|
ssl: false,
|
||||||
host: "smtp.sparkpostmail.com",
|
host: 'smtp.sparkpostmail.com',
|
||||||
port: 587,
|
port: 587,
|
||||||
secure: false,
|
secure: false,
|
||||||
auth: {
|
auth: {
|
||||||
|
|
|
@ -1,16 +1,19 @@
|
||||||
{
|
{
|
||||||
"apps" : [{
|
"apps" : [{
|
||||||
"name" : "tellform",
|
"name" : "tellform",
|
||||||
"script" : "/usr/local/bin/grunt",
|
"script" : "server.js",
|
||||||
}],
|
"instances": "max",
|
||||||
|
"exec_mode": "cluster",
|
||||||
|
"max_memory_restart" : "200M"
|
||||||
|
}],
|
||||||
"deploy" : {
|
"deploy" : {
|
||||||
"stage" : {
|
"stage" : {
|
||||||
"user" : "polydaic",
|
"user" : "polydaic",
|
||||||
"host" : "159.203.42.158",
|
"host" : "159.203.42.158",
|
||||||
"ref" : "origin/master",
|
"ref" : "origin/stage",
|
||||||
"repo" : "git@github.com:whitef0x0/tellform.git",
|
"repo" : "git@github.com:whitef0x0/tellform.git",
|
||||||
"path" : "/opt/deploy",
|
"path" : "/opt/deploy",
|
||||||
"post-deploy" : "npm install && bower install && pm2 startOrRestart ecosystem.json --env production",
|
"post-deploy" : "npm install && pm2 startOrGracefulReload ecosystem.json --env production",
|
||||||
"env" : {
|
"env" : {
|
||||||
"NODE_ENV": "production",
|
"NODE_ENV": "production",
|
||||||
"BASE_URL": "stage.tellform.com"
|
"BASE_URL": "stage.tellform.com"
|
||||||
|
@ -22,7 +25,7 @@
|
||||||
"ref" : "origin/master",
|
"ref" : "origin/master",
|
||||||
"repo" : "git@github.com:whitef0x0/tellform.git",
|
"repo" : "git@github.com:whitef0x0/tellform.git",
|
||||||
"path" : "/opt/deploy",
|
"path" : "/opt/deploy",
|
||||||
"post-deploy" : "npm install && bower install && pm2 startOrRestart ecosystem.json --env production",
|
"post-deploy" : "npm install && pm2 startOrGracefulReload ecosystem.json --env production",
|
||||||
"env" : {
|
"env" : {
|
||||||
"NODE_ENV": "production",
|
"NODE_ENV": "production",
|
||||||
"BASE_URL": "admin.tellform.com"
|
"BASE_URL": "admin.tellform.com"
|
||||||
|
|
|
@ -32,6 +32,7 @@
|
||||||
"connect-mongo": "~0.8.2",
|
"connect-mongo": "~0.8.2",
|
||||||
"consolidate": "~0.13.1",
|
"consolidate": "~0.13.1",
|
||||||
"cookie-parser": "~1.4.0",
|
"cookie-parser": "~1.4.0",
|
||||||
|
"dotenv": "^2.0.0",
|
||||||
"email-verification": "whitef0x0/node-email-verification",
|
"email-verification": "whitef0x0/node-email-verification",
|
||||||
"envfile": "^2.0.1",
|
"envfile": "^2.0.1",
|
||||||
"express": "~4.13.3",
|
"express": "~4.13.3",
|
||||||
|
|
0
public/dist/.placeholder
vendored
Normal file
0
public/dist/.placeholder
vendored
Normal file
65
public/dist/application.js
vendored
65
public/dist/application.js
vendored
|
@ -47,7 +47,7 @@ angular.module('NodeForm.templates', []).run(['$templateCache', function($templa
|
||||||
$templateCache.put("../public/modules/forms/views/directiveViews/field/date.html",
|
$templateCache.put("../public/modules/forms/views/directiveViews/field/date.html",
|
||||||
"<div class=\"field row\" ng-click=\"setActiveField(field._id, index, true)\"><div class=\"col-xs-12 field-title\" ng-style=\"{'color': design.colors.questionColor}\"><h3><small class=field-number>{{index+1}} <i class=\"fa fa-angle-double-right\" aria-hidden=true></i></small> {{field.title}} <span class=required-error ng-show=\"!field.required && !field.fieldValue\">optional</span></h3></div><div class=\"col-xs-12 field-input\"><div class=\"control-group input-append\"><input ng-focus=\"setActiveField(field._id, index, true)\" class=focusOn ng-style=\"{'color': design.colors.answerColor, 'border-color': design.colors.answerColor}\" ng-class=\"{ 'no-border': !!field.fieldValue }\" ui-date=dateOptions ng-model=field.fieldValue ng-model-options=\"{ debounce: 250 }\" ng-required=field.required ng-disabled=field.disabled placeholder=MM/DD/YYYY on-enter-key=nextField() ng-change=$root.nextField()></div></div></div>");
|
"<div class=\"field row\" ng-click=\"setActiveField(field._id, index, true)\"><div class=\"col-xs-12 field-title\" ng-style=\"{'color': design.colors.questionColor}\"><h3><small class=field-number>{{index+1}} <i class=\"fa fa-angle-double-right\" aria-hidden=true></i></small> {{field.title}} <span class=required-error ng-show=\"!field.required && !field.fieldValue\">optional</span></h3></div><div class=\"col-xs-12 field-input\"><div class=\"control-group input-append\"><input ng-focus=\"setActiveField(field._id, index, true)\" class=focusOn ng-style=\"{'color': design.colors.answerColor, 'border-color': design.colors.answerColor}\" ng-class=\"{ 'no-border': !!field.fieldValue }\" ui-date=dateOptions ng-model=field.fieldValue ng-model-options=\"{ debounce: 250 }\" ng-required=field.required ng-disabled=field.disabled placeholder=MM/DD/YYYY on-enter-key=nextField() ng-change=$root.nextField()></div></div></div>");
|
||||||
$templateCache.put("../public/modules/forms/views/directiveViews/field/dropdown.html",
|
$templateCache.put("../public/modules/forms/views/directiveViews/field/dropdown.html",
|
||||||
"<div class=\"field row dropdown\" ng-click=\"setActiveField(field._id, index, true)\" ng-if=\"field.fieldOptions.length > 0\"><div class=\"col-xs-12 field-title\" ng-style=\"{'color': design.colors.questionColor}\"><h3><small class=field-number>{{index+1}} <i class=\"fa fa-angle-double-right\" aria-hidden=true></i></small> {{field.title}} <span class=required-error ng-show=!field.required>optional</span></h3></div><div class=\"col-xs-12 field-input\"><ui-select ng-model=field.fieldValue theme=selectize ng-model-options=\"{ debounce: 250 }\" ng-required=field.required ng-disabled=field.disabled ng-change=$root.nextField()><ui-select-match placeholder=\"Type or select an option\">{{$select.selected.option_value}}</ui-select-match><ui-select-choices repeat=\"option in field.fieldOptions | filter: $select.search\" ng-class=\"{'active': option.option_value === field.fieldValue }\"><span ng-bind-html=\"option.option_value | highlight: $select.search\"></span></ui-select-choices></ui-select></div></div><br>");
|
"<div class=\"field row dropdown\" ng-click=\"setActiveField(field._id, index, true)\" ng-if=\"field.fieldOptions.length > 0\"><div class=\"col-xs-12 field-title\" ng-style=\"{'color': design.colors.questionColor}\"><h3><small class=field-number>{{index+1}} <i class=\"fa fa-angle-double-right\" aria-hidden=true></i></small> {{field.title}} <span class=required-error ng-show=!field.required>optional</span></h3></div><div class=\"col-xs-12 field-input\"><ui-select ng-model=field.fieldValue theme=selectize ng-required=field.required ng-disabled=field.disabled ng-change=$root.nextField()><ui-select-match placeholder=\"Type or select an option\">{{$select.selected.option_value}}</ui-select-match><ui-select-choices repeat=\"option in field.fieldOptions | filter: $select.search\" ng-class=\"{'active': option.option_value === field.fieldValue }\"><span ng-bind-html=\"option.option_value | highlight: $select.search\"></span></ui-select-choices></ui-select></div></div><br>");
|
||||||
$templateCache.put("../public/modules/forms/views/directiveViews/field/file.html",
|
$templateCache.put("../public/modules/forms/views/directiveViews/field/file.html",
|
||||||
"<div class=\"field row\" ng-if=form.autofillPDFs ng-click=\"setActiveField(field._id, index, true)\"><div class=\"col-xs-12 field-title\" ng-style=\"{'color': design.colors.questionColor}\"><h3><small class=field-number>{{index+1}} <i class=\"fa fa-angle-double-right\" aria-hidden=true></i></small> {{field.title}} <span class=required-error ng-show=!field.required>optional</span></h3></div><div class=\"col-sm-8 field-input\"><div class=input-group><div tabindex=-1 class=\"form-control file-caption\"><span class=file-caption-ellipsis ng-if=!form.pdf>…</span><div class=file-caption-name ng-if=form.pdf>{{field.file.originalname}}</div></div><div class=input-group-btn><button type=button ng-if=field.file ng-click=removeFile(field); title=\"Clear selected files\" class=\"btn btn-danger fileinput-remove fileinput-remove-button\"><i class=\"glyphicon glyphicon-trash\"></i> Delete</button> <button type=button ng-if=field.fileLoading title=\"Abort ongoing upload\" class=\"btn btn-default\" ng-click=cancelFileUpload(field)><i class=\"glyphicon glyphicon-ban-circle\"></i> Cancel</button><div class=\"btn btn-success btn-file\" ngf-select ngf-change=uploadPDF($files) ng-if=!field.file><i class=\"glyphicon glyphicon-upload\"></i> Upload your File</div></div></div></div></div>");
|
"<div class=\"field row\" ng-if=form.autofillPDFs ng-click=\"setActiveField(field._id, index, true)\"><div class=\"col-xs-12 field-title\" ng-style=\"{'color': design.colors.questionColor}\"><h3><small class=field-number>{{index+1}} <i class=\"fa fa-angle-double-right\" aria-hidden=true></i></small> {{field.title}} <span class=required-error ng-show=!field.required>optional</span></h3></div><div class=\"col-sm-8 field-input\"><div class=input-group><div tabindex=-1 class=\"form-control file-caption\"><span class=file-caption-ellipsis ng-if=!form.pdf>…</span><div class=file-caption-name ng-if=form.pdf>{{field.file.originalname}}</div></div><div class=input-group-btn><button type=button ng-if=field.file ng-click=removeFile(field); title=\"Clear selected files\" class=\"btn btn-danger fileinput-remove fileinput-remove-button\"><i class=\"glyphicon glyphicon-trash\"></i> Delete</button> <button type=button ng-if=field.fileLoading title=\"Abort ongoing upload\" class=\"btn btn-default\" ng-click=cancelFileUpload(field)><i class=\"glyphicon glyphicon-ban-circle\"></i> Cancel</button><div class=\"btn btn-success btn-file\" ngf-select ngf-change=uploadPDF($files) ng-if=!field.file><i class=\"glyphicon glyphicon-upload\"></i> Upload your File</div></div></div></div></div>");
|
||||||
$templateCache.put("../public/modules/forms/views/directiveViews/field/hidden.html",
|
$templateCache.put("../public/modules/forms/views/directiveViews/field/hidden.html",
|
||||||
|
@ -1030,7 +1030,7 @@ function removeDateFieldsFunc(o) {
|
||||||
function eachObject(v,k){
|
function eachObject(v,k){
|
||||||
|
|
||||||
if(k === 'lastModified' || k === 'created'){
|
if(k === 'lastModified' || k === 'created'){
|
||||||
delete clone[i][k];
|
delete clone[k];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1756,23 +1756,26 @@ angular.module('forms').directive('fieldDirective', ['$http', '$compile', '$root
|
||||||
|
|
||||||
angular.module('forms').directive('keyToOption', function(){
|
angular.module('forms').directive('keyToOption', function(){
|
||||||
return {
|
return {
|
||||||
restrict: 'A',
|
restrict: 'AE',
|
||||||
|
transclude: true,
|
||||||
scope: {
|
scope: {
|
||||||
field: '='
|
field: '&'
|
||||||
},
|
},
|
||||||
link: function($scope, $element, $attrs) {
|
link: function($scope, $element, $attrs, $select) {
|
||||||
$element.bind('keydown keypress', function(event) {
|
$element.bind('keydown keypress', function(event) {
|
||||||
console.log('keypress');
|
|
||||||
|
|
||||||
var keyCode = event.which || event.keyCode;
|
var keyCode = event.which || event.keyCode;
|
||||||
var index = parseInt(String.fromCharCode(keyCode))-1;
|
var index = parseInt(String.fromCharCode(keyCode))-1;
|
||||||
console.log($scope.field);
|
console.log($scope.field);
|
||||||
|
|
||||||
|
|
||||||
if (index < $scope.field.fieldOptions.length) {
|
if (index < $scope.field.fieldOptions.length) {
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
$scope.$apply(function () {
|
$scope.$apply(function () {
|
||||||
$scope.field.fieldValue = $scope.field.fieldOptions[index].option_value;
|
$scope.field.fieldValue = $scope.field.fieldOptions[index].option_value;
|
||||||
|
if($attrs.type === 'dropdown'){
|
||||||
|
$select.selected.option_value = $scope.field.fieldOptions[index].option_value;
|
||||||
|
}
|
||||||
|
console.log($scope);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1914,25 +1917,25 @@ angular.module('forms').directive('submitFormDirective', ['$http', 'TimeCounter'
|
||||||
|
|
||||||
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.visible_form_fields.length-1 && $scope.fieldBottom < 200){
|
||||||
field_index = $scope.selected.index+1;
|
field_index = $scope.selected.index+1;
|
||||||
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.visible_form_fields.length){
|
||||||
if($scope.fieldTop > 200){
|
if($scope.fieldTop > 200){
|
||||||
field_index = $scope.selected.index-1;
|
field_index = $scope.selected.index-1;
|
||||||
field_id = $scope.myform.form_fields[field_index]._id;
|
field_id = $scope.myform.visible_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){
|
||||||
field_index = $scope.selected.index+1;
|
field_index = $scope.selected.index+1;
|
||||||
field_id = $scope.myform.form_fields[field_index]._id;
|
field_id = $scope.myform.visible_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) {
|
||||||
field_index = $scope.selected.index-1;
|
field_index = $scope.selected.index-1;
|
||||||
field_id = $scope.myform.form_fields[field_index]._id;
|
field_id = $scope.myform.visible_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);
|
||||||
|
@ -1941,6 +1944,10 @@ angular.module('forms').directive('submitFormDirective', ['$http', 'TimeCounter'
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
$rootScope.setDropdownOption = function(){
|
||||||
|
console.log('setDropdownOption index: ');
|
||||||
|
};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
** Field Controls
|
** Field Controls
|
||||||
*/
|
*/
|
||||||
|
@ -1950,8 +1957,8 @@ angular.module('forms').directive('submitFormDirective', ['$http', 'TimeCounter'
|
||||||
//console.log($scope.selected);
|
//console.log($scope.selected);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
console.log('field_id: '+field_id);
|
//console.log('field_id: '+field_id);
|
||||||
console.log('field_index: '+field_index);
|
//console.log('field_index: '+field_index);
|
||||||
//console.log($scope.selected);
|
//console.log($scope.selected);
|
||||||
|
|
||||||
$scope.selected._id = field_id;
|
$scope.selected._id = field_id;
|
||||||
|
@ -1964,28 +1971,38 @@ angular.module('forms').directive('submitFormDirective', ['$http', 'TimeCounter'
|
||||||
$scope.noscroll = false;
|
$scope.noscroll = false;
|
||||||
setTimeout(function() {
|
setTimeout(function() {
|
||||||
if (document.querySelectorAll('.activeField .focusOn')[0]) {
|
if (document.querySelectorAll('.activeField .focusOn')[0]) {
|
||||||
console.log(document.querySelectorAll('.activeField .focusOn')[0]);
|
//console.log(document.querySelectorAll('.activeField .focusOn')[0]);
|
||||||
document.querySelectorAll('.activeField .focusOn')[0].focus();
|
document.querySelectorAll('.activeField .focusOn')[0].focus();
|
||||||
} else {
|
} else {
|
||||||
|
//console.log(document.querySelectorAll('.activeField input')[0]);
|
||||||
document.querySelectorAll('.activeField input')[0].focus();
|
document.querySelectorAll('.activeField input')[0].focus();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}else {
|
||||||
|
setTimeout(function() {
|
||||||
|
if (document.querySelectorAll('.activeField .focusOn')[0]) {
|
||||||
|
//console.log(document.querySelectorAll('.activeField .focusOn')[0]);
|
||||||
|
document.querySelectorAll('.activeField .focusOn')[0].focus();
|
||||||
|
} else {
|
||||||
|
document.querySelectorAll('.activeField input')[0].focus();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
$rootScope.nextField = $scope.nextField = function(){
|
$rootScope.nextField = $scope.nextField = function(){
|
||||||
//console.log('nextfield');
|
//console.log('nextfield');
|
||||||
//console.log($scope.selected.index);
|
//console.log($scope.selected.index);
|
||||||
//console.log($scope.myform.form_fields.length-1);
|
//console.log($scope.myform.visible_form_fields.length-1);
|
||||||
var selected_index, selected_id;
|
var selected_index, selected_id;
|
||||||
if($scope.selected.index < $scope.myform.form_fields.length-1){
|
if($scope.selected.index < $scope.myform.visible_form_fields.length-1){
|
||||||
selected_index = $scope.selected.index+1;
|
selected_index = $scope.selected.index+1;
|
||||||
selected_id = $scope.myform.form_fields[selected_index]._id;
|
selected_id = $scope.myform.visible_form_fields[selected_index]._id;
|
||||||
$rootScope.setActiveField(selected_id, selected_index, true);
|
$rootScope.setActiveField(selected_id, selected_index, true);
|
||||||
} else if($scope.selected.index === $scope.myform.form_fields.length-1) {
|
} else if($scope.selected.index === $scope.myform.visible_form_fields.length-1) {
|
||||||
console.log('Second last element');
|
//console.log('Second last element');
|
||||||
selected_index = $scope.selected.index+1;
|
selected_index = $scope.selected.index+1;
|
||||||
selected_id = 'submit_field';
|
selected_id = 'submit_field';
|
||||||
$rootScope.setActiveField(selected_id, selected_index, true);
|
$rootScope.setActiveField(selected_id, selected_index, true);
|
||||||
|
@ -1995,7 +2012,7 @@ angular.module('forms').directive('submitFormDirective', ['$http', 'TimeCounter'
|
||||||
$rootScope.prevField = $scope.prevField = function(){
|
$rootScope.prevField = $scope.prevField = function(){
|
||||||
if($scope.selected.index > 0){
|
if($scope.selected.index > 0){
|
||||||
var selected_index = $scope.selected.index - 1;
|
var selected_index = $scope.selected.index - 1;
|
||||||
var selected_id = $scope.myform.form_fields[selected_index]._id;
|
var selected_id = $scope.myform.visible_form_fields[selected_index]._id;
|
||||||
$scope.setActiveField(selected_id, selected_index, true);
|
$scope.setActiveField(selected_id, selected_index, true);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -2005,8 +2022,8 @@ angular.module('forms').directive('submitFormDirective', ['$http', 'TimeCounter'
|
||||||
*/
|
*/
|
||||||
$scope.exitStartPage = function(){
|
$scope.exitStartPage = function(){
|
||||||
$scope.myform.startPage.showStart = false;
|
$scope.myform.startPage.showStart = false;
|
||||||
if($scope.myform.form_fields.length > 0){
|
if($scope.myform.visible_form_fields.length > 0){
|
||||||
$scope.selected._id = $scope.myform.form_fields[0]._id;
|
$scope.selected._id = $scope.myform.visible_form_fields[0]._id;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
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
6
public/dist/application.min.js
vendored
6
public/dist/application.min.js
vendored
File diff suppressed because one or more lines are too long
|
@ -334,7 +334,14 @@ div.config-form .row.field {
|
||||||
width: 80%;
|
width: 80%;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*Override Select2 UI*/
|
||||||
|
.ui-select-choices.ui-select-dropdown {
|
||||||
|
top:2.5em!important;
|
||||||
|
}
|
||||||
|
.ui-select-toggle {
|
||||||
|
box-shadow:none!important;
|
||||||
|
border:none!important;
|
||||||
|
}
|
||||||
|
|
||||||
.current-fields .tool-panel > .panel-default:hover {
|
.current-fields .tool-panel > .panel-default:hover {
|
||||||
border-color: #9d9d9d;
|
border-color: #9d9d9d;
|
||||||
|
|
|
@ -6,7 +6,7 @@ function removeDateFieldsFunc(o) {
|
||||||
function eachObject(v,k){
|
function eachObject(v,k){
|
||||||
|
|
||||||
if(k === 'lastModified' || k === 'created'){
|
if(k === 'lastModified' || k === 'created'){
|
||||||
delete clone[i][k];
|
delete clone[k];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -6,14 +6,12 @@ angular.module('forms').directive('keyToOption', function(){
|
||||||
scope: {
|
scope: {
|
||||||
field: '='
|
field: '='
|
||||||
},
|
},
|
||||||
link: function($scope, $element, $attrs) {
|
link: function($scope, $element, $attrs, $select) {
|
||||||
$element.bind('keydown keypress', function(event) {
|
$element.bind('keydown keypress', function(event) {
|
||||||
console.log('keypress');
|
|
||||||
|
|
||||||
var keyCode = event.which || event.keyCode;
|
var keyCode = event.which || event.keyCode;
|
||||||
var index = parseInt(String.fromCharCode(keyCode))-1;
|
var index = parseInt(String.fromCharCode(keyCode))-1;
|
||||||
console.log($scope.field);
|
//console.log($scope.field);
|
||||||
|
|
||||||
|
|
||||||
if (index < $scope.field.fieldOptions.length) {
|
if (index < $scope.field.fieldOptions.length) {
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
|
|
|
@ -53,25 +53,25 @@ angular.module('forms').directive('submitFormDirective', ['$http', 'TimeCounter'
|
||||||
|
|
||||||
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.visible_form_fields.length-1 && $scope.fieldBottom < 200){
|
||||||
field_index = $scope.selected.index+1;
|
field_index = $scope.selected.index+1;
|
||||||
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.visible_form_fields.length){
|
||||||
if($scope.fieldTop > 200){
|
if($scope.fieldTop > 200){
|
||||||
field_index = $scope.selected.index-1;
|
field_index = $scope.selected.index-1;
|
||||||
field_id = $scope.myform.form_fields[field_index]._id;
|
field_id = $scope.myform.visible_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){
|
||||||
field_index = $scope.selected.index+1;
|
field_index = $scope.selected.index+1;
|
||||||
field_id = $scope.myform.form_fields[field_index]._id;
|
field_id = $scope.myform.visible_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) {
|
||||||
field_index = $scope.selected.index-1;
|
field_index = $scope.selected.index-1;
|
||||||
field_id = $scope.myform.form_fields[field_index]._id;
|
field_id = $scope.myform.visible_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);
|
||||||
|
@ -80,6 +80,10 @@ angular.module('forms').directive('submitFormDirective', ['$http', 'TimeCounter'
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
$rootScope.setDropdownOption = function(){
|
||||||
|
console.log('setDropdownOption index: ');
|
||||||
|
};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
** Field Controls
|
** Field Controls
|
||||||
*/
|
*/
|
||||||
|
@ -89,8 +93,8 @@ angular.module('forms').directive('submitFormDirective', ['$http', 'TimeCounter'
|
||||||
//console.log($scope.selected);
|
//console.log($scope.selected);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
console.log('field_id: '+field_id);
|
//console.log('field_id: '+field_id);
|
||||||
console.log('field_index: '+field_index);
|
//console.log('field_index: '+field_index);
|
||||||
//console.log($scope.selected);
|
//console.log($scope.selected);
|
||||||
|
|
||||||
$scope.selected._id = field_id;
|
$scope.selected._id = field_id;
|
||||||
|
@ -103,28 +107,38 @@ angular.module('forms').directive('submitFormDirective', ['$http', 'TimeCounter'
|
||||||
$scope.noscroll = false;
|
$scope.noscroll = false;
|
||||||
setTimeout(function() {
|
setTimeout(function() {
|
||||||
if (document.querySelectorAll('.activeField .focusOn')[0]) {
|
if (document.querySelectorAll('.activeField .focusOn')[0]) {
|
||||||
console.log(document.querySelectorAll('.activeField .focusOn')[0]);
|
//console.log(document.querySelectorAll('.activeField .focusOn')[0]);
|
||||||
document.querySelectorAll('.activeField .focusOn')[0].focus();
|
document.querySelectorAll('.activeField .focusOn')[0].focus();
|
||||||
} else {
|
} else {
|
||||||
|
//console.log(document.querySelectorAll('.activeField input')[0]);
|
||||||
document.querySelectorAll('.activeField input')[0].focus();
|
document.querySelectorAll('.activeField input')[0].focus();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}else {
|
||||||
|
setTimeout(function() {
|
||||||
|
if (document.querySelectorAll('.activeField .focusOn')[0]) {
|
||||||
|
//console.log(document.querySelectorAll('.activeField .focusOn')[0]);
|
||||||
|
document.querySelectorAll('.activeField .focusOn')[0].focus();
|
||||||
|
} else {
|
||||||
|
document.querySelectorAll('.activeField input')[0].focus();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
$rootScope.nextField = $scope.nextField = function(){
|
$rootScope.nextField = $scope.nextField = function(){
|
||||||
//console.log('nextfield');
|
//console.log('nextfield');
|
||||||
//console.log($scope.selected.index);
|
//console.log($scope.selected.index);
|
||||||
//console.log($scope.myform.form_fields.length-1);
|
//console.log($scope.myform.visible_form_fields.length-1);
|
||||||
var selected_index, selected_id;
|
var selected_index, selected_id;
|
||||||
if($scope.selected.index < $scope.myform.form_fields.length-1){
|
if($scope.selected.index < $scope.myform.visible_form_fields.length-1){
|
||||||
selected_index = $scope.selected.index+1;
|
selected_index = $scope.selected.index+1;
|
||||||
selected_id = $scope.myform.form_fields[selected_index]._id;
|
selected_id = $scope.myform.visible_form_fields[selected_index]._id;
|
||||||
$rootScope.setActiveField(selected_id, selected_index, true);
|
$rootScope.setActiveField(selected_id, selected_index, true);
|
||||||
} else if($scope.selected.index === $scope.myform.form_fields.length-1) {
|
} else if($scope.selected.index === $scope.myform.visible_form_fields.length-1) {
|
||||||
console.log('Second last element');
|
//console.log('Second last element');
|
||||||
selected_index = $scope.selected.index+1;
|
selected_index = $scope.selected.index+1;
|
||||||
selected_id = 'submit_field';
|
selected_id = 'submit_field';
|
||||||
$rootScope.setActiveField(selected_id, selected_index, true);
|
$rootScope.setActiveField(selected_id, selected_index, true);
|
||||||
|
@ -134,7 +148,7 @@ angular.module('forms').directive('submitFormDirective', ['$http', 'TimeCounter'
|
||||||
$rootScope.prevField = $scope.prevField = function(){
|
$rootScope.prevField = $scope.prevField = function(){
|
||||||
if($scope.selected.index > 0){
|
if($scope.selected.index > 0){
|
||||||
var selected_index = $scope.selected.index - 1;
|
var selected_index = $scope.selected.index - 1;
|
||||||
var selected_id = $scope.myform.form_fields[selected_index]._id;
|
var selected_id = $scope.myform.visible_form_fields[selected_index]._id;
|
||||||
$scope.setActiveField(selected_id, selected_index, true);
|
$scope.setActiveField(selected_id, selected_index, true);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -144,8 +158,8 @@ angular.module('forms').directive('submitFormDirective', ['$http', 'TimeCounter'
|
||||||
*/
|
*/
|
||||||
$scope.exitStartPage = function(){
|
$scope.exitStartPage = function(){
|
||||||
$scope.myform.startPage.showStart = false;
|
$scope.myform.startPage.showStart = false;
|
||||||
if($scope.myform.form_fields.length > 0){
|
if($scope.myform.visible_form_fields.length > 0){
|
||||||
$scope.selected._id = $scope.myform.form_fields[0]._id;
|
$scope.selected._id = $scope.myform.visible_form_fields[0]._id;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -11,11 +11,10 @@
|
||||||
<span class="required-error" ng-show="!field.required">optional</span>
|
<span class="required-error" ng-show="!field.required">optional</span>
|
||||||
</h3>
|
</h3>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-xs-12 field-input ">
|
<div class="col-xs-12 field-input">
|
||||||
<ui-select ng-model="field.fieldValue"
|
<ui-select ng-model="field.fieldValue"
|
||||||
theme="selectize"
|
theme="selectize"
|
||||||
ng-model-options="{ debounce: 250 }"
|
ng-required="field.required"
|
||||||
ng-required="field.required"
|
|
||||||
ng-disabled="field.disabled"
|
ng-disabled="field.disabled"
|
||||||
ng-change="$root.nextField()">
|
ng-change="$root.nextField()">
|
||||||
<ui-select-match placeholder="Type or select an option">
|
<ui-select-match placeholder="Type or select an option">
|
||||||
|
|
11
server.js
11
server.js
|
@ -2,11 +2,16 @@
|
||||||
/**
|
/**
|
||||||
* Module dependencies.
|
* Module dependencies.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
//Load ENV vars from .env
|
||||||
|
require('dotenv').config();
|
||||||
|
|
||||||
var init = require('./config/init')(),
|
var init = require('./config/init')(),
|
||||||
config = require('./config/config'),
|
config = require('./config/config'),
|
||||||
mongoose = require('mongoose'),
|
mongoose = require('mongoose'),
|
||||||
chalk = require('chalk');
|
chalk = require('chalk');
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Main application entry file.
|
* Main application entry file.
|
||||||
* Please note that the order of loading is important.
|
* Please note that the order of loading is important.
|
||||||
|
@ -46,3 +51,9 @@ if (process.env.NODE_ENV === 'secure') {
|
||||||
console.log(chalk.green('HTTPs:\t\t\t\ton'));
|
console.log(chalk.green('HTTPs:\t\t\t\ton'));
|
||||||
}
|
}
|
||||||
console.log('--');
|
console.log('--');
|
||||||
|
|
||||||
|
process.on('uncaughtException', function (err) {
|
||||||
|
console.error((new Date).toUTCString() + ' uncaughtException:', err.message);
|
||||||
|
console.error(err.stack);
|
||||||
|
process.exit(1);
|
||||||
|
});
|
||||||
|
|
Loading…
Reference in a new issue