increased request entity size
This commit is contained in:
commit
f4854e078a
2
.gitignore
vendored
2
.gitignore
vendored
|
@ -1,8 +1,10 @@
|
|||
.vagrant
|
||||
npm-debug.*
|
||||
docs/Oscar_Credentials.md
|
||||
scripts/test_oscarhost.js
|
||||
scripts/oscarhost/private/
|
||||
coverage/
|
||||
e2e_coverage/
|
||||
uploads/
|
||||
app/e2e_tests/screeshots/*
|
||||
tmp
|
||||
|
|
101
Dockerfile
101
Dockerfile
|
@ -1,74 +1,65 @@
|
|||
# Build:
|
||||
# docker build -t meanjs/mean .
|
||||
# docker build -t tellform -f ./Dockerfile .
|
||||
#
|
||||
# Run:
|
||||
# docker run -it meanjs/mean
|
||||
#
|
||||
# Compose:
|
||||
# docker-compose up -d
|
||||
|
||||
FROM ubuntu:latest
|
||||
# docker run -it tellform
|
||||
FROM phusion/baseimage:0.9.19
|
||||
MAINTAINER David Baldwynn <team@tellform.com>
|
||||
|
||||
WORKDIR ~/Documents/tellform
|
||||
# 3000 = TellForm server, 35729 = livereload, 8080 = node-inspector
|
||||
EXPOSE 3000 35729 8080
|
||||
|
||||
# Set development environment as default
|
||||
ENV NODE_ENV development
|
||||
ENV BASE_URL tellform.dev
|
||||
ENV PORT 3000
|
||||
|
||||
# Install Utilities
|
||||
RUN apt-get update -q
|
||||
RUN apt-get install -yqq python wget aptitude htop vim git traceroute dnsutils curl ssh sudo tree tcpdump nano psmisc gcc make build-essential libfreetype6 libfontconfig libkrb5-dev
|
||||
RUN apt-get update -q \
|
||||
&& apt-get install -yqq \
|
||||
curl \
|
||||
git \
|
||||
gcc \
|
||||
make \
|
||||
build-essential \
|
||||
libkrb5-dev \
|
||||
python \
|
||||
sudo \
|
||||
apt-utils \
|
||||
&& apt-get clean \
|
||||
&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
|
||||
|
||||
ENV python /usr/bin/python
|
||||
|
||||
# Install gem sass for grunt-contrib-sass
|
||||
RUN apt-get install -y ruby
|
||||
RUN gem install sass
|
||||
|
||||
# Install NodeJS
|
||||
RUN curl -sL https://deb.nodesource.com/setup_4.x | sudo -E bash -
|
||||
RUN sudo apt-get install -yq nodejs
|
||||
# Install nodejs
|
||||
RUN curl -sL https://deb.nodesource.com/setup_6.x | sudo -E bash -
|
||||
RUN sudo apt-get install -yq nodejs \
|
||||
&& apt-get clean \
|
||||
&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
|
||||
|
||||
# Install MEAN.JS Prerequisites
|
||||
RUN npm install --quiet -g grunt-cli gulp bower mocha karma-cli pm2
|
||||
RUN npm install --quiet -g grunt bower && npm cache clean
|
||||
|
||||
RUN mkdir /opt/mean.js
|
||||
RUN mkdir -p /opt/mean.js/public/lib
|
||||
WORKDIR /opt/mean.js
|
||||
RUN mkdir -p /opt/tellform/public/lib
|
||||
WORKDIR /opt/tellform
|
||||
|
||||
# Copies the local package.json file to the container
|
||||
# and utilities docker container cache to not needing to rebuild
|
||||
# and install node_modules/ everytime we build the docker, but only
|
||||
# when the local package.json file changes.
|
||||
# Install npm packages
|
||||
ADD package.json /opt/mean.js/package.json
|
||||
RUN npm install --quiet
|
||||
# Add npm package.json
|
||||
COPY package.json /opt/tellform/package.json
|
||||
RUN npm install --production
|
||||
RUN mv ./node_modules ./node_modules.tmp && mv ./node_modules.tmp ./node_modules && npm install
|
||||
|
||||
# Install bower packages
|
||||
ADD bower.json /opt/mean.js/bower.json
|
||||
ADD .bowerrc /opt/mean.js/.bowerrc
|
||||
RUN bower install --quiet --allow-root --config.interactive=false
|
||||
# Add bower.json
|
||||
COPY bower.json /opt/tellform/bower.json
|
||||
COPY .bowerrc /opt/tellform/.bowerrc
|
||||
|
||||
# Share local directory on the docker container
|
||||
ADD . /opt/mean.js
|
||||
|
||||
# Machine cleanup
|
||||
RUN npm cache clean
|
||||
RUN apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
|
||||
|
||||
# Set development environment as default
|
||||
ENV NODE_ENV development
|
||||
|
||||
# Ports generic
|
||||
EXPOSE 80:80
|
||||
EXPOSE 443:443
|
||||
|
||||
# Port 3000 for MEAN.JS server
|
||||
EXPOSE 3000:3000
|
||||
|
||||
# Port 5858 for node debug
|
||||
EXPOSE 5858:5858
|
||||
|
||||
# Port 35729 for livereload
|
||||
EXPOSE 35729:35729
|
||||
|
||||
# Run MEAN.JS server
|
||||
CMD ["npm", "start"]
|
||||
COPY ./app /opt/tellform/app
|
||||
COPY ./public /opt/tellform/public
|
||||
COPY ./config /opt/tellform/config
|
||||
COPY ./gruntfile.js /opt/tellform/gruntfile.js
|
||||
COPY ./server.js /opt/tellform/server.js
|
||||
COPY ./.env /opt/tellform/.env
|
||||
|
||||
# Run TellForm server
|
||||
CMD npm start
|
||||
|
|
68
Dockerfile-production
Normal file
68
Dockerfile-production
Normal file
|
@ -0,0 +1,68 @@
|
|||
# Build:
|
||||
# docker build -t tellform-prod -f ./Dockerfile-production .
|
||||
#
|
||||
# Run:
|
||||
# docker run -it tellform-prod
|
||||
|
||||
FROM phusion/baseimage:0.9.19
|
||||
MAINTAINER David Baldwynn <team@tellform.com>
|
||||
|
||||
# 4545 = TellForm server
|
||||
EXPOSE 4545
|
||||
|
||||
# Set development environment as default
|
||||
ENV NODE_ENV production
|
||||
ENV PORT 4545
|
||||
ENV BASE_URL tellform.com
|
||||
|
||||
# Install Utilities
|
||||
RUN apt-get update -q \
|
||||
&& apt-get install -yqq \
|
||||
curl \
|
||||
git \
|
||||
gcc \
|
||||
make \
|
||||
build-essential \
|
||||
libkrb5-dev \
|
||||
python \
|
||||
sudo \
|
||||
apt-utils \
|
||||
&& apt-get clean \
|
||||
&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
|
||||
|
||||
# Install nodejs
|
||||
RUN curl -sL https://deb.nodesource.com/setup_6.x | sudo -E bash -
|
||||
RUN sudo apt-get install -yq nodejs \
|
||||
&& apt-get clean \
|
||||
&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
|
||||
|
||||
# Install MEAN.JS Prerequisites
|
||||
RUN npm install --quiet -g grunt bower pm2 && npm cache clean
|
||||
|
||||
RUN mkdir -p /opt/tellform/public/lib
|
||||
WORKDIR /opt/tellform
|
||||
|
||||
# Copies the local package.json file to the container
|
||||
# and utilities docker container cache to not needing to rebuild
|
||||
# and install node_modules/ everytime we build the docker, but only
|
||||
# when the local package.json file changes.
|
||||
# Add npm package.json
|
||||
COPY package.json /opt/tellform/package.json
|
||||
RUN npm install --production
|
||||
RUN mv ./node_modules ./node_modules.tmp && mv ./node_modules.tmp ./node_modules && npm install
|
||||
|
||||
# Add bower.json
|
||||
COPY bower.json /opt/tellform/bower.json
|
||||
COPY .bowerrc /opt/tellform/.bowerrc
|
||||
|
||||
COPY ./app /opt/tellform/app
|
||||
COPY ./public /opt/tellform/public
|
||||
COPY ./config /opt/tellform/config
|
||||
COPY ./gruntfile.js /opt/tellform/gruntfile.js
|
||||
COPY ./server.js /opt/tellform/server.js
|
||||
COPY ./.env /opt/tellform/.env
|
||||
|
||||
RUN grunt build
|
||||
|
||||
# Run TellForm server
|
||||
CMD ["pm2-docker","process.yml"]
|
|
@ -1,6 +1,5 @@
|
|||
Include the following information with your issue:
|
||||
|
||||
1) Nodemailer version you are having problems with (eg. v1.3.0)
|
||||
2) Node.js version you are using (run node -v to see it, eg v5.5.0)
|
||||
1) Node.js version you are using (run node -v to see it, eg v5.5.0)
|
||||
3) Your operating system (eg. Windows 10, Ubuntu 14.04 etc.)
|
||||
4) If possible, include a minimal test case that can be used to verify your issue (link to a gist would be great!)
|
||||
|
|
15
README.md
15
README.md
|
@ -81,6 +81,8 @@ BASE_URL=yourdomain.com
|
|||
DSN_KEY=yourPrivateRavenKey
|
||||
```
|
||||
|
||||
##___Important Note___: Make sure your BASE_URL matches the domain of your server or TellForm won't work!
|
||||
|
||||
Side note: ___Currently we are using Raven and Sentry [https://www.getsentry.com](https://www.getsentry.com) for error logging. To use it you must provide a valid private DSN key in your .env file and a public DSN key in app/views/layout.index.html___
|
||||
|
||||
Edit the `env` config in gruntfile.js to make sure your .env file is being used. If you don't include this your app won't run
|
||||
|
@ -97,6 +99,17 @@ Set ```NODE_ENV=production``` in .env file
|
|||
|
||||
Your application should run on port 3000 or the port you specified in your .env file, so in your browser just go to [http://localhost:3000](http://localhost:3000)
|
||||
|
||||
##Deploying with Docker
|
||||
|
||||
To deploy with docker, first install docker [https://docs.docker.com/engine/installation/](here).
|
||||
|
||||
Then run these commands
|
||||
|
||||
```
|
||||
$ docker run -p 27017:27017 -d --name some-mongo mongo
|
||||
$ docker run -p 6379:6379 -d --name some-redis redis
|
||||
$ docker run --rm -p 3000:3000 --link some-redis:redis-db --link some-mongo:db tellform/development
|
||||
```
|
||||
|
||||
## Testing Your Application
|
||||
You can run the full test suite included with MEAN.JS with the test task:
|
||||
|
@ -166,5 +179,7 @@ $ grunt coverage:client
|
|||
|
||||
[Betapage](https://betapage.co/startup/tellform)
|
||||
|
||||
[Opensource.com](http://opensource.com/article/17/2/tools-online-surveys-polls)
|
||||
|
||||
## Credits
|
||||
Inspired/built off the great work of the [MeanJS team](https://github.com/meanjs/) and [Typeform](http://typeform.com)
|
||||
|
|
23
Vagrantfile
vendored
Normal file
23
Vagrantfile
vendored
Normal file
|
@ -0,0 +1,23 @@
|
|||
# -*- mode: ruby -*-
|
||||
# vi: set ft=ruby :
|
||||
|
||||
# All Vagrant configuration is done below. The "2" in Vagrant.configure
|
||||
# configures the configuration version (we support older styles for
|
||||
# backwards compatibility). Please don't change it unless you know what
|
||||
# you're doing.
|
||||
Vagrant.configure("2") do |config|
|
||||
|
||||
# Every Vagrant development environment requires a box. You can search for
|
||||
# boxes at https://atlas.hashicorp.com/search.
|
||||
config.vm.box = "ubuntu/trusty64"
|
||||
config.vm.network :forwarded_port, guest: 3000, host: 4567
|
||||
|
||||
config.vm.provision "docker" do |d|
|
||||
d.run "mongo",
|
||||
args: "-p 27017:27017 -d --name some-mongo"
|
||||
d.run "redis",
|
||||
args: "-p 6379:6379 -d --name some-redis"
|
||||
d.run "tellform/development",
|
||||
args: "-p 3000:3000 --link some-redis:redis-db --link some-mongo:db"
|
||||
end
|
||||
end
|
|
@ -48,12 +48,17 @@ exports.deleteSubmissions = function(req, res) {
|
|||
exports.createSubmission = function(req, res) {
|
||||
var form = req.form;
|
||||
|
||||
var timeElapsed = 0;
|
||||
|
||||
if(typeof req.body.timeElapsed == "number"){
|
||||
timeElapsed = req.body.timeElapsed;
|
||||
}
|
||||
var submission = new FormSubmission({
|
||||
admin: req.form.admin._id,
|
||||
form: req.form._id,
|
||||
title: req.form.title,
|
||||
form_fields: req.body.form_fields,
|
||||
timeElapsed: req.body.timeElapsed,
|
||||
timeElapsed: timeElapsed,
|
||||
percentageComplete: req.body.percentageComplete
|
||||
});
|
||||
|
||||
|
@ -116,7 +121,6 @@ exports.listSubmissions = function(req, res) {
|
|||
exports.create = function(req, res) {
|
||||
|
||||
if(!req.body.form){
|
||||
console.log(err);
|
||||
return res.status(400).send({
|
||||
message: "Invalid Input"
|
||||
});
|
||||
|
|
|
@ -182,7 +182,7 @@ var FormSchema = new Schema({
|
|||
}
|
||||
},
|
||||
font: String
|
||||
}
|
||||
},
|
||||
}, formSchemaOptions);
|
||||
|
||||
/*
|
||||
|
@ -283,6 +283,29 @@ function getDeletedIndexes(needle, haystack){
|
|||
return deletedIndexes;
|
||||
}
|
||||
|
||||
|
||||
FormSchema.pre('save', function (next) {
|
||||
var that = this;
|
||||
switch(this.language){
|
||||
case 'spanish':
|
||||
this.language = 'es';
|
||||
break;
|
||||
case 'french':
|
||||
this.language = 'fr';
|
||||
break;
|
||||
case 'italian':
|
||||
this.language = 'it';
|
||||
break;
|
||||
case 'german':
|
||||
this.language = 'de';
|
||||
break;
|
||||
default:
|
||||
this.language = 'en';
|
||||
break;
|
||||
}
|
||||
next();
|
||||
});
|
||||
|
||||
FormSchema.pre('save', function (next) {
|
||||
var that = this;
|
||||
|
||||
|
|
|
@ -195,7 +195,7 @@ FormFieldSchema.pre('validate', function(next) {
|
|||
//LogicJump Save
|
||||
FormFieldSchema.pre('save', function(next) {
|
||||
if(this.logicJump && this.logicJump.fieldA) {
|
||||
if(this.logicJump.jumpTo = '') delete this.logicJump.jumpTo;
|
||||
if(this.logicJump.jumpTo === '') delete this.logicJump.jumpTo;
|
||||
}
|
||||
next();
|
||||
});
|
||||
|
|
2
config/env/all.js
vendored
2
config/env/all.js
vendored
|
@ -8,7 +8,7 @@ module.exports = {
|
|||
keywords: process.env.APP_KEYWORDS || 'typeform, pdfs, forms, opensource, formbuilder, google forms, nodejs'
|
||||
},
|
||||
db: {
|
||||
uri: 'mongodb://'+(process.env.DB_HOST || 'localhost')+'/mean',
|
||||
uri: 'mongodb://'+ (process.env.DB_PORT_27017_TCP_ADDR || process.env.DB_HOST || 'localhost')+'/mean',
|
||||
options: {
|
||||
user: '',
|
||||
pass: ''
|
||||
|
|
2
config/env/development.js
vendored
2
config/env/development.js
vendored
|
@ -3,7 +3,7 @@
|
|||
module.exports = {
|
||||
baseUrl: process.env.BASE_URL || 'http://localhost:5000',
|
||||
db: {
|
||||
uri: 'mongodb://'+(process.env.DB_HOST || 'localhost')+'/mean',
|
||||
uri: 'mongodb://'+( process.env.DB_PORT_27017_TCP_ADDR || process.env.DB_HOST || 'localhost') +'/mean',
|
||||
options: {
|
||||
user: '',
|
||||
pass: ''
|
||||
|
|
|
@ -190,9 +190,10 @@ module.exports = function(db) {
|
|||
|
||||
// Request body parsing middleware should be above methodOverride
|
||||
app.use(bodyParser.urlencoded({
|
||||
extended: true
|
||||
extended: true,
|
||||
limit: '100mb'
|
||||
}));
|
||||
app.use(bodyParser.json());
|
||||
app.use(bodyParser.json({ limit: '100mb' }));
|
||||
app.use(methodOverride());
|
||||
|
||||
// Use helmet to secure Express headers
|
||||
|
|
|
@ -12,7 +12,7 @@ module.exports = function (app, db) {
|
|||
|
||||
var io = socketio(config.socketPort, { transports: ['websocket', 'polling'] });
|
||||
var redis = require('socket.io-redis');
|
||||
io.adapter(redis(process.env.REDIS_URL || { host: '127.0.0.1', port: 6379 }));
|
||||
io.adapter(redis( process.env.REDIS_URL || { host: process.env.REDIS_DB_PORT_6379_TCP_ADDR || '127.0.0.1' , port: process.env.REDIS_DB_PORT_6379_TCP_PORT || 6379 }));
|
||||
|
||||
// Add an event listener to the 'connection' event
|
||||
io.on('connection', function (socket) {
|
||||
|
|
|
@ -7,7 +7,7 @@ $ cp /usr/local/opt/dnsmasq/dnsmasq.conf.example /usr/local/etc/dnsmasq.conf
|
|||
```
|
||||
- edit `/usr/local/etc/dnsmasq.conf`
|
||||
```
|
||||
address=/local/127.0.0.1
|
||||
address=/dev/127.0.0.1
|
||||
```
|
||||
- start **dnsmasq**
|
||||
```
|
||||
|
@ -18,12 +18,12 @@ $ sudo brew services start dnsmasq
|
|||
$ sudo launchctl stop homebrew.mxcl.dnsmasq
|
||||
$ sudo launchctl start homebrew.mxcl.dnsmasq
|
||||
```
|
||||
- For OS X to _resolve_ requests from `*.local` to **localhost** we need to add a _resolver_:
|
||||
- For OS X to _resolve_ requests from `*.dev` to **localhost** we need to add a _resolver_:
|
||||
```
|
||||
$ sudo mkdir /etc/resolver
|
||||
$ sudo touch /etc/resolver/local
|
||||
$ sudo touch /etc/resolver/dev
|
||||
```
|
||||
- edit `/etc/resolver/local`
|
||||
- edit `/etc/resolver/dev`
|
||||
```
|
||||
nameserver 127.0.0.1
|
||||
```
|
||||
|
|
|
@ -1,9 +0,0 @@
|
|||
|
||||
version: '2'
|
||||
services:
|
||||
web:
|
||||
environment:
|
||||
- MAILER_SERVICE_PROVIDER=Gmail
|
||||
- MAILER_EMAIL_ID=test@example.com
|
||||
- MAILER_PASSWORD=password
|
||||
- HOST=http://localhost:3000
|
|
@ -1,24 +0,0 @@
|
|||
web:
|
||||
restart: always
|
||||
build: .
|
||||
container_name: tellform
|
||||
command: npm start
|
||||
links:
|
||||
- db
|
||||
ports:
|
||||
- "3000:3000"
|
||||
- "5858:5858"
|
||||
- "35729:35729"
|
||||
environment:
|
||||
- NODE_ENV=development
|
||||
volumes:
|
||||
- ./:/opt/mean.js
|
||||
- /opt/mean.js/node_modules
|
||||
- /opt/mean.js/public
|
||||
- /opt/mean.js/uploads
|
||||
db:
|
||||
image: mongo:3.2
|
||||
container_name: db_1
|
||||
restart: always
|
||||
ports:
|
||||
- "27017:27017"
|
|
@ -30,18 +30,5 @@
|
|||
"NODE_ENV": "production",
|
||||
"BASE_URL": "admin.tellform.com"
|
||||
}
|
||||
},
|
||||
"kmc" : {
|
||||
"user" : "polydaic",
|
||||
"host" : "159.203.2.71",
|
||||
"ref" : "origin/master",
|
||||
"repo" : "git@github.com:whitef0x0/tellform.git",
|
||||
"path" : "/opt/deploy",
|
||||
"post-deploy" : "npm install && bower install && pm2 startOrRestart ecosystem.json --env production",
|
||||
"env" : {
|
||||
"NODE_ENV": "production",
|
||||
"BASE_URL": "kmc.tellform.com"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -7,13 +7,12 @@ module.exports = function(grunt) {
|
|||
|
||||
// Unified Watch Object
|
||||
var watchFiles = {
|
||||
|
||||
serverViews: ['app/views/**/*.*'],
|
||||
serverJS: ['gruntfile.js', 'server.js', 'config/**/*.js', 'app/**/*.js', '!app/tests/'],
|
||||
|
||||
clientViews: ['public/modules/**/views/**/*.html', '!public/modules/**/demo/**/*.html', '!public/modules/**/dist/**/*.html', '!public/modules/**/node_modules/**/*.html'],
|
||||
clientJS: ['public/js/*.js', 'public/form_modules/**/*.js', 'public/modules/**/*.js', '!public/modules/**/gruntfile.js', '!public/modules/**/demo/**/*.js', '!public/modules/**/dist/**/*.js', '!public/modules/**/node_modules/**/*.js'],
|
||||
clientCSS: ['public/modules/**/*.css', 'public/form_modules/**/*.css', '!public/modules/**/demo/**/*.css', '!public/modules/**/dist/**/*.css', '!public/modules/**/node_modules/**/*.css'],
|
||||
clientViews: ['public/modules/**/views/**.html'],
|
||||
clientJS: ['public/js/*.js', 'public/form_modules/**/*.js', 'public/modules/**/*.js'],
|
||||
clientCSS: ['public/modules/**/*.css', 'public/form_modules/**/*.css', '!public/modules/**/demo/**/*.css', '!public/modules/**/dist/**/*.css'],
|
||||
|
||||
serverTests: ['app/tests/**/*.js'],
|
||||
clientTests: ['public/modules/**/tests/*.js', '!public/modules/**/demo/**/*.js', '!public/modules/**/dist/**/*.js', '!public/modules/**/node_modules/**/*.js']
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
},
|
||||
"scripts": {
|
||||
"start": "grunt",
|
||||
"test": "grunt test && grunt coveralls",
|
||||
"test": "grunt test",
|
||||
"postinstall": "bower install --config.interactive=false; grunt build;",
|
||||
"init": "node scripts/setup.js"
|
||||
},
|
||||
|
|
5
process.yml
Normal file
5
process.yml
Normal file
|
@ -0,0 +1,5 @@
|
|||
apps:
|
||||
- script : 'server.js'
|
||||
name : 'TellForm'
|
||||
exec_mode: 'cluster'
|
||||
instances: 4
|
51
public/dist/application.js
vendored
51
public/dist/application.js
vendored
|
@ -219,10 +219,10 @@ angular.module('forms').config(['$translateProvider', function ($translateProvid
|
|||
//Admin Form View
|
||||
ARE_YOU_SURE: 'Are you ABSOLUTELY sure?',
|
||||
READ_WARNING: 'Unexpected bad things will happen if you don’t read this!',
|
||||
DELETE_WARNING1: 'This action CANNOT be undone.This will permanently delete the',
|
||||
DELETE_WARNING2: 'form, form submissions and remove all associated pdfs.',
|
||||
DELETE_CONFIRM: 'Please type in the name of the form to confirm',
|
||||
I_UNDERSTAND: 'I understand the consequences, delete this form',
|
||||
DELETE_WARNING1: 'This action CANNOT be undone. This will permanently delete the "',
|
||||
DELETE_WARNING2: '" form and remove all associated form submissions.',
|
||||
DELETE_CONFIRM: 'Please type in the name of the form to confirm.',
|
||||
I_UNDERSTAND: 'I understand the consequences, delete this form.',
|
||||
DELETE_FORM_SM: 'Delete',
|
||||
DELETE_FORM_MD: 'Delete Form',
|
||||
DELETE: 'Delete',
|
||||
|
@ -1862,8 +1862,8 @@ angular.module('forms').controller('AdminFormController', ['$rootScope', '$scope
|
|||
'use strict';
|
||||
|
||||
// Forms controller
|
||||
angular.module('forms').controller('ListFormsController', ['$rootScope', '$scope', '$stateParams', '$state', 'Forms', 'CurrentForm', '$http',
|
||||
function($rootScope, $scope, $stateParams, $state, Forms, CurrentForm, $http) {
|
||||
angular.module('forms').controller('ListFormsController', ['$rootScope', '$scope', '$stateParams', '$state', 'Forms', 'CurrentForm', '$http', '$uibModal',
|
||||
function($rootScope, $scope, $stateParams, $state, Forms, CurrentForm, $http, $uibModal) {
|
||||
|
||||
$scope = $rootScope;
|
||||
$scope.forms = {};
|
||||
|
@ -1876,6 +1876,41 @@ angular.module('forms').controller('ListFormsController', ['$rootScope', '$scope
|
|||
}
|
||||
};
|
||||
|
||||
/*
|
||||
** DeleteModal Functions
|
||||
*/
|
||||
$scope.openDeleteModal = function(index){
|
||||
$scope.deleteModal = $uibModal.open({
|
||||
animation: $scope.animationsEnabled,
|
||||
templateUrl: 'deleteModalListForms.html',
|
||||
controller: ["$uibModalInstance", "items", "$scope", function($uibModalInstance, items, $scope) {
|
||||
$scope.content = items;
|
||||
|
||||
$scope.cancel = $scope.cancelDeleteModal;
|
||||
|
||||
$scope.deleteForm = function() {
|
||||
$scope.removeForm(items.formIndex);
|
||||
|
||||
}
|
||||
}],
|
||||
resolve: {
|
||||
items: function() {
|
||||
return {
|
||||
currFormTitle: $scope.myforms[index].title,
|
||||
formIndex: index
|
||||
};
|
||||
}
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
$scope.cancelDeleteModal = function(){
|
||||
if($scope.deleteModal){
|
||||
$scope.deleteModal.dismiss('cancel');
|
||||
}
|
||||
};
|
||||
|
||||
// Return all user's Forms
|
||||
$scope.findAll = function() {
|
||||
Forms.query(function(_forms){
|
||||
|
@ -1947,6 +1982,7 @@ angular.module('forms').controller('ListFormsController', ['$rootScope', '$scope
|
|||
.success(function(data, status, headers){
|
||||
//console.log('form deleted successfully');
|
||||
$scope.myforms.splice(form_index, 1);
|
||||
$scope.cancelDeleteModal();
|
||||
}).error(function(error){
|
||||
//console.log('ERROR: Form could not be deleted.');
|
||||
console.error(error);
|
||||
|
@ -2484,9 +2520,6 @@ angular.module('forms').directive('editSubmissionsFormDirective', ['$rootScope',
|
|||
var totalTime = 0;
|
||||
var numSubmissions = $scope.table.rows.length;
|
||||
|
||||
console.log("AverageTimeElapsed");
|
||||
console.log($scope.table.rows);
|
||||
|
||||
for(var i=0; i<$scope.table.rows.length; i++){
|
||||
totalTime += $scope.table.rows[i].timeElapsed;
|
||||
}
|
||||
|
|
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
|
@ -26,10 +26,10 @@ angular.module('forms').config(['$translateProvider', function ($translateProvid
|
|||
//Admin Form View
|
||||
ARE_YOU_SURE: 'Are you ABSOLUTELY sure?',
|
||||
READ_WARNING: 'Unexpected bad things will happen if you don’t read this!',
|
||||
DELETE_WARNING1: 'This action CANNOT be undone.This will permanently delete the',
|
||||
DELETE_WARNING2: 'form, form submissions and remove all associated pdfs.',
|
||||
DELETE_CONFIRM: 'Please type in the name of the form to confirm',
|
||||
I_UNDERSTAND: 'I understand the consequences, delete this form',
|
||||
DELETE_WARNING1: 'This action CANNOT be undone. This will permanently delete the "',
|
||||
DELETE_WARNING2: '" form and remove all associated form submissions.',
|
||||
DELETE_CONFIRM: 'Please type in the name of the form to confirm.',
|
||||
I_UNDERSTAND: 'I understand the consequences, delete this form.',
|
||||
DELETE_FORM_SM: 'Delete',
|
||||
DELETE_FORM_MD: 'Delete Form',
|
||||
DELETE: 'Delete',
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
'use strict';
|
||||
|
||||
// Forms controller
|
||||
angular.module('forms').controller('ListFormsController', ['$rootScope', '$scope', '$stateParams', '$state', 'Forms', 'CurrentForm', '$http',
|
||||
function($rootScope, $scope, $stateParams, $state, Forms, CurrentForm, $http) {
|
||||
angular.module('forms').controller('ListFormsController', ['$rootScope', '$scope', '$stateParams', '$state', 'Forms', 'CurrentForm', '$http', '$uibModal',
|
||||
function($rootScope, $scope, $stateParams, $state, Forms, CurrentForm, $http, $uibModal) {
|
||||
|
||||
$scope = $rootScope;
|
||||
$scope.forms = {};
|
||||
|
@ -15,6 +15,41 @@ angular.module('forms').controller('ListFormsController', ['$rootScope', '$scope
|
|||
}
|
||||
};
|
||||
|
||||
/*
|
||||
** DeleteModal Functions
|
||||
*/
|
||||
$scope.openDeleteModal = function(index){
|
||||
$scope.deleteModal = $uibModal.open({
|
||||
animation: $scope.animationsEnabled,
|
||||
templateUrl: 'deleteModalListForms.html',
|
||||
controller: function($uibModalInstance, items, $scope) {
|
||||
$scope.content = items;
|
||||
|
||||
$scope.cancel = $scope.cancelDeleteModal;
|
||||
|
||||
$scope.deleteForm = function() {
|
||||
$scope.removeForm(items.formIndex);
|
||||
|
||||
}
|
||||
},
|
||||
resolve: {
|
||||
items: function() {
|
||||
return {
|
||||
currFormTitle: $scope.myforms[index].title,
|
||||
formIndex: index
|
||||
};
|
||||
}
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
$scope.cancelDeleteModal = function(){
|
||||
if($scope.deleteModal){
|
||||
$scope.deleteModal.dismiss('cancel');
|
||||
}
|
||||
};
|
||||
|
||||
// Return all user's Forms
|
||||
$scope.findAll = function() {
|
||||
Forms.query(function(_forms){
|
||||
|
@ -86,6 +121,7 @@ angular.module('forms').controller('ListFormsController', ['$rootScope', '$scope
|
|||
.success(function(data, status, headers){
|
||||
//console.log('form deleted successfully');
|
||||
$scope.myforms.splice(form_index, 1);
|
||||
$scope.cancelDeleteModal();
|
||||
}).error(function(error){
|
||||
//console.log('ERROR: Form could not be deleted.');
|
||||
console.error(error);
|
||||
|
|
|
@ -49,9 +49,6 @@ angular.module('forms').directive('editSubmissionsFormDirective', ['$rootScope',
|
|||
var totalTime = 0;
|
||||
var numSubmissions = $scope.table.rows.length;
|
||||
|
||||
console.log("AverageTimeElapsed");
|
||||
console.log($scope.table.rows);
|
||||
|
||||
for(var i=0; i<$scope.table.rows.length; i++){
|
||||
totalTime += $scope.table.rows[i].timeElapsed;
|
||||
}
|
||||
|
|
|
@ -20,9 +20,7 @@
|
|||
<p>{{ 'DELETE_CONFIRM' | translate }}</p>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<p>
|
||||
<input type="text" data-ng-model="deleteConfirm" class="input-block" autofocus required aria-label="Type in the name of the form to confirm that you want to delete this form.">
|
||||
</p>
|
||||
<input type="text" style="width:100%" data-ng-model="deleteConfirm" class="input-block" autofocus required aria-label="Type in the name of the form to confirm that you want to delete this form.">
|
||||
<button type="submit" ng-click="removeCurrentForm()" class="btn btn-block btn-danger" ng-disabled="myform.title != deleteConfirm">
|
||||
{{ 'I_UNDERSTAND' | translate }}
|
||||
</button>
|
||||
|
@ -53,11 +51,6 @@
|
|||
</span>
|
||||
<span ng-hide="myform.isLive">{{ 'PREVIEW' | translate }}</span>
|
||||
</span>
|
||||
<!--<span class="hidden-xs hidden-md hidden-lg">-->
|
||||
<!--View-->
|
||||
<!--<span ng-if="myform.isLive">{{ 'LIVE' | translate }}</span>-->
|
||||
<!--<span ng-if="!myform.isLive">{{ 'PREVIEW' | translate }}</span>-->
|
||||
<!--</span>-->
|
||||
<i class="status-light status-light-on fa fa-dot-circle-o" ng-if="myform.isLive"></i>
|
||||
<i class="status-light status-light-off fa fa-dot-circle-o" ng-if="!myform.isLive"></i>
|
||||
</a>
|
||||
|
|
|
@ -2,6 +2,29 @@
|
|||
|
||||
<section class="overlay" ng-if="showCreateModal" ng-click="closeCreateModal()"></section>
|
||||
|
||||
<!-- Modal Delete Dialog Template -->
|
||||
<script type="text/ng-template" id="deleteModalListForms.html">
|
||||
<div class="modal-header">
|
||||
<h2 class="modal-title hidden-md hidden-lg">{{ 'ARE_YOU_SURE' | translate }}</h2>
|
||||
<h3 class="modal-title hidden-xs hidden-sm">{{ 'ARE_YOU_SURE' | translate }}</h3>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<div class="modal-body-alert">
|
||||
{{ 'READ_WARNING' | translate }}
|
||||
</div>
|
||||
<p class="hidden-xs hidden-sm">
|
||||
{{ 'DELETE_WARNING1' | translate }} <strong>{{content.currFormTitle}}</strong> {{ 'DELETE_WARNING2' | translate }}
|
||||
</p>
|
||||
<p>{{ 'DELETE_CONFIRM' | translate }}</p>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<input type="text" style="width:100%" data-ng-model="deleteConfirm" class="input-block" autofocus required aria-label="Type in the name of the form to confirm that you want to delete this form.">
|
||||
<button type="submit" ng-click="deleteForm" class="btn btn-block btn-danger" ng-disabled="content.currFormTitle != deleteConfirm">
|
||||
{{ 'I_UNDERSTAND' | translate }}
|
||||
</button>
|
||||
</div>
|
||||
</script>
|
||||
|
||||
<section data-ng-controller="ListFormsController as ctrl" data-ng-init="findAll()" class="container">
|
||||
<br>
|
||||
<div class="row">
|
||||
|
@ -59,14 +82,14 @@
|
|||
|
||||
<div class="row">
|
||||
<span class="pull-right">
|
||||
<i style="cursor:pointer;" class="fa fa-trash-o" ng-click="removeForm($index)"></i>
|
||||
<i style="cursor:pointer;" class="fa fa-trash-o" ng-click="openDeleteModal($index)"></i>
|
||||
<i style="cursor:pointer;" class="fa fa-files-o" ng-click="duplicateForm($index)"></i>
|
||||
</span>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<a data-ng-href="#!/forms/{{form._id}}/admin/create"
|
||||
class="title-row col-xs-12">
|
||||
class="title-row col-xs-12" style="color: white;">
|
||||
<h4 class="list-group-item-heading" data-ng-bind="form.title"></h4>
|
||||
</a>
|
||||
<div class="col-xs-12 responses-row">
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
<section class="auth sigin-view valign-wrapper" data-ng-controller="AuthenticationController">
|
||||
<!--<h3 class="col-md-12 text-center">{{ 'SIGNIN_HEADER_TEXT' | translate }}</h3>-->
|
||||
<!-- <div class="col-md-12 text-center">
|
||||
<!--
|
||||
<div class="col-md-12 text-center">
|
||||
<a href="/auth/facebook" class="undecorated-link">
|
||||
<img src="/modules/users/img/buttons/facebook.png">
|
||||
</a>
|
||||
|
@ -16,7 +17,8 @@
|
|||
<a href="/auth/github" class="undecorated-link">
|
||||
<img src="/modules/users/img/buttons/github.png">
|
||||
</a>
|
||||
</div> -->
|
||||
</div>
|
||||
-->
|
||||
<!-- <h3 class="col-md-12 text-center">Or with your account</h3> -->
|
||||
|
||||
<div class="row valign">
|
||||
|
|
|
@ -46,7 +46,6 @@ exports = module.exports = app;
|
|||
|
||||
// Logging initialization
|
||||
console.log('--');
|
||||
console.log(chalk.green(config.app.title + ' application started'));
|
||||
console.log(chalk.green('Environment:\t\t\t' + process.env.NODE_ENV));
|
||||
console.log(chalk.green('Port:\t\t\t\t' + config.port));
|
||||
console.log(chalk.green('Database:\t\t\t' + config.db.uri));
|
||||
|
|
Loading…
Reference in a new issue