got setup script to work
This commit is contained in:
parent
76c5520541
commit
883a944c83
14
a.txt
Normal file
14
a.txt
Normal file
|
@ -0,0 +1,14 @@
|
|||
APP_NAME=
|
||||
APP_DESC=
|
||||
APP_KEYWORDS=
|
||||
SIGNUP_DISABLED=false
|
||||
NODE_ENV=dev
|
||||
MAILER_SERVICE_PROVIDER=1und1
|
||||
MAILER_EMAIL_ID=
|
||||
MAILER_PASSWORD=
|
||||
MAILER_FROM=
|
||||
BASE_URL=127.0.0.1
|
||||
PORT=3000
|
||||
GOOGLE_ANALYTICS_ID=
|
||||
email=
|
||||
password=
|
|
@ -80,7 +80,8 @@ var UserSchema = new Schema({
|
|||
},
|
||||
provider: {
|
||||
type: String,
|
||||
required: 'Provider is required'
|
||||
required: 'Provider is required',
|
||||
default: 'local'
|
||||
},
|
||||
providerData: {},
|
||||
additionalProvidersData: {},
|
||||
|
|
10
config/env/all.js
vendored
10
config/env/all.js
vendored
|
@ -3,9 +3,9 @@
|
|||
module.exports = {
|
||||
app: {
|
||||
google_analytics_id: process.env.GOOGLE_ANALYTICS_ID || '',
|
||||
title: 'TellForm',
|
||||
description: 'Opensource form builder alternative to TypeForm',
|
||||
keywords: 'typeform, pdfs, forms, opensource, formbuilder, google forms, nodejs',
|
||||
title: process.env.APP_NAME || 'TellForm',
|
||||
description: process.env.APP_DESC || 'Opensource form builder alternative to TypeForm',
|
||||
keywords: process.env.APP_KEYWORDS || 'typeform, pdfs, forms, opensource, formbuilder, google forms, nodejs'
|
||||
},
|
||||
port: process.env.PORT || 3000,
|
||||
templateEngine: 'swig',
|
||||
|
@ -16,7 +16,7 @@ module.exports = {
|
|||
|
||||
mailosaur: {
|
||||
key: process.env.MAILOSAUR_KEY || '',
|
||||
mailbox_id: process.env.MAILOSAUR_MAILBOX || '',
|
||||
mailbox_id: process.env.MAILOSAUR_MAILBOX || ''
|
||||
},
|
||||
|
||||
//Sentry DSN Client Key
|
||||
|
@ -38,7 +38,7 @@ module.exports = {
|
|||
secure: false,
|
||||
// Only set the maxAge to null if the cookie shouldn't be expired
|
||||
// at all. The cookie will expunge when the browser is closed.
|
||||
maxAge: null,
|
||||
maxAge: null
|
||||
// To set the cookie in a specific domain uncomment the following
|
||||
// setting:
|
||||
// domain: 'tellform.com'
|
||||
|
|
3
config/env/development.js
vendored
3
config/env/development.js
vendored
|
@ -18,9 +18,6 @@ module.exports = {
|
|||
// stream: 'access.log'
|
||||
}
|
||||
},
|
||||
app: {
|
||||
title: 'TellForm'
|
||||
},
|
||||
sessionCookie: {
|
||||
domain: process.env.BASE_URL || 'http://localhost:3000'
|
||||
},
|
||||
|
|
191
gruntfile.js
191
gruntfile.js
|
@ -1,4 +1,6 @@
|
|||
'use strict';
|
||||
var spawn = require('child_process').spawn;
|
||||
|
||||
|
||||
module.exports = function(grunt) {
|
||||
require('jit-grunt')(grunt);
|
||||
|
@ -69,81 +71,81 @@ module.exports = function(grunt) {
|
|||
options: {
|
||||
jshintrc: true
|
||||
}
|
||||
},
|
||||
allTests: {
|
||||
},
|
||||
allTests: {
|
||||
src: watchFiles.allTests,
|
||||
options: {
|
||||
jshintrc: true
|
||||
jshintrc: true
|
||||
}
|
||||
}
|
||||
},
|
||||
csslint: {
|
||||
options: {
|
||||
}
|
||||
},
|
||||
csslint: {
|
||||
options: {
|
||||
csslintrc: '.csslintrc'
|
||||
},
|
||||
all: {
|
||||
},
|
||||
all: {
|
||||
src: watchFiles.clientCSS
|
||||
}
|
||||
},
|
||||
uglify: {
|
||||
production: {
|
||||
options: {
|
||||
mangle: false
|
||||
},
|
||||
files: {
|
||||
'public/dist/application.min.js': 'public/dist/application.js'
|
||||
}
|
||||
}
|
||||
},
|
||||
cssmin: {
|
||||
combine: {
|
||||
files: {
|
||||
'public/dist/application.min.css': '<%= applicationCSSFiles %>'
|
||||
}
|
||||
}
|
||||
},
|
||||
nodemon: {
|
||||
dev: {
|
||||
script: 'server.js',
|
||||
options: {
|
||||
nodeArgs: ['--debug'],
|
||||
ext: 'js,html',
|
||||
watch: watchFiles.serverViews.concat(watchFiles.serverJS)
|
||||
}
|
||||
}
|
||||
},
|
||||
'node-inspector': {
|
||||
custom: {
|
||||
options: {
|
||||
'web-port': 1337,
|
||||
'web-host': 'localhost',
|
||||
'debug-port': 5858,
|
||||
'save-live-edit': true,
|
||||
'no-preload': true,
|
||||
'stack-trace-limit': 50,
|
||||
'hidden': []
|
||||
}
|
||||
}
|
||||
},
|
||||
ngAnnotate: {
|
||||
production: {
|
||||
files: {
|
||||
'public/dist/application.js': '<%= applicationJavaScriptFiles %>'
|
||||
}
|
||||
}
|
||||
},
|
||||
concurrent: {
|
||||
}
|
||||
},
|
||||
uglify: {
|
||||
production: {
|
||||
options: {
|
||||
mangle: false
|
||||
},
|
||||
files: {
|
||||
'public/dist/application.min.js': 'public/dist/application.js'
|
||||
}
|
||||
}
|
||||
},
|
||||
cssmin: {
|
||||
combine: {
|
||||
files: {
|
||||
'public/dist/application.min.css': '<%= applicationCSSFiles %>'
|
||||
}
|
||||
}
|
||||
},
|
||||
nodemon: {
|
||||
dev: {
|
||||
script: 'server.js',
|
||||
options: {
|
||||
nodeArgs: ['--debug'],
|
||||
ext: 'js,html',
|
||||
watch: watchFiles.serverViews.concat(watchFiles.serverJS)
|
||||
}
|
||||
}
|
||||
},
|
||||
'node-inspector': {
|
||||
custom: {
|
||||
options: {
|
||||
'web-port': 1337,
|
||||
'web-host': 'localhost',
|
||||
'debug-port': 5858,
|
||||
'save-live-edit': true,
|
||||
'no-preload': true,
|
||||
'stack-trace-limit': 50,
|
||||
'hidden': []
|
||||
}
|
||||
}
|
||||
},
|
||||
ngAnnotate: {
|
||||
production: {
|
||||
files: {
|
||||
'public/dist/application.js': '<%= applicationJavaScriptFiles %>'
|
||||
}
|
||||
}
|
||||
},
|
||||
concurrent: {
|
||||
default: ['nodemon', 'watch'],
|
||||
debug: ['nodemon', 'watch', 'node-inspector'],
|
||||
options: {
|
||||
logConcurrentOutput: true,
|
||||
limit: 10
|
||||
}
|
||||
debug: ['nodemon', 'watch', 'node-inspector'],
|
||||
options: {
|
||||
logConcurrentOutput: true,
|
||||
limit: 10
|
||||
}
|
||||
},
|
||||
env: {
|
||||
test: {
|
||||
NODE_ENV: 'test',
|
||||
src: '.env'
|
||||
env: {
|
||||
test: {
|
||||
NODE_ENV: 'test',
|
||||
src: '.env'
|
||||
},
|
||||
secure: {
|
||||
NODE_ENV: 'secure',
|
||||
|
@ -156,7 +158,7 @@ NODE_ENV: 'test',
|
|||
dev: {
|
||||
NODE_ENV: 'development',
|
||||
src: '.env'
|
||||
},
|
||||
}
|
||||
},
|
||||
mochaTest: {
|
||||
src: watchFiles.serverTests,
|
||||
|
@ -230,26 +232,31 @@ NODE_ENV: 'test',
|
|||
}
|
||||
}
|
||||
},
|
||||
html2js: {
|
||||
options: {
|
||||
base: 'NodeForm',
|
||||
watch: true,
|
||||
module: 'NodeForm.templates',
|
||||
singleModule: true,
|
||||
useStrict: true,
|
||||
htmlmin: {
|
||||
collapseBooleanAttributes: true,
|
||||
collapseWhitespace: true,
|
||||
removeAttributeQuotes: true,
|
||||
removeComments: true,
|
||||
removeEmptyAttributes: true,
|
||||
removeRedundantAttributes: true
|
||||
}
|
||||
},
|
||||
main: {
|
||||
src: ['public/modules/**/views/**.html', 'public/modules/**/views/**/*.html'],
|
||||
dest: 'public/dist/populate_template_cache.js'
|
||||
}
|
||||
html2js: {
|
||||
options: {
|
||||
base: 'NodeForm',
|
||||
watch: true,
|
||||
module: 'NodeForm.templates',
|
||||
singleModule: true,
|
||||
useStrict: true,
|
||||
htmlmin: {
|
||||
collapseBooleanAttributes: true,
|
||||
collapseWhitespace: true,
|
||||
removeAttributeQuotes: true,
|
||||
removeComments: true,
|
||||
removeEmptyAttributes: true,
|
||||
removeRedundantAttributes: true
|
||||
}
|
||||
},
|
||||
main: {
|
||||
src: ['public/modules/**/views/**.html', 'public/modules/**/views/**/*.html'],
|
||||
dest: 'public/dist/populate_template_cache.js'
|
||||
}
|
||||
},
|
||||
execute: {
|
||||
target: {
|
||||
src: ['./scripts/setup.js']
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -278,7 +285,6 @@ NODE_ENV: 'test',
|
|||
grunt.config.set('applicationCSSFiles', config.assets.css);
|
||||
});
|
||||
|
||||
|
||||
// Code coverage tasks.
|
||||
grunt.registerTask('coveralls', ['env:test','mocha_istanbul:coveralls']);
|
||||
grunt.registerTask('coverage', ['env:test', 'mocha_istanbul:coverage']);
|
||||
|
@ -288,9 +294,11 @@ NODE_ENV: 'test',
|
|||
// Default task(s).
|
||||
grunt.registerTask('default', ['lint', 'html2js:main', 'env', 'concurrent:default']);
|
||||
grunt.registerTask('dev', ['lint', 'html2js:main', 'env:dev', 'concurrent:default']);
|
||||
|
||||
// Debug task.
|
||||
grunt.registerTask('debug', ['lint', 'html2js:main', 'concurrent:debug']);
|
||||
|
||||
|
||||
// Secure task(s).
|
||||
grunt.registerTask('secure', ['env:secure', 'lint', 'html2js:main', 'concurrent:default']);
|
||||
|
||||
|
@ -301,6 +309,9 @@ NODE_ENV: 'test',
|
|||
// Build task(s).
|
||||
grunt.registerTask('build', ['lint', 'loadConfig', 'cssmin', 'ngAnnotate', 'uglify', 'html2js:main']);
|
||||
|
||||
//Setup task(s).
|
||||
grunt.registerTask('setup', ['execute']);
|
||||
|
||||
// Test task(s).
|
||||
grunt.registerTask('test', ['lint:tests', 'test:server', 'test:client']);
|
||||
grunt.registerTask('test:server', ['lint:tests', 'env:test', 'mochaTest']);
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -25,13 +25,14 @@
|
|||
"async": "^1.4.2",
|
||||
"body-parser": "~1.14.1",
|
||||
"bower": "~1.6.5",
|
||||
"chalk": "~1.1.1",
|
||||
"chalk": "^1.1.3",
|
||||
"compression": "~1.6.0",
|
||||
"connect-flash": "~0.1.1",
|
||||
"connect-mongo": "~0.8.2",
|
||||
"consolidate": "~0.13.1",
|
||||
"cookie-parser": "~1.4.0",
|
||||
"email-verification": "whitef0x0/node-email-verification",
|
||||
"envfile": "^2.0.1",
|
||||
"express": "~4.13.3",
|
||||
"express-device": "~0.4.2",
|
||||
"express-session": "~1.12.1",
|
||||
|
@ -53,6 +54,7 @@
|
|||
"grunt-node-inspector": "~0.4.1",
|
||||
"grunt-nodemon": "~0.4.0",
|
||||
"helmet": "~0.14.0",
|
||||
"inquirer": "^1.0.2",
|
||||
"jit-grunt": "^0.9.1",
|
||||
"lodash": "^2.4.1",
|
||||
"main-bower-files": "~2.9.0",
|
||||
|
@ -83,6 +85,7 @@
|
|||
"devDependencies": {
|
||||
"coveralls": "^2.11.4",
|
||||
"glob": "^7.0.3",
|
||||
"grunt-execute": "^0.2.2",
|
||||
"grunt-mocha-istanbul": "^3.0.1",
|
||||
"grunt-mocha-test": "~0.12.1",
|
||||
"istanbul": "^0.4.0",
|
||||
|
|
101
public/dist/application.js
vendored
101
public/dist/application.js
vendored
|
@ -522,10 +522,10 @@ angular.module('core').service('Menus', [
|
|||
// Define the menus object
|
||||
this.menus = {};
|
||||
|
||||
// A private function for rendering decision
|
||||
// A private function for rendering decision
|
||||
var shouldRender = function(user) {
|
||||
if (user) {
|
||||
if (!!~this.roles.indexOf('*')) {
|
||||
if (~this.roles.indexOf('*')) {
|
||||
return true;
|
||||
} else {
|
||||
for (var userRoleIndex in user.roles) {
|
||||
|
@ -681,6 +681,7 @@ angular.module('core').service('Menus', [
|
|||
this.addMenu('bottombar', false, ['*']);
|
||||
}
|
||||
]);
|
||||
|
||||
'use strict';
|
||||
|
||||
// Configuring the Forms drop-down menus
|
||||
|
@ -797,15 +798,15 @@ angular.module('forms').controller('AdminFormController', ['$rootScope', '$scope
|
|||
},
|
||||
{
|
||||
heading: 'Design',
|
||||
route: 'viewForm.design',
|
||||
route: 'viewForm.design'
|
||||
},
|
||||
{
|
||||
heading: 'Configure',
|
||||
route: 'viewForm.configure',
|
||||
route: 'viewForm.configure'
|
||||
},
|
||||
{
|
||||
heading: 'Analyze',
|
||||
route: 'viewForm.analyze',
|
||||
route: 'viewForm.analyze'
|
||||
}
|
||||
];
|
||||
|
||||
|
@ -818,8 +819,8 @@ angular.module('forms').controller('AdminFormController', ['$rootScope', '$scope
|
|||
});
|
||||
};
|
||||
|
||||
/*
|
||||
** DeleteModal Functions
|
||||
/*
|
||||
** DeleteModal Functions
|
||||
*/
|
||||
$scope.openDeleteModal = function(){
|
||||
$scope.deleteModal = $uibModal.open({
|
||||
|
@ -851,15 +852,15 @@ angular.module('forms').controller('AdminFormController', ['$rootScope', '$scope
|
|||
if($scope.deleteModal && $scope.deleteModal.opened){
|
||||
|
||||
$scope.deleteModal.close();
|
||||
|
||||
|
||||
var form_id = $scope.myform._id;
|
||||
if(!form_id) throw new Error('Error - removeCurrentForm(): $scope.myform._id does not exist');
|
||||
|
||||
|
||||
$http.delete('/forms/'+form_id)
|
||||
.success(function(data, status, headers){
|
||||
console.log('form deleted successfully');
|
||||
|
||||
$state.go('listForms', {}, {reload: true});
|
||||
$state.go('listForms', {}, {reload: true});
|
||||
|
||||
}).error(function(error){
|
||||
console.log('ERROR: Form could not be deleted.');
|
||||
|
@ -875,7 +876,7 @@ angular.module('forms').controller('AdminFormController', ['$rootScope', '$scope
|
|||
if(!updateImmediately){
|
||||
continueUpdate = !$rootScope.saveInProgress;
|
||||
}
|
||||
|
||||
|
||||
//Update form **if we are not currently updating** or if **shouldUpdateNow flag is set**
|
||||
if(continueUpdate){
|
||||
var err = null;
|
||||
|
@ -890,12 +891,12 @@ angular.module('forms').controller('AdminFormController', ['$rootScope', '$scope
|
|||
console.log('Error occured during form UPDATE.\n');
|
||||
// console.log(response.data);
|
||||
err = response.data;
|
||||
}).finally(function() {
|
||||
}).finally(function() {
|
||||
// console.log('finished updating');
|
||||
if(!updateImmediately){$rootScope.saveInProgress = false; }
|
||||
|
||||
if( (typeof cb) === 'function'){
|
||||
cb(err);
|
||||
return cb(err);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
@ -904,6 +905,7 @@ angular.module('forms').controller('AdminFormController', ['$rootScope', '$scope
|
|||
|
||||
}
|
||||
]);
|
||||
|
||||
'use strict';
|
||||
|
||||
// Forms controller
|
||||
|
@ -1237,7 +1239,7 @@ angular.module('forms').directive('configureFormDirective', ['$rootScope', '$htt
|
|||
console.log('Error occured during upload.\n');
|
||||
console.log(resp.status);
|
||||
}, 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 + '% ' +
|
||||
evt.config.data.file.name + '\n' + $scope.log;
|
||||
|
||||
|
@ -1261,7 +1263,7 @@ angular.module('forms').directive('editFormDirective', ['$rootScope', 'FormField
|
|||
templateUrl: 'modules/forms/views/directiveViews/form/edit-form.client.view.html',
|
||||
restrict: 'E',
|
||||
scope: {
|
||||
myform:'=',
|
||||
myform:'='
|
||||
},
|
||||
controller: ["$scope", function($scope){
|
||||
var field_ids = _($scope.myform.form_fields).pluck('_id');
|
||||
|
@ -1300,7 +1302,7 @@ angular.module('forms').directive('editFormDirective', ['$rootScope', 'FormField
|
|||
|
||||
if( $scope.myform.plugins.oscarhost.settings.fieldMap.hasOwnProperty(field_id) ){
|
||||
currentFields = _(currentFields).difference($scope.myform.plugins.oscarhost.settings.fieldMap[field_id]);
|
||||
}
|
||||
}
|
||||
|
||||
//Get all oscarhostFields that haven't been mapped to a formfield
|
||||
return _(oscarhostFields).difference(currentFields).value();
|
||||
|
@ -1314,7 +1316,7 @@ angular.module('forms').directive('editFormDirective', ['$rootScope', 'FormField
|
|||
$scope.dropzone = {
|
||||
handle: ' .handle',
|
||||
containment: '.dropzoneContainer',
|
||||
cursor: 'grabbing',
|
||||
cursor: 'grabbing'
|
||||
};
|
||||
|
||||
/*
|
||||
|
@ -1328,9 +1330,9 @@ angular.module('forms').directive('editFormDirective', ['$rootScope', 'FormField
|
|||
var fieldTitle;
|
||||
|
||||
for(var i = 0; i < $scope.addField.types.length; i++){
|
||||
if($scope.addField.types[i].name === fieldType){
|
||||
if($scope.addField.types[i].name === fieldType){
|
||||
$scope.addField.types[i].lastAddedID++;
|
||||
fieldTitle = $scope.addField.types[i].value+$scope.addField.types[i].lastAddedID;
|
||||
fieldTitle = $scope.addField.types[i].value+$scope.addField.types[i].lastAddedID;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -1345,12 +1347,12 @@ angular.module('forms').directive('editFormDirective', ['$rootScope', 'FormField
|
|||
// console.log('\n\n---------\nAdded field CLIENT');
|
||||
// console.log(newField);
|
||||
// newField._id = _.uniqueId();
|
||||
|
||||
|
||||
// put newField into fields array
|
||||
if(modifyForm){
|
||||
$scope.myform.form_fields.push(newField);
|
||||
}
|
||||
return newField;
|
||||
return newField;
|
||||
};
|
||||
|
||||
// Delete particular field on button click
|
||||
|
@ -1364,7 +1366,7 @@ angular.module('forms').directive('editFormDirective', ['$rootScope', 'FormField
|
|||
$scope.myform.form_fields.splice(field_index, 1);
|
||||
};
|
||||
$scope.duplicateField = function (field_index){
|
||||
var currField = _.cloneDeep($scope.myform.form_fields[field_index]);
|
||||
var currField = _.cloneDeep($scope.myform.form_fields[field_index]);
|
||||
currField._id = 'cloned'+_.uniqueId();
|
||||
currField.title += ' copy';
|
||||
|
||||
|
@ -1413,8 +1415,8 @@ angular.module('forms').directive('editFormDirective', ['$rootScope', 'FormField
|
|||
$scope.addOption = function(field_index){
|
||||
var currField = $scope.myform.form_fields[field_index];
|
||||
console.log(field_index);
|
||||
console.log(currField);
|
||||
|
||||
console.log(currField);
|
||||
|
||||
if(currField.fieldType === 'checkbox' || currField.fieldType === 'dropdown' || currField.fieldType === 'radio'){
|
||||
if(!currField.fieldOptions) $scope.myform.form_fields[field_index].fieldOptions = [];
|
||||
|
||||
|
@ -1430,7 +1432,7 @@ angular.module('forms').directive('editFormDirective', ['$rootScope', 'FormField
|
|||
var newOption = {
|
||||
'option_id' : Math.floor(100000*Math.random()),
|
||||
'option_title' : 'Option '+lastOptionID,
|
||||
'option_value' : 'Option ' +lastOptionID,
|
||||
'option_value' : 'Option ' +lastOptionID
|
||||
};
|
||||
|
||||
// put new option into fieldOptions array
|
||||
|
@ -1463,8 +1465,8 @@ angular.module('forms').directive('editFormDirective', ['$rootScope', 'FormField
|
|||
}
|
||||
};
|
||||
|
||||
}],
|
||||
|
||||
}]
|
||||
|
||||
};
|
||||
}
|
||||
]);
|
||||
|
@ -1520,7 +1522,7 @@ angular.module('forms').directive('editSubmissionsFormDirective', ['$rootScope',
|
|||
defaultFormFields = _.cloneDeep($scope.myform.form_fields);
|
||||
|
||||
// console.log('before textField2: '+data[0].form_fields[1].fieldValue);
|
||||
|
||||
|
||||
//Iterate through form's submissions
|
||||
for(var i=0; i<data.length; i++){
|
||||
for(var x=0; x<data[i].form_fields; x++){
|
||||
|
@ -1540,8 +1542,8 @@ angular.module('forms').directive('editSubmissionsFormDirective', ['$rootScope',
|
|||
})
|
||||
.error(function(err){
|
||||
console.error('Could not fetch form submissions.\nError: '+err);
|
||||
});
|
||||
};
|
||||
});
|
||||
};
|
||||
|
||||
//Delete selected submissions of Form
|
||||
$scope.deleteSelectedSubmissions = function(){
|
||||
|
@ -1550,7 +1552,7 @@ angular.module('forms').directive('editSubmissionsFormDirective', ['$rootScope',
|
|||
return !!row.selected;
|
||||
}).pluck('_id').value();
|
||||
|
||||
$http({ url: '/forms/'+$scope.myform._id+'/submissions',
|
||||
$http({ url: '/forms/'+$scope.myform._id+'/submissions',
|
||||
method: 'DELETE',
|
||||
data: {deleted_submissions: delete_ids},
|
||||
headers: {'Content-Type': 'application/json;charset=utf-8'}
|
||||
|
@ -1568,7 +1570,7 @@ angular.module('forms').directive('editSubmissionsFormDirective', ['$rootScope',
|
|||
console.log('Could not delete form submissions.\nError: ');
|
||||
console.log(err);
|
||||
console.error = err;
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
//Export selected submissions of Form
|
||||
|
@ -1576,7 +1578,7 @@ angular.module('forms').directive('editSubmissionsFormDirective', ['$rootScope',
|
|||
var fileMIMETypeMap = {
|
||||
'xls': 'vnd.openxmlformats-officedocument.spreadsheetml.sheet',
|
||||
'json': 'json',
|
||||
'csv': 'csv',
|
||||
'csv': 'csv'
|
||||
};
|
||||
|
||||
var blob = new Blob([document.getElementById('table-submission-data').innerHTM], {
|
||||
|
@ -1657,7 +1659,6 @@ angular.module('forms').directive('fieldDirective', ['$http', '$compile', '$root
|
|||
if (__indexOf.call(supported_fields, type) >= 0) {
|
||||
templateUrl = templateUrl+type+'.html';
|
||||
}
|
||||
|
||||
return $templateCache.get('../public/'+templateUrl);
|
||||
};
|
||||
|
||||
|
@ -1828,28 +1829,30 @@ angular.module('forms').directive('submitFormDirective', ['$http', 'TimeCounter'
|
|||
$scope.fieldBottom = elemBox.bottom;
|
||||
|
||||
//console.log($scope.forms.myForm);
|
||||
var field_id;
|
||||
var field_index;
|
||||
|
||||
if(!$scope.noscroll){
|
||||
//Focus on submit button
|
||||
if( $scope.selected.index === $scope.myform.form_fields.length-1 && $scope.fieldBottom < 200){
|
||||
var field_index = $scope.selected.index+1;
|
||||
var field_id = 'submit_field';
|
||||
field_index = $scope.selected.index+1;
|
||||
field_id = 'submit_field';
|
||||
$scope.setActiveField(field_id, field_index, false);
|
||||
}
|
||||
//Focus on field above submit button
|
||||
else if($scope.selected.index === $scope.myform.form_fields.length){
|
||||
if($scope.fieldTop > 200){
|
||||
var field_index = $scope.selected.index-1;
|
||||
var field_id = $scope.myform.form_fields[field_index]._id;
|
||||
field_index = $scope.selected.index-1;
|
||||
field_id = $scope.myform.form_fields[field_index]._id;
|
||||
$scope.setActiveField(field_id, field_index, false);
|
||||
}
|
||||
}else if( $scope.fieldBottom < 0){
|
||||
var field_index = $scope.selected.index+1;
|
||||
var field_id = $scope.myform.form_fields[field_index]._id;
|
||||
field_index = $scope.selected.index+1;
|
||||
field_id = $scope.myform.form_fields[field_index]._id;
|
||||
$scope.setActiveField(field_id, field_index, false);
|
||||
}else if ( $scope.selected.index !== 0 && $scope.fieldTop > 0) {
|
||||
var field_index = $scope.selected.index-1;
|
||||
var field_id = $scope.myform.form_fields[field_index]._id;
|
||||
field_index = $scope.selected.index-1;
|
||||
field_id = $scope.myform.form_fields[field_index]._id;
|
||||
$scope.setActiveField(field_id, field_index, false);
|
||||
}
|
||||
//console.log('$scope.selected.index: '+$scope.selected.index);
|
||||
|
@ -2546,7 +2549,7 @@ angular.module('users').factory('Auth', ['$window',
|
|||
$window.user = null;
|
||||
userState.isLoggedIn = false;
|
||||
service._currentUser = null;
|
||||
},
|
||||
}
|
||||
};
|
||||
return service;
|
||||
|
||||
|
@ -2617,7 +2620,7 @@ angular.module('users').factory('User', ['$window', '$q', '$timeout', '$http', '
|
|||
|
||||
return deferred.promise;
|
||||
},
|
||||
logout: function() {
|
||||
logout: function() {
|
||||
|
||||
var deferred = $q.defer();
|
||||
$http.get('/auth/signout').success(function(response) {
|
||||
|
@ -2628,7 +2631,7 @@ angular.module('users').factory('User', ['$window', '$q', '$timeout', '$http', '
|
|||
|
||||
return deferred.promise;
|
||||
},
|
||||
signup: function(credentials) {
|
||||
signup: function(credentials) {
|
||||
|
||||
var deferred = $q.defer();
|
||||
$http.post('/auth/signup', credentials).success(function(response) {
|
||||
|
@ -2641,7 +2644,7 @@ angular.module('users').factory('User', ['$window', '$q', '$timeout', '$http', '
|
|||
return deferred.promise;
|
||||
},
|
||||
|
||||
resendVerifyEmail: function(_email) {
|
||||
resendVerifyEmail: function(_email) {
|
||||
|
||||
var deferred = $q.defer();
|
||||
$http.post('/auth/verify', {email: _email}).success(function(response) {
|
||||
|
@ -2653,7 +2656,7 @@ angular.module('users').factory('User', ['$window', '$q', '$timeout', '$http', '
|
|||
return deferred.promise;
|
||||
},
|
||||
|
||||
validateVerifyToken: function(token) {
|
||||
validateVerifyToken: function(token) {
|
||||
|
||||
//DAVID: TODO: The valid length of a token should somehow be linked to server config values
|
||||
//DAVID: TODO: SEMI-URGENT: Should we even be doing this?
|
||||
|
@ -2695,12 +2698,12 @@ angular.module('users').factory('User', ['$window', '$q', '$timeout', '$http', '
|
|||
});
|
||||
|
||||
return deferred.promise;
|
||||
},
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
return userService;
|
||||
|
||||
|
||||
}
|
||||
]);
|
||||
|
||||
|
|
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
201
scripts/setup.js
Normal file
201
scripts/setup.js
Normal file
|
@ -0,0 +1,201 @@
|
|||
#!/usr/bin/env node
|
||||
|
||||
/**
|
||||
* Module dependencies.
|
||||
*/
|
||||
process.env.NODE_ENV = 'production';
|
||||
|
||||
var init = require('../config/init')(),
|
||||
config = require('../config/config'),
|
||||
mongoose = require('mongoose'),
|
||||
inquirer = require('inquirer'),
|
||||
envfile = require('envfile'),
|
||||
fs = require('fs-extra'),
|
||||
chalk = require('chalk');
|
||||
|
||||
/**
|
||||
* Main application entry file.
|
||||
* Please note that the order of loading is important.
|
||||
*/
|
||||
|
||||
// Bootstrap db connection
|
||||
var db = mongoose.connect(config.db.uri, config.db.options, function(err) {
|
||||
if (err) {
|
||||
console.error(chalk.red('Could not connect to MongoDB!'));
|
||||
console.log(chalk.red(err));
|
||||
}
|
||||
});
|
||||
mongoose.connection.on('error', function(err) {
|
||||
console.error(chalk.red('MongoDB connection error: ' + err));
|
||||
process.exit(-1);
|
||||
});
|
||||
|
||||
// Init the express application
|
||||
var app = require('../config/express')(db);
|
||||
|
||||
// Bootstrap passport config
|
||||
require('../config/passport')();
|
||||
|
||||
var User = mongoose.model('User');
|
||||
require('../app/models/user.server.model.js');
|
||||
|
||||
var nodemailer_providers = [
|
||||
'1und1',
|
||||
'AOL',
|
||||
'DebugMail.io',
|
||||
'DynectEmail',
|
||||
'FastMail',
|
||||
'GandiMail',
|
||||
'Gmail',
|
||||
'Godaddy',
|
||||
'GodaddyAsia',
|
||||
'GodaddyEurope',
|
||||
'hot.ee',
|
||||
'Hotmail',
|
||||
'iCloud',
|
||||
'mail.ee',
|
||||
'Mail.ru',
|
||||
'Mailgun',
|
||||
'Mailjet',
|
||||
'Mandrill',
|
||||
'Naver',
|
||||
'OpenMailBox',
|
||||
'Postmark',
|
||||
'QQ',
|
||||
'QQex',
|
||||
'SendCloud',
|
||||
'SendGrid',
|
||||
'SES',
|
||||
'SES-US-EAST-1',
|
||||
'SES-US-WEST-1',
|
||||
'SES-EU-WEST-1',
|
||||
'Sparkpost',
|
||||
'Yahoo',
|
||||
'Yandex',
|
||||
'Zoho'
|
||||
];
|
||||
|
||||
var questions = [
|
||||
{
|
||||
type: 'confirm',
|
||||
name: 'shouldContinue',
|
||||
message: 'Do you wish to configure your deployment now?'
|
||||
},
|
||||
{
|
||||
type: 'input',
|
||||
name: 'APP_NAME',
|
||||
message: 'What do you want to name your TellForm deployment?'
|
||||
},
|
||||
{
|
||||
type: 'input',
|
||||
name: 'APP_DESC',
|
||||
message: 'Describe your project (for SEO)'
|
||||
},
|
||||
{
|
||||
type: 'input',
|
||||
name: 'APP_KEYWORDS',
|
||||
message: 'What keywords are relevant to your project (seperate by commas)'
|
||||
},
|
||||
{
|
||||
type: 'confirm',
|
||||
name: 'SIGNUP_DISABLED',
|
||||
message: 'Do you want to disable signups?',
|
||||
default: false
|
||||
},
|
||||
{
|
||||
type: 'list',
|
||||
name: 'NODE_ENV',
|
||||
message: 'What should be the default environment',
|
||||
choices: ['dev','production']
|
||||
},
|
||||
{
|
||||
type: 'list',
|
||||
name: 'MAILER_SERVICE_PROVIDER',
|
||||
message: 'What email service provider are you using?',
|
||||
choices: nodemailer_providers
|
||||
},
|
||||
{
|
||||
type: 'input',
|
||||
name: 'MAILER_EMAIL_ID',
|
||||
message: 'What is your SMTP username?'
|
||||
},
|
||||
{
|
||||
type: 'password',
|
||||
name: 'MAILER_PASSWORD',
|
||||
message: 'What is your SMTP password?'
|
||||
},
|
||||
{
|
||||
type: 'input',
|
||||
name: 'MAILER_FROM',
|
||||
message: 'What do you want the default "from" email address to be?'
|
||||
},
|
||||
{
|
||||
type: 'input',
|
||||
name: 'BASE_URL',
|
||||
message: 'What is the url your TellForm will be hosted at?',
|
||||
default: '127.0.0.1'
|
||||
},
|
||||
{
|
||||
type: 'input',
|
||||
name: 'PORT',
|
||||
message: 'What port should the TellForm server run on?',
|
||||
default: '3000'
|
||||
},
|
||||
{
|
||||
type: 'input',
|
||||
name: 'GOOGLE_ANALYTICS_ID',
|
||||
message: 'What is your Google Analytics Tag?'
|
||||
},
|
||||
{
|
||||
type: 'input',
|
||||
name: 'email',
|
||||
message: 'What should be the email for your admin account?'
|
||||
},
|
||||
{
|
||||
type: 'password',
|
||||
name: 'password',
|
||||
message: 'What should be the password for your admin account?'
|
||||
}
|
||||
];
|
||||
|
||||
console.log(chalk.green('\n\nHi, welcome to TellForm Setup'));
|
||||
|
||||
console.log(chalk.green('This will only run the first time you run TellForm\n--------------------------------------------------\n\n'));
|
||||
|
||||
inquirer.prompt([questions[0]]).then(function (confirmAns) {
|
||||
if(confirmAns['shouldContinue']) {
|
||||
|
||||
inquirer.prompt(questions.slice(1)).then(function (answers) {
|
||||
|
||||
var email = answers['email'];
|
||||
var pass = answers['password'];
|
||||
delete answers['email'];
|
||||
delete answers['password'];
|
||||
|
||||
envfile.stringify(answers, function (err, str) {
|
||||
fs.outputFile('..//.env', str, function(err){
|
||||
if (err) return console.error(chalk.red(err));
|
||||
console.log(chalk.green('Successfully created .env file'));
|
||||
});
|
||||
user = new User({
|
||||
firstName: 'Admin',
|
||||
lastName: 'Account',
|
||||
email: email,
|
||||
username: email,
|
||||
password: pass,
|
||||
provider: 'local',
|
||||
roles: ['admin', 'user']
|
||||
});
|
||||
|
||||
user.save(function (err) {
|
||||
if (err) return console.error(chalk.red(err));
|
||||
console.log(chalk.green('Succesfully created user'));
|
||||
delete email;
|
||||
delete pass;
|
||||
});
|
||||
});
|
||||
});
|
||||
} else {
|
||||
console.log(chalk.green('Have fun using TellForm!'));
|
||||
}
|
||||
});
|
Loading…
Reference in a new issue