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: {
|
provider: {
|
||||||
type: String,
|
type: String,
|
||||||
required: 'Provider is required'
|
required: 'Provider is required',
|
||||||
|
default: 'local'
|
||||||
},
|
},
|
||||||
providerData: {},
|
providerData: {},
|
||||||
additionalProvidersData: {},
|
additionalProvidersData: {},
|
||||||
|
|
10
config/env/all.js
vendored
10
config/env/all.js
vendored
|
@ -3,9 +3,9 @@
|
||||||
module.exports = {
|
module.exports = {
|
||||||
app: {
|
app: {
|
||||||
google_analytics_id: process.env.GOOGLE_ANALYTICS_ID || '',
|
google_analytics_id: process.env.GOOGLE_ANALYTICS_ID || '',
|
||||||
title: 'TellForm',
|
title: process.env.APP_NAME || 'TellForm',
|
||||||
description: 'Opensource form builder alternative to TypeForm',
|
description: process.env.APP_DESC || 'Opensource form builder alternative to TypeForm',
|
||||||
keywords: 'typeform, pdfs, forms, opensource, formbuilder, google forms, nodejs',
|
keywords: process.env.APP_KEYWORDS || 'typeform, pdfs, forms, opensource, formbuilder, google forms, nodejs'
|
||||||
},
|
},
|
||||||
port: process.env.PORT || 3000,
|
port: process.env.PORT || 3000,
|
||||||
templateEngine: 'swig',
|
templateEngine: 'swig',
|
||||||
|
@ -16,7 +16,7 @@ module.exports = {
|
||||||
|
|
||||||
mailosaur: {
|
mailosaur: {
|
||||||
key: process.env.MAILOSAUR_KEY || '',
|
key: process.env.MAILOSAUR_KEY || '',
|
||||||
mailbox_id: process.env.MAILOSAUR_MAILBOX || '',
|
mailbox_id: process.env.MAILOSAUR_MAILBOX || ''
|
||||||
},
|
},
|
||||||
|
|
||||||
//Sentry DSN Client Key
|
//Sentry DSN Client Key
|
||||||
|
@ -38,7 +38,7 @@ module.exports = {
|
||||||
secure: false,
|
secure: false,
|
||||||
// Only set the maxAge to null if the cookie shouldn't be expired
|
// Only set the maxAge to null if the cookie shouldn't be expired
|
||||||
// at all. The cookie will expunge when the browser is closed.
|
// 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
|
// To set the cookie in a specific domain uncomment the following
|
||||||
// setting:
|
// setting:
|
||||||
// domain: 'tellform.com'
|
// domain: 'tellform.com'
|
||||||
|
|
3
config/env/development.js
vendored
3
config/env/development.js
vendored
|
@ -18,9 +18,6 @@ module.exports = {
|
||||||
// stream: 'access.log'
|
// stream: 'access.log'
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
app: {
|
|
||||||
title: 'TellForm'
|
|
||||||
},
|
|
||||||
sessionCookie: {
|
sessionCookie: {
|
||||||
domain: process.env.BASE_URL || 'http://localhost:3000'
|
domain: process.env.BASE_URL || 'http://localhost:3000'
|
||||||
},
|
},
|
||||||
|
|
191
gruntfile.js
191
gruntfile.js
|
@ -1,4 +1,6 @@
|
||||||
'use strict';
|
'use strict';
|
||||||
|
var spawn = require('child_process').spawn;
|
||||||
|
|
||||||
|
|
||||||
module.exports = function(grunt) {
|
module.exports = function(grunt) {
|
||||||
require('jit-grunt')(grunt);
|
require('jit-grunt')(grunt);
|
||||||
|
@ -69,81 +71,81 @@ module.exports = function(grunt) {
|
||||||
options: {
|
options: {
|
||||||
jshintrc: true
|
jshintrc: true
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
allTests: {
|
allTests: {
|
||||||
src: watchFiles.allTests,
|
src: watchFiles.allTests,
|
||||||
options: {
|
options: {
|
||||||
jshintrc: true
|
jshintrc: true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
csslint: {
|
csslint: {
|
||||||
options: {
|
options: {
|
||||||
csslintrc: '.csslintrc'
|
csslintrc: '.csslintrc'
|
||||||
},
|
},
|
||||||
all: {
|
all: {
|
||||||
src: watchFiles.clientCSS
|
src: watchFiles.clientCSS
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
uglify: {
|
uglify: {
|
||||||
production: {
|
production: {
|
||||||
options: {
|
options: {
|
||||||
mangle: false
|
mangle: false
|
||||||
},
|
},
|
||||||
files: {
|
files: {
|
||||||
'public/dist/application.min.js': 'public/dist/application.js'
|
'public/dist/application.min.js': 'public/dist/application.js'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
cssmin: {
|
cssmin: {
|
||||||
combine: {
|
combine: {
|
||||||
files: {
|
files: {
|
||||||
'public/dist/application.min.css': '<%= applicationCSSFiles %>'
|
'public/dist/application.min.css': '<%= applicationCSSFiles %>'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
nodemon: {
|
nodemon: {
|
||||||
dev: {
|
dev: {
|
||||||
script: 'server.js',
|
script: 'server.js',
|
||||||
options: {
|
options: {
|
||||||
nodeArgs: ['--debug'],
|
nodeArgs: ['--debug'],
|
||||||
ext: 'js,html',
|
ext: 'js,html',
|
||||||
watch: watchFiles.serverViews.concat(watchFiles.serverJS)
|
watch: watchFiles.serverViews.concat(watchFiles.serverJS)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
'node-inspector': {
|
'node-inspector': {
|
||||||
custom: {
|
custom: {
|
||||||
options: {
|
options: {
|
||||||
'web-port': 1337,
|
'web-port': 1337,
|
||||||
'web-host': 'localhost',
|
'web-host': 'localhost',
|
||||||
'debug-port': 5858,
|
'debug-port': 5858,
|
||||||
'save-live-edit': true,
|
'save-live-edit': true,
|
||||||
'no-preload': true,
|
'no-preload': true,
|
||||||
'stack-trace-limit': 50,
|
'stack-trace-limit': 50,
|
||||||
'hidden': []
|
'hidden': []
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
ngAnnotate: {
|
ngAnnotate: {
|
||||||
production: {
|
production: {
|
||||||
files: {
|
files: {
|
||||||
'public/dist/application.js': '<%= applicationJavaScriptFiles %>'
|
'public/dist/application.js': '<%= applicationJavaScriptFiles %>'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
concurrent: {
|
concurrent: {
|
||||||
default: ['nodemon', 'watch'],
|
default: ['nodemon', 'watch'],
|
||||||
debug: ['nodemon', 'watch', 'node-inspector'],
|
debug: ['nodemon', 'watch', 'node-inspector'],
|
||||||
options: {
|
options: {
|
||||||
logConcurrentOutput: true,
|
logConcurrentOutput: true,
|
||||||
limit: 10
|
limit: 10
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
env: {
|
env: {
|
||||||
test: {
|
test: {
|
||||||
NODE_ENV: 'test',
|
NODE_ENV: 'test',
|
||||||
src: '.env'
|
src: '.env'
|
||||||
},
|
},
|
||||||
secure: {
|
secure: {
|
||||||
NODE_ENV: 'secure',
|
NODE_ENV: 'secure',
|
||||||
|
@ -156,7 +158,7 @@ NODE_ENV: 'test',
|
||||||
dev: {
|
dev: {
|
||||||
NODE_ENV: 'development',
|
NODE_ENV: 'development',
|
||||||
src: '.env'
|
src: '.env'
|
||||||
},
|
}
|
||||||
},
|
},
|
||||||
mochaTest: {
|
mochaTest: {
|
||||||
src: watchFiles.serverTests,
|
src: watchFiles.serverTests,
|
||||||
|
@ -230,26 +232,31 @@ NODE_ENV: 'test',
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
html2js: {
|
html2js: {
|
||||||
options: {
|
options: {
|
||||||
base: 'NodeForm',
|
base: 'NodeForm',
|
||||||
watch: true,
|
watch: true,
|
||||||
module: 'NodeForm.templates',
|
module: 'NodeForm.templates',
|
||||||
singleModule: true,
|
singleModule: true,
|
||||||
useStrict: true,
|
useStrict: true,
|
||||||
htmlmin: {
|
htmlmin: {
|
||||||
collapseBooleanAttributes: true,
|
collapseBooleanAttributes: true,
|
||||||
collapseWhitespace: true,
|
collapseWhitespace: true,
|
||||||
removeAttributeQuotes: true,
|
removeAttributeQuotes: true,
|
||||||
removeComments: true,
|
removeComments: true,
|
||||||
removeEmptyAttributes: true,
|
removeEmptyAttributes: true,
|
||||||
removeRedundantAttributes: true
|
removeRedundantAttributes: true
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
main: {
|
main: {
|
||||||
src: ['public/modules/**/views/**.html', 'public/modules/**/views/**/*.html'],
|
src: ['public/modules/**/views/**.html', 'public/modules/**/views/**/*.html'],
|
||||||
dest: 'public/dist/populate_template_cache.js'
|
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);
|
grunt.config.set('applicationCSSFiles', config.assets.css);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
// Code coverage tasks.
|
// Code coverage tasks.
|
||||||
grunt.registerTask('coveralls', ['env:test','mocha_istanbul:coveralls']);
|
grunt.registerTask('coveralls', ['env:test','mocha_istanbul:coveralls']);
|
||||||
grunt.registerTask('coverage', ['env:test', 'mocha_istanbul:coverage']);
|
grunt.registerTask('coverage', ['env:test', 'mocha_istanbul:coverage']);
|
||||||
|
@ -288,9 +294,11 @@ NODE_ENV: 'test',
|
||||||
// Default task(s).
|
// Default task(s).
|
||||||
grunt.registerTask('default', ['lint', 'html2js:main', 'env', 'concurrent:default']);
|
grunt.registerTask('default', ['lint', 'html2js:main', 'env', 'concurrent:default']);
|
||||||
grunt.registerTask('dev', ['lint', 'html2js:main', 'env:dev', 'concurrent:default']);
|
grunt.registerTask('dev', ['lint', 'html2js:main', 'env:dev', 'concurrent:default']);
|
||||||
|
|
||||||
// Debug task.
|
// Debug task.
|
||||||
grunt.registerTask('debug', ['lint', 'html2js:main', 'concurrent:debug']);
|
grunt.registerTask('debug', ['lint', 'html2js:main', 'concurrent:debug']);
|
||||||
|
|
||||||
|
|
||||||
// Secure task(s).
|
// Secure task(s).
|
||||||
grunt.registerTask('secure', ['env:secure', 'lint', 'html2js:main', 'concurrent:default']);
|
grunt.registerTask('secure', ['env:secure', 'lint', 'html2js:main', 'concurrent:default']);
|
||||||
|
|
||||||
|
@ -301,6 +309,9 @@ NODE_ENV: 'test',
|
||||||
// Build task(s).
|
// Build task(s).
|
||||||
grunt.registerTask('build', ['lint', 'loadConfig', 'cssmin', 'ngAnnotate', 'uglify', 'html2js:main']);
|
grunt.registerTask('build', ['lint', 'loadConfig', 'cssmin', 'ngAnnotate', 'uglify', 'html2js:main']);
|
||||||
|
|
||||||
|
//Setup task(s).
|
||||||
|
grunt.registerTask('setup', ['execute']);
|
||||||
|
|
||||||
// Test task(s).
|
// Test task(s).
|
||||||
grunt.registerTask('test', ['lint:tests', 'test:server', 'test:client']);
|
grunt.registerTask('test', ['lint:tests', 'test:server', 'test:client']);
|
||||||
grunt.registerTask('test:server', ['lint:tests', 'env:test', 'mochaTest']);
|
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",
|
"async": "^1.4.2",
|
||||||
"body-parser": "~1.14.1",
|
"body-parser": "~1.14.1",
|
||||||
"bower": "~1.6.5",
|
"bower": "~1.6.5",
|
||||||
"chalk": "~1.1.1",
|
"chalk": "^1.1.3",
|
||||||
"compression": "~1.6.0",
|
"compression": "~1.6.0",
|
||||||
"connect-flash": "~0.1.1",
|
"connect-flash": "~0.1.1",
|
||||||
"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",
|
||||||
"email-verification": "whitef0x0/node-email-verification",
|
"email-verification": "whitef0x0/node-email-verification",
|
||||||
|
"envfile": "^2.0.1",
|
||||||
"express": "~4.13.3",
|
"express": "~4.13.3",
|
||||||
"express-device": "~0.4.2",
|
"express-device": "~0.4.2",
|
||||||
"express-session": "~1.12.1",
|
"express-session": "~1.12.1",
|
||||||
|
@ -53,6 +54,7 @@
|
||||||
"grunt-node-inspector": "~0.4.1",
|
"grunt-node-inspector": "~0.4.1",
|
||||||
"grunt-nodemon": "~0.4.0",
|
"grunt-nodemon": "~0.4.0",
|
||||||
"helmet": "~0.14.0",
|
"helmet": "~0.14.0",
|
||||||
|
"inquirer": "^1.0.2",
|
||||||
"jit-grunt": "^0.9.1",
|
"jit-grunt": "^0.9.1",
|
||||||
"lodash": "^2.4.1",
|
"lodash": "^2.4.1",
|
||||||
"main-bower-files": "~2.9.0",
|
"main-bower-files": "~2.9.0",
|
||||||
|
@ -83,6 +85,7 @@
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"coveralls": "^2.11.4",
|
"coveralls": "^2.11.4",
|
||||||
"glob": "^7.0.3",
|
"glob": "^7.0.3",
|
||||||
|
"grunt-execute": "^0.2.2",
|
||||||
"grunt-mocha-istanbul": "^3.0.1",
|
"grunt-mocha-istanbul": "^3.0.1",
|
||||||
"grunt-mocha-test": "~0.12.1",
|
"grunt-mocha-test": "~0.12.1",
|
||||||
"istanbul": "^0.4.0",
|
"istanbul": "^0.4.0",
|
||||||
|
|
47
public/dist/application.js
vendored
47
public/dist/application.js
vendored
|
@ -525,7 +525,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) {
|
||||||
|
@ -681,6 +681,7 @@ angular.module('core').service('Menus', [
|
||||||
this.addMenu('bottombar', false, ['*']);
|
this.addMenu('bottombar', false, ['*']);
|
||||||
}
|
}
|
||||||
]);
|
]);
|
||||||
|
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
// Configuring the Forms drop-down menus
|
// Configuring the Forms drop-down menus
|
||||||
|
@ -797,15 +798,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'
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
|
|
||||||
|
@ -895,7 +896,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);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -904,6 +905,7 @@ angular.module('forms').controller('AdminFormController', ['$rootScope', '$scope
|
||||||
|
|
||||||
}
|
}
|
||||||
]);
|
]);
|
||||||
|
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
// Forms controller
|
// Forms controller
|
||||||
|
@ -1237,7 +1239,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;
|
||||||
|
|
||||||
|
@ -1261,7 +1263,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: ["$scope", function($scope){
|
controller: ["$scope", function($scope){
|
||||||
var field_ids = _($scope.myform.form_fields).pluck('_id');
|
var field_ids = _($scope.myform.form_fields).pluck('_id');
|
||||||
|
@ -1314,7 +1316,7 @@ angular.module('forms').directive('editFormDirective', ['$rootScope', 'FormField
|
||||||
$scope.dropzone = {
|
$scope.dropzone = {
|
||||||
handle: ' .handle',
|
handle: ' .handle',
|
||||||
containment: '.dropzoneContainer',
|
containment: '.dropzoneContainer',
|
||||||
cursor: 'grabbing',
|
cursor: 'grabbing'
|
||||||
};
|
};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -1430,7 +1432,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
|
||||||
|
@ -1463,7 +1465,7 @@ angular.module('forms').directive('editFormDirective', ['$rootScope', 'FormField
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
}],
|
}]
|
||||||
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -1576,7 +1578,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], {
|
||||||
|
@ -1657,7 +1659,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);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -1828,28 +1829,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);
|
||||||
|
@ -2546,7 +2549,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;
|
||||||
|
|
||||||
|
@ -2695,7 +2698,7 @@ angular.module('users').factory('User', ['$window', '$q', '$timeout', '$http', '
|
||||||
});
|
});
|
||||||
|
|
||||||
return deferred.promise;
|
return deferred.promise;
|
||||||
},
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
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