Compare commits
76 commits
improvedAd
...
master
Author | SHA1 | Date | |
---|---|---|---|
d5c94ce67f | |||
6e32ace806 | |||
a6d61ebf35 | |||
98385954dc | |||
4900d13a47 | |||
210c7544e7 | |||
a9e04b4894 | |||
d07063f636 | |||
643954896b | |||
77cabf15e5 | |||
b3bf791d3c | |||
c3153ed514 | |||
e29742f83a | |||
a24f90ce91 | |||
4eae4de2ce | |||
39c656c41e | |||
15a6324a90 | |||
17b428b304 | |||
81e66f0025 | |||
b1917c9fdd | |||
6453716c99 | |||
639ba9fdb8 | |||
1a9e847741 | |||
995e6aa41c | |||
d7f0cc8127 | |||
e8afc9e7e6 | |||
ad35ae9215 | |||
5bc0d623a5 | |||
13d9bd9ece | |||
19c85f9845 | |||
188705b640 | |||
386b6be968 | |||
d9ef557edd | |||
52a1ab2bff | |||
80beec8ad2 | |||
3b0dee9ea3 | |||
01ac456f62 | |||
9715088e86 | |||
0f2cf42ceb | |||
65fd117b04 | |||
985c3c1aae | |||
808439cf47 | |||
eaab2ff339 | |||
f99049d155 | |||
8c4e519fbe | |||
9a9c1ae02e | |||
2835280ff3 | |||
7afc7eef87 | |||
45f8fe7a02 | |||
623cb865c2 | |||
d6e48544a4 | |||
ca875ed01d | |||
33b0fc02c4 | |||
83ca05e64b | |||
78082f7152 | |||
e2ff321ec8 | |||
38b3618f8b | |||
f5dc78b6d7 | |||
f384f5fee4 | |||
3421c92eab | |||
f47a8d41ae | |||
53fa777ce0 | |||
e725aa1ea3 | |||
c63e905c25 | |||
ee2c59805e | |||
a0092baf31 | |||
b6f5c5f897 | |||
66765278d2 | |||
1ace06555c | |||
4086219189 | |||
7357756625 | |||
ff24843e3a | |||
4447785a56 | |||
341ce5a88f | |||
ed662281cd | |||
13c3263667 |
3
.bowerrc
3
.bowerrc
|
@ -1,4 +1,5 @@
|
|||
{
|
||||
"directory": "public/lib",
|
||||
"analytics": false
|
||||
"analytics": false,
|
||||
"registry": "https://registry.bower.io"
|
||||
}
|
||||
|
|
124
.env.example
Normal file
124
.env.example
Normal file
|
@ -0,0 +1,124 @@
|
|||
# TellForm Configuration File
|
||||
|
||||
###################################
|
||||
# Common configuration variables
|
||||
###################################
|
||||
|
||||
# Set this to the path where Mailu data and configuration is stored
|
||||
# Mac users: Change to a Docker accessible folder
|
||||
ROOT=/opt/tellform_data
|
||||
|
||||
# Set to what environment you will be running TellForm in (production or development)
|
||||
NODE_ENV=development
|
||||
|
||||
# Set to a randomly generated 16 bytes string
|
||||
SECRET_KEY=ChangeMeChangeMe
|
||||
|
||||
# URI of Mongo database that TellForm will connect to
|
||||
#DO NOT CHANGE
|
||||
MONGODB_URI=mongodb://mongo/tellform
|
||||
|
||||
# URL Redis server that TellForm will connect to
|
||||
#DO NOT CHANGE
|
||||
REDIS_URL=redis://redis:6379
|
||||
|
||||
# Port that the TellForm Node app will listen on
|
||||
PORT=5000
|
||||
|
||||
# Domain that TellForm's admin panel will be hosted at
|
||||
BASE_URL=tellform.dev
|
||||
|
||||
# Port that SocketIO server (for analytics) will listen on
|
||||
SOCKET_PORT=20523
|
||||
|
||||
#Choose what kind of TLS you want.
|
||||
#Can be either 'cert' (supply your certificates in ./cert/), 'notls' (no https at all) or 'letsencrypt' that autoconfigures your instance with letsencrypt
|
||||
TLS_FLAVOR=notls
|
||||
|
||||
###################################
|
||||
# Optional features
|
||||
###################################
|
||||
|
||||
# Set this to enable coveralls.io support
|
||||
COVERALLS_REPO_TOKEN=
|
||||
|
||||
# Disable signups for your TellForm instance
|
||||
SIGNUP_DISABLED=FALSE
|
||||
|
||||
# Disable per-user custom subdomains
|
||||
SUBDOMAINS_DISABLED=FALSE
|
||||
|
||||
# Url that subdomains will be hosted at (has to have domain name as ADMIN_URL)
|
||||
# Only used when SUBDOMAINS_DISABLED=FALSE
|
||||
SUBDOMAIN_URL=*.tellform.dev
|
||||
|
||||
# Enable running TellForm in pm2's 'cluster' mode
|
||||
ENABLE_CLUSTER_MODE=FALSE
|
||||
|
||||
###################################
|
||||
# Mail settings
|
||||
# IMPORTANT: These settings need to be set
|
||||
# to be set in order for your instance to work
|
||||
###################################
|
||||
|
||||
|
||||
|
||||
# Set this to set the username credential of your SMTP service
|
||||
MAILER_EMAIL_ID=
|
||||
|
||||
# Set this to set the password credential of your SMTP service
|
||||
MAILER_PASSWORD=
|
||||
|
||||
# Set this to set the email address that all email should be sent from for signup/verification emails
|
||||
MAILER_FROM=
|
||||
|
||||
# Set this to any services from https://nodemailer.com/smtp/well-known/ to use a 'well-known' email provider
|
||||
MAILER_SERVICE_PROVIDER=
|
||||
|
||||
# Set these if you are not using a 'MAILER_SERVICE_PROVIDER' and want to specify your SMTP server's address and port
|
||||
MAILER_SMTP_HOST=
|
||||
MAILER_SMTP_PORT=
|
||||
|
||||
# Set this if you are using a custom SMTP server that supports SSL
|
||||
MAILER_SMTP_SECURE
|
||||
|
||||
###################################
|
||||
# Automatic Admin Creation Settings
|
||||
###################################
|
||||
|
||||
# Set this to "TRUE" if you wish to automatically create an admin user on startup
|
||||
CREATE_ADMIN=FALSE
|
||||
|
||||
# Set this to set the email used by your default admin account
|
||||
ADMIN_EMAIL=admin@admin.com
|
||||
|
||||
# Set this to set the username of your default admin acconut
|
||||
ADMIN_USERNAME=root
|
||||
|
||||
# Set this to set the password of your default admin account
|
||||
ADMIN_PASSWORD=root
|
||||
|
||||
###################################
|
||||
# Advanced settings
|
||||
###################################
|
||||
|
||||
# Set this to server your websockets server on a seperate URL
|
||||
SOCKETS_URL=
|
||||
|
||||
# Set this to change the port that TellForm will listen on
|
||||
PORT=5000
|
||||
|
||||
# Set this to your Google Analytics ID to enable tracking with GA
|
||||
GOOGLE_ANALYTICS_ID=
|
||||
|
||||
# Set this to your Sentry.io DSN code to enable front-end JS error tracking with Sentry.io
|
||||
RAVEN_DSN
|
||||
|
||||
# Set this to set the 'name' meta property in the HTML <head>
|
||||
APP_NAME=
|
||||
|
||||
# Set this to set the 'keywords' meta property in the HTML <head>
|
||||
APP_KEYWORDS=
|
||||
|
||||
# Set this to set the 'description' meta property in the HTML head
|
||||
APP_DESC=
|
3
.gitignore
vendored
3
.gitignore
vendored
|
@ -1,3 +1,4 @@
|
|||
data/
|
||||
dist
|
||||
.vagrant
|
||||
npm-debug.*
|
||||
|
@ -21,7 +22,7 @@ Oscar_Credentials.*
|
|||
npm-debug.log
|
||||
node_modules/
|
||||
public/lib/
|
||||
public/dist/
|
||||
public/dist
|
||||
app/tests/coverage/
|
||||
.bower-*/
|
||||
.idea/
|
||||
|
|
|
@ -11,9 +11,5 @@ services:
|
|||
addons:
|
||||
code_climate:
|
||||
repo_token: 6c3a1b81a09b2338d6f30913c1bcad115026689752cbb499a0a25061cda6fbcf
|
||||
install:
|
||||
- npm install phantomjs
|
||||
- npm install -g grunt
|
||||
- npm install
|
||||
script:
|
||||
- yarn run travis
|
||||
after_script:
|
||||
- grunt coverage
|
||||
|
|
66
Dockerfile
66
Dockerfile
|
@ -4,33 +4,16 @@
|
|||
# Run:
|
||||
# docker run -it tellform-prod
|
||||
|
||||
FROM phusion/baseimage:0.9.19
|
||||
MAINTAINER David Baldwynn <team@tellform.com>
|
||||
FROM node:10-alpine
|
||||
MAINTAINER Arielle Baldwynn <team@tellform.com>
|
||||
|
||||
# Install Utilities
|
||||
RUN apt-get update -q \
|
||||
&& apt-get install -yqq \
|
||||
curl \
|
||||
ant \
|
||||
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 some needed packages
|
||||
RUN apk add --no-cache \
|
||||
git \
|
||||
&& rm -rf /tmp/*
|
||||
|
||||
# Install NPM Global Libraries
|
||||
RUN npm install --quiet -g grunt bower pm2 && npm cache clean
|
||||
RUN npm install --quiet -g grunt bower pm2 && npm cache clean --force
|
||||
|
||||
WORKDIR /opt/tellform
|
||||
RUN mkdir -p /opt/tellform/public/lib
|
||||
|
@ -47,6 +30,39 @@ COPY ./gruntfile.js /opt/tellform/gruntfile.js
|
|||
COPY ./server.js /opt/tellform/server.js
|
||||
COPY ./scripts/create_admin.js /opt/tellform/scripts/create_admin.js
|
||||
|
||||
# Set default ENV
|
||||
ENV NODE_ENV=development
|
||||
ENV SECRET_KEY=ChangeMeChangeMe
|
||||
#ENV MONGODB_URI=mongodb://mongo/tellform
|
||||
#ENV REDIS_URL=redis://redis:6379
|
||||
ENV PORT=5000
|
||||
ENV BASE_URL=localhost
|
||||
ENV SOCKET_PORT=20523
|
||||
ENV SIGNUP_DISABLED=FALSE
|
||||
ENV SUBDOMAINS_DISABLED=FALSE
|
||||
ENV ENABLE_CLUSTER_MODE=FALSE
|
||||
ENV MAILER_EMAIL_ID=tellform@localhost
|
||||
ENV MAILER_PASSWORD=
|
||||
ENV MAILER_FROM=tellform@localhost
|
||||
ENV MAILER_SERVICE_PROVIDER=
|
||||
ENV MAILER_SMTP_HOST=
|
||||
ENV MAILER_SMTP_PORT=
|
||||
ENV MAILER_SMTP_SECURE=
|
||||
|
||||
ENV CREATE_ADMIN=FALSE
|
||||
ENV ADMIN_EMAIL=admin@tellform.com
|
||||
ENV ADMIN_USERNAME=root
|
||||
ENV ADMIN_PASSWORD=root
|
||||
|
||||
ENV APP_NAME=Tellform
|
||||
ENV APP_KEYWORDS=
|
||||
ENV APP_DESC=
|
||||
|
||||
# optional ENV settings
|
||||
ENV COVERALLS_REPO_TOKEN=
|
||||
ENV GOOGLE_ANALYTICS_ID=
|
||||
ENV RAVEN_DSN=
|
||||
|
||||
# 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
|
||||
|
@ -54,6 +70,8 @@ COPY ./scripts/create_admin.js /opt/tellform/scripts/create_admin.js
|
|||
# Add npm package.json
|
||||
COPY ./package.json /opt/tellform/package.json
|
||||
RUN npm install --only=production --quiet
|
||||
RUN bower install --allow-root
|
||||
RUN grunt build
|
||||
|
||||
# Run TellForm server
|
||||
CMD ["node", "server.js"]
|
||||
|
|
|
@ -10,56 +10,7 @@ TellForm Installation Instructions
|
|||
|
||||
## Local deployment with Docker
|
||||
|
||||
### Prerequisites
|
||||
|
||||
Make you sure have the following packages and versions on your machine:
|
||||
```
|
||||
"node": ">=6.11.2"
|
||||
"npm": ">=3.3.6"
|
||||
"bower": ">=1.8.0"
|
||||
"grunt-cli": ">=1.2.0"
|
||||
"grunt": ">=0.4.5"
|
||||
"docker": ">=17.06.0-ce"
|
||||
"docker-compose": ">=1.14.0"
|
||||
```
|
||||
|
||||
### Install dependencies
|
||||
|
||||
```
|
||||
$ npm install
|
||||
```
|
||||
|
||||
### Prepare .env file:
|
||||
Create `.env` file at project root folder. Fill in `MAILER_SERVICE_PROVIDER`, `MAILER_EMAIL_ID`, `MAILER_PASSWORD` and `MAILER_FROM`.
|
||||
```
|
||||
APP_NAME=TellForm
|
||||
BASE_URL=localhost:3000
|
||||
PORT=3000
|
||||
DB_PORT_27017_TCP_ADDR=tellform-mongo
|
||||
REDIS_DB_PORT_6379_TCP_ADDR=tellform-redis
|
||||
MAILER_SERVICE_PROVIDER=<TO-FILL-IN>
|
||||
MAILER_EMAIL_ID=<TO-FILL-IN>
|
||||
MAILER_PASSWORD=<TO-FILL-IN>
|
||||
MAILER_FROM=<TO-FILL-IN>
|
||||
SIGNUP_DISABLED=false
|
||||
SUBDOMAINS_DISABLED=true
|
||||
DISABLE_CLUSTER_MODE=true
|
||||
```
|
||||
|
||||
### Build docker image
|
||||
|
||||
```
|
||||
$ docker-compose build
|
||||
```
|
||||
|
||||
### Run docker containers with docker-compose
|
||||
|
||||
Create and start mongo & redis docker container:
|
||||
```
|
||||
$ docker-compose up
|
||||
```
|
||||
|
||||
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)
|
||||
Refer to [docker_files](https://github.com/tellform/docker_files).
|
||||
|
||||
## AWS AMI Deployment
|
||||
|
||||
|
|
113
README.md
113
README.md
|
@ -1,17 +1,34 @@
|
|||
TellForm 2.1.0
|
||||
========
|
||||
|
||||
DEPRECATION WARNING UNTIL FURTHER NOTICE.
|
||||
There are many oudated and vulnerable dependencies within this project and I recommend that you use this code repository for internal testing and development only.
|
||||
|
||||
There were too many impassable hurdles to really continue forward at the pace that I was hoping with TellForm @leopere~ If you want to follow my progress on an alternative in the mean time check out https://OhMyForm.com or our Discord server. We managed to get the base Docker image fixed before forking the code so you can give this a try however not much has changed at the moment.
|
||||
<!--
|
||||
[![Code Shelter](https://www.codeshelter.co/static/badges/badge-flat.svg)](https://www.codeshelter.co/)
|
||||
[![Build Status](https://travis-ci.org/tellform/tellform.svg?branch=master)](https://travis-ci.org/tellform/tellform)
|
||||
![Project Status](https://img.shields.io/badge/status-2.1.0-green.svg)
|
||||
[![Codacy Badge](https://api.codacy.com/project/badge/Grade/3491e86eb7194308b8fc80711d736ede)](https://www.codacy.com/app/david-baldwin/tellform?utm_source=github.com&utm_medium=referral&utm_content=tellform/tellform&utm_campaign=Badge_Grade)
|
||||
[![Gitter](https://badges.gitter.im/tellform/Lobby.svg)](https://gitter.im/tellform/Lobby?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge)
|
||||
-->
|
||||
|
||||
> An *opensource alternative to TypeForm* that can create [stunning mobile-ready forms](https://tellform.com/examples) , surveys and questionnaires.
|
||||
To Join the fork's community please follow this Discord button here.
|
||||
|
||||
![Discord](https://img.shields.io/discord/595773457862492190.svg?label=Discord%20Chat)
|
||||
|
||||
## Readme and Issues
|
||||
The README.md is still effectively in tact however it's all been commented out so that it's no longer visible on the main github repository page. You may visit it by navigating through the repositories files themselves.
|
||||
|
||||
No new or old issues will be tended to so the Issues Board has been closed. We don't recommend using this repositories codebase as its no longer maintained and is only intended for reference code. If you wish to use the fork which should remain backwards compatible feel free to explore [https://ohmyform.com](https://ohmyform.com/) or its GitHub repository at [https://github.com/ohmyform/ohmyform/](https://github.com/ohmyform/ohmyform/) where the code base is started from TellForm we are planning on keeping it reverse compatible however the code is Sublicensed AGPL and is going to have a stable release prepared for the public hopefully but September 12th 2019. It should be a drop in replacement for TellForm which should expand on the vision of TellForm but hopefully bring it all up to date.
|
||||
|
||||
<!--
|
||||
> An *opensource alternative to TypeForm* that can create [stunning mobile-ready forms](https://tellform.com/examples) , surveys and questionnaires.-->
|
||||
|
||||
<!--
|
||||
[![Deploy](https://www.herokucdn.com/deploy/button.svg)](https://heroku.com/deploy?template=https://github.com/tellform/tellform/tree/master)
|
||||
|
||||
-->
|
||||
<!--
|
||||
## Table of Contents
|
||||
|
||||
- [Features](#features)
|
||||
- [How to Contribute](#how-to-contribute)
|
||||
- [Quickstart](#quickstart)
|
||||
|
@ -23,11 +40,8 @@ TellForm 2.1.0
|
|||
- [Backers](#backers)
|
||||
- [Contributors](#contributors)
|
||||
- [Mentions on the Web](#mentions-on-the-web)
|
||||
|
||||
## Features
|
||||
|
||||
### Currently following features are implemented:
|
||||
|
||||
- Multi-Language Support
|
||||
- 11 possible question types
|
||||
- Editable start and end pages
|
||||
|
@ -37,7 +51,6 @@ TellForm 2.1.0
|
|||
- Embeddable Forms
|
||||
- Forms as a Service API
|
||||
- Deployable with Heroku and DockerHub
|
||||
|
||||
### On the Roadmap for v3.0.0
|
||||
- Implement encryption for all form data
|
||||
- Add Typeform API integration
|
||||
|
@ -46,37 +59,27 @@ TellForm 2.1.0
|
|||
- Add Stripe/Payment Form field
|
||||
- Add Custom Background and Dropdown Field Images
|
||||
- Add File Upload Form Field
|
||||
|
||||
## How to Contribute
|
||||
|
||||
Please checkout our CONTRIBUTING.md on ways to contribute to TellForm.
|
||||
|
||||
All contributors are eligible to get a free [TellForm Sticker](https://www.stickermule.com/marketplace/15987-tellform-round-sticker). All you have to do is submit a PR, get it accepted, email your address to team [at] tellform.com and we'll send you a sticker that you can proudly put on your laptop.
|
||||
|
||||
## Quickstart
|
||||
|
||||
Before you start, make sure you have
|
||||
1. [Redis](https://redis.io/) installed and running at 127.0.0.1:6379
|
||||
2. [MongoDB](https://www.mongodb.com/) installed and running at 127.0.0.1:27017 (OR specify the host and port in config/env/all)
|
||||
|
||||
Also make sure to install [DNS Masq](http://www.thekelleys.org.uk/dnsmasq/doc.html) or equivalent if running it locally on your computer (look at dns_masq_setup_osx for instructions on OSX)
|
||||
|
||||
Install dependencies first.
|
||||
```bash
|
||||
$ npm install
|
||||
$ bower install
|
||||
```
|
||||
|
||||
Setup environment.
|
||||
```bash
|
||||
$ grunt build
|
||||
```
|
||||
|
||||
Create your user account
|
||||
```bash
|
||||
$ node ./scripts/setup.js
|
||||
```
|
||||
|
||||
OR create your .env file
|
||||
```
|
||||
GOOGLE_ANALYTICS_ID=yourGAID
|
||||
|
@ -84,85 +87,67 @@ PRERENDER_TOKEN=yourPrerender.ioToken
|
|||
COVERALLS_REPO_TOKEN=yourCoveralls.ioToken
|
||||
BASE_URL=localhost
|
||||
DSN_KEY=yourPrivateRavenKey
|
||||
|
||||
# Mail config
|
||||
MAILER_EMAIL_ID=user@domain.com
|
||||
MAILER_PASSWORD=some-pass
|
||||
MAILER_FROM=user@domain.com
|
||||
|
||||
# Use this for one of Nodemailer's pre-configured service providers
|
||||
MAILER_SERVICE_PROVIDER=SendGrid
|
||||
|
||||
# Use these for a custom service provider
|
||||
# Note: MAILER_SMTP_HOST will override MAILER_SERVICE_PROVIDER
|
||||
MAILER_SMTP_HOST=smtp.domain.com
|
||||
MAILER_SMTP_PORT=465
|
||||
MAILER_SMTP_SECURE=true
|
||||
|
||||
MAILER_SMTP_SECURE=TRUE
|
||||
```
|
||||
|
||||
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___
|
||||
|
||||
#### To run the development version:
|
||||
|
||||
Set ```NODE_ENV=development``` in .env file
|
||||
```$ grunt```
|
||||
|
||||
#### To run the production version:
|
||||
|
||||
Set ```NODE_ENV=production``` in .env file
|
||||
```$ grunt```
|
||||
|
||||
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 [here](https://docs.docker.com/engine/installation/).
|
||||
|
||||
Then see this page [here](https://tellform.com/install_docker) for commands on how to deploy your own local TellForm instance.
|
||||
|
||||
Then run follow these steps:
|
||||
### Step 1: Clone the repo
|
||||
`$ git clone https://github.com/tellform/docker_files.git`
|
||||
### Step 2: Setup TellForm Configuration
|
||||
Create your .env file by copying the .env.dist file included in the repo and changing it to suit your deployment.
|
||||
Important: You need to fill out all of the ENV variables in the "Mail Settings" section or your TellForm instance won't work.
|
||||
If you want to have https, make sure to change 'TLS_FLAVOR'
|
||||
### Step 3: Start your TellForm instance
|
||||
`docker-compose up -d`
|
||||
TellForm should now be accessible on http://localhost
|
||||
## Testing Your Application
|
||||
You can run the full test suite included with TellForm with the test task:
|
||||
|
||||
```
|
||||
$ grunt test
|
||||
```
|
||||
|
||||
This will run both the server-side tests (located in the app/tests/ directory) and the client-side tests (located in the public/modules/*/tests/).
|
||||
|
||||
To execute only the server tests, run the test:server task:
|
||||
|
||||
```
|
||||
$ grunt test:server
|
||||
```
|
||||
|
||||
And to run only the client tests, run the test:client task:
|
||||
|
||||
```
|
||||
$ grunt test:client
|
||||
```
|
||||
|
||||
Currently the live example uses heroku github deployments. The Docker file is out of date and does not work. If someone wishes to get it working feel free to submit a pull request.
|
||||
|
||||
To calculate your total test coverage with Istanbul, run the coverage task
|
||||
```bash
|
||||
$ grunt coverage
|
||||
```
|
||||
|
||||
To calculate your server-side test coverage with Istanbul, run the coverage task
|
||||
```bash
|
||||
$ grunt coverage:server
|
||||
```
|
||||
|
||||
To calculate your client-side test coverage with Istanbul, run the coverage task
|
||||
```bash
|
||||
$ grunt coverage:client
|
||||
```
|
||||
|
||||
## Configuration
|
||||
|
||||
TellForm's configuration is done with environment variables. To set an option for TellForm, open/create your .env file and set add `ENV_VAR=somevalue` to set the ENV_VAR variable to the value `somevalue`.
|
||||
|
||||
| Property | Valid Values | Default Value | Description | Required? |
|
||||
|-------------------------|--------------------------------------------------------|----------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------|--------------------------------------------|
|
||||
| NODE_ENV | "development", "production", "test" or "secure" | development | Set which version of the app you want to run (either secure/SSL, dev, prod or test) | No |
|
||||
|
@ -191,42 +176,24 @@ TellForm's configuration is done with environment variables. To set an option fo
|
|||
| APP_KEYWORDS | A comma-seperated list of phrases/words | typeform, pdfs, forms, opensource, formbuilder, google forms, nodejs | Sets the value of the <meta> description attribute. | No |
|
||||
| RAVEN_DSN | A valid Sentry.io DSN | N/A | Set this to your Sentry.io Public DSN to enable remote logging | No |
|
||||
| GOOGLE_ANALYTICS_ID | A valid Google Analytics ID | N/A | Set this to your GA id to enable GA tracking on your TellForm instance | No |
|
||||
|
||||
## Where to get help
|
||||
|
||||
[Gitter Chat](https://gitter.im/tellform/Lobby)
|
||||
|
||||
[Official Twitter](https://twitter.com/tellform_real)
|
||||
-->
|
||||
|
||||
|
||||
## Sponsors
|
||||
|
||||
Further Sponsorships are no longer accepted.
|
||||
<!--
|
||||
Does your company use TellForm? Help keep the project bug-free and feature rich by [sponsoring the project](https://opencollective.com/tellform#sponsor).
|
||||
|
||||
<a href="https://m.do.co/c/a86fd8843e09" style="padding: 30px 0">
|
||||
<img src="/docs/readme_logos/do_logo.png" height="30px">
|
||||
</a>
|
||||
<a href="https://getsentry.com/" style="padding: 30px 0">
|
||||
<img src="/docs/readme_logos/sentry_logo.png" height="30px">
|
||||
</a>
|
||||
<a href="https://statuspage.io/" style="padding: 30px 0">
|
||||
<img src="/docs/readme_logos/statuspage_logo.png" height="30px">
|
||||
</a>
|
||||
<br><br>
|
||||
<a href="https://www.stickermule.com/unlock?ref_id=0939360701" style="padding: 30px 0">
|
||||
<img src="/docs/readme_logos/stickermule_logo.png" height="30px">
|
||||
</a>
|
||||
<a href="https://sparkpost.com/" style="padding: 30px 0">
|
||||
<img src="/docs/readme_logos/sparkpost_logo.png" height="30px">
|
||||
</a>
|
||||
|
||||
<a href="https://therooststand.com/" style="padding: 30px 0">
|
||||
<img src="/docs/readme_logos/roost_logo.png" height="30px">
|
||||
</a>
|
||||
<a href="https://countable.ca" style="padding: 30px 0">
|
||||
<img src="https://countable.ca/logo.cb446ab0.svg" height="30px">
|
||||
</a> -->
|
||||
|
||||
## Backers
|
||||
|
||||
Love our work and community? [Become a backer](https://opencollective.com/tellform).
|
||||
Love our work and community? <!--[Become a backer](https://opencollective.com/tellform).-->
|
||||
|
||||
<a href="https://opencollective.com/elliot" target="_blank">
|
||||
<img src="https://opencollective.com/proxy/images/?src=https%3A%2F%2Fd1ts43dypk8bqh.cloudfront.net%2Fv1%2Favatars%2F6fd61b2c-62b6-438a-9168-bab7ef1489b8" height= "64">
|
||||
|
@ -245,8 +212,6 @@ Love our work and community? [Become a backer](https://opencollective.com/tellfo
|
|||
<!-- ALL-CONTRIBUTORS-LIST:END -->
|
||||
## Mentions on the Web
|
||||
|
||||
[Mister Ad](http://start.mister-ad.biz/newsticker/open-source-alternative-zu-typeform-tellform-in-der-kurzvorstellung/)
|
||||
|
||||
[t3n.de](http://t3n.de/news/open-source-alternative-typeform-tellform-707295/)
|
||||
|
||||
[BootCSS Expo](http://expo.bootcss.com/)
|
||||
|
|
|
@ -9,14 +9,7 @@ var mongoose = require('mongoose'),
|
|||
FormSubmission = mongoose.model('FormSubmission'),
|
||||
config = require('../../config/config'),
|
||||
diff = require('deep-diff'),
|
||||
_ = require('lodash'),
|
||||
nodemailer = require('nodemailer'),
|
||||
emailNotifications = require('../libs/send-email-notifications'),
|
||||
constants = require('../libs/constants'),
|
||||
helpers = require('./helpers.server.controller'),
|
||||
async = require('async');
|
||||
|
||||
var smtpTransport = nodemailer.createTransport(config.mailer.options);
|
||||
_ = require('lodash');
|
||||
|
||||
/**
|
||||
* Delete a forms submissions
|
||||
|
@ -26,7 +19,7 @@ exports.deleteSubmissions = function(req, res) {
|
|||
var submission_id_list = req.body.deleted_submissions,
|
||||
form = req.form;
|
||||
|
||||
FormSubmission.remove({ form: req.form, admin: req.user, _id: {$in: submission_id_list} }, function(err){
|
||||
FormSubmission.remove({ form: req.form, _id: {$in: submission_id_list} }, function(err){
|
||||
|
||||
if(err){
|
||||
res.status(400).send({
|
||||
|
@ -55,7 +48,7 @@ exports.deleteSubmissions = function(req, res) {
|
|||
exports.createSubmission = function(req, res) {
|
||||
|
||||
var timeElapsed = 0;
|
||||
|
||||
|
||||
if(typeof req.body.timeElapsed === 'number'){
|
||||
timeElapsed = req.body.timeElapsed;
|
||||
}
|
||||
|
@ -76,51 +69,7 @@ exports.createSubmission = function(req, res) {
|
|||
message: errorHandler.getErrorMessage(err)
|
||||
});
|
||||
}
|
||||
var form = req.body
|
||||
var formFieldDict = emailNotifications.createFieldDict(form.form_fields);
|
||||
|
||||
async.waterfall([
|
||||
function(callback) {
|
||||
if (form.selfNotifications && form.selfNotifications.enabled && form.selfNotifications.fromField) {
|
||||
form.selfNotifications.fromEmails = formFieldDict[form.selfNotifications.fromField];
|
||||
|
||||
emailNotifications.send(form.selfNotifications, formFieldDict, smtpTransport, constants.varFormat, function(err){
|
||||
if(err){
|
||||
return callback({
|
||||
message: 'Failure sending submission self-notification email'
|
||||
});
|
||||
}
|
||||
|
||||
callback();
|
||||
});
|
||||
} else {
|
||||
callback();
|
||||
}
|
||||
},
|
||||
function(callback) {
|
||||
if (form.respondentNotifications && form.respondentNotifications.enabled && form.respondentNotifications.toField) {
|
||||
|
||||
form.respondentNotifications.toEmails = formFieldDict[form.respondentNotifications.toField];
|
||||
debugger;
|
||||
emailNotifications.send(form.respondentNotifications, formFieldDict, smtpTransport, constants.varFormat, function(err){
|
||||
if(err){
|
||||
return callback({
|
||||
message: 'Failure sending submission respondent-notification email'
|
||||
});
|
||||
}
|
||||
|
||||
callback();
|
||||
});
|
||||
} else {
|
||||
callback();
|
||||
}
|
||||
}
|
||||
], function (err) {
|
||||
if(err){
|
||||
return res.status(400).send(err);
|
||||
}
|
||||
res.status(200).send('Form submission successfully saved');
|
||||
});
|
||||
res.status(200).send('Form submission successfully saved');
|
||||
});
|
||||
};
|
||||
|
||||
|
@ -145,24 +94,25 @@ exports.listSubmissions = function(req, res) {
|
|||
* Create a new form
|
||||
*/
|
||||
exports.create = function(req, res) {
|
||||
|
||||
if(!req.body.form){
|
||||
return res.status(400).send({
|
||||
message: 'Invalid Input'
|
||||
});
|
||||
}
|
||||
|
||||
var form = new Form(req.body.form);
|
||||
|
||||
form.admin = req.user._id;
|
||||
|
||||
form.save(function(err, createdForm) {
|
||||
form.save(function(err) {
|
||||
debugger;
|
||||
if (err) {
|
||||
return res.status(500).send({
|
||||
message: errorHandler.getErrorMessage(err)
|
||||
});
|
||||
}
|
||||
|
||||
createdForm = helpers.removeSensitiveModelData('private_form', createdForm);
|
||||
return res.json(createdForm);
|
||||
return res.json(form);
|
||||
});
|
||||
};
|
||||
|
||||
|
@ -173,19 +123,16 @@ exports.read = function(req, res) {
|
|||
if(!req.user || (req.form.admin.id !== req.user.id) ){
|
||||
readForRender(req, res);
|
||||
} else {
|
||||
if(!req.form){
|
||||
var newForm = req.form.toJSON();
|
||||
|
||||
if (req.userId) {
|
||||
if(req.form.admin._id+'' === req.userId+''){
|
||||
return res.json(newForm);
|
||||
}
|
||||
return res.status(404).send({
|
||||
message: 'Form Does Not Exist'
|
||||
});
|
||||
}
|
||||
|
||||
var newForm = req.form.toJSON();
|
||||
|
||||
if(newForm.admin._id === req.user._id){
|
||||
return res.json(newForm);
|
||||
}
|
||||
|
||||
newForm = helpers.removeSensitiveModelData('private_form', newForm);
|
||||
return res.json(newForm);
|
||||
}
|
||||
};
|
||||
|
@ -201,7 +148,9 @@ var readForRender = exports.readForRender = function(req, res) {
|
|||
});
|
||||
}
|
||||
|
||||
newForm = helpers.removeSensitiveModelData('public_form', newForm);
|
||||
delete newForm.lastModified;
|
||||
delete newForm.__v;
|
||||
delete newForm.created;
|
||||
|
||||
if(newForm.startPage && !newForm.startPage.showStart){
|
||||
delete newForm.startPage;
|
||||
|
@ -217,12 +166,15 @@ exports.update = function(req, res) {
|
|||
|
||||
var form = req.form;
|
||||
var updatedForm = req.body.form;
|
||||
|
||||
if(!form.analytics){
|
||||
if(form.form_fields === undefined){
|
||||
form.form_fields = [];
|
||||
}
|
||||
|
||||
if(form.analytics === undefined){
|
||||
form.analytics = {
|
||||
visitors: [],
|
||||
gaCode: ''
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
if (req.body.changes) {
|
||||
|
@ -240,6 +192,11 @@ exports.update = function(req, res) {
|
|||
delete updatedForm.admin;
|
||||
}
|
||||
|
||||
if(form.analytics === null){
|
||||
form.analytics.visitors = [];
|
||||
form.analytics.gaCode = '';
|
||||
}
|
||||
|
||||
//Do this so we can create duplicate fields
|
||||
var checkForValidId = new RegExp('^[0-9a-fA-F]{24}$');
|
||||
for(var i=0; i < req.body.form.form_fields.length; i++){
|
||||
|
@ -257,7 +214,6 @@ exports.update = function(req, res) {
|
|||
message: errorHandler.getErrorMessage(err)
|
||||
});
|
||||
} else {
|
||||
savedForm = helpers.removeSensitiveModelData('private_form', savedForm);
|
||||
res.json(savedForm);
|
||||
}
|
||||
});
|
||||
|
@ -299,8 +255,6 @@ exports.list = function(req, res) {
|
|||
});
|
||||
} else {
|
||||
for(var i=0; i<forms.length; i++){
|
||||
forms[i] = helpers.removeSensitiveModelData('private_form', forms[i]);
|
||||
|
||||
forms[i].numberOfResponses = 0;
|
||||
if(forms[i].submissions){
|
||||
forms[i].numberOfResponses = forms[i].submissions.length;
|
||||
|
@ -321,7 +275,6 @@ exports.formByID = function(req, res, next, id) {
|
|||
message: 'Form is invalid'
|
||||
});
|
||||
}
|
||||
|
||||
Form.findById(id)
|
||||
.populate('admin')
|
||||
.exec(function(err, form) {
|
||||
|
@ -334,7 +287,12 @@ exports.formByID = function(req, res, next, id) {
|
|||
}
|
||||
else {
|
||||
//Remove sensitive information from User object
|
||||
req.form = helpers.removeSensitiveModelData('private_form', form);
|
||||
var _form = form;
|
||||
_form.admin.password = null;
|
||||
_form.admin.salt = null;
|
||||
_form.provider = null;
|
||||
|
||||
req.form = _form;
|
||||
return next();
|
||||
}
|
||||
});
|
||||
|
@ -351,7 +309,7 @@ exports.formByIDFast = function(req, res, next, id) {
|
|||
}
|
||||
Form.findById(id)
|
||||
.lean()
|
||||
.select('title language form_fields startPage endPage hideFooter isLive design analytics.gaCode selfNotifications respondentNotifications')
|
||||
.select('title language form_fields startPage endPage hideFooter isLive design analytics.gaCode')
|
||||
.exec(function(err, form) {
|
||||
if (err) {
|
||||
return next(err);
|
||||
|
@ -362,7 +320,13 @@ exports.formByIDFast = function(req, res, next, id) {
|
|||
}
|
||||
else {
|
||||
//Remove sensitive information from User object
|
||||
req.form = helpers.removeSensitiveModelData('public_form', form);
|
||||
var _form = form;
|
||||
if(_form.admin){
|
||||
_form.admin.password = null;
|
||||
_form.admin.salt = null;
|
||||
_form.provider = null;
|
||||
}
|
||||
req.form = _form;
|
||||
return next();
|
||||
}
|
||||
});
|
||||
|
|
|
@ -1,45 +0,0 @@
|
|||
'use strict';
|
||||
|
||||
module.exports = {
|
||||
removeSensitiveModelData: function(type, object){
|
||||
var privateFields = {
|
||||
'public_form': ['__v', 'analytics.visitors', 'analytics.views', 'analytics.conversionRate', 'analytics.fields', 'lastModified', 'created'],
|
||||
'private_form': ['__v'],
|
||||
'public_user': ['passwordHash', 'password', 'provider', 'salt', 'lastModified', 'created', 'resetPasswordToken', 'resetPasswordExpires', 'token', 'apiKey', '__v'],
|
||||
'private_user': ['passwordHash', 'password', 'provider', 'salt', 'resetPasswordToken', 'resetPasswordExpires', 'token', '__v']
|
||||
};
|
||||
|
||||
function removeKeysFromDict(dict, keys){
|
||||
for(var i=0; i<keys.length; i++){
|
||||
var curr_key = keys[i];
|
||||
if( dict.hasOwnProperty(curr_key) ){
|
||||
delete dict[curr_key];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
switch(type){
|
||||
case 'private_form':
|
||||
removeKeysFromDict(object, privateFields[type]);
|
||||
if(object.admin){
|
||||
removeKeysFromDict(object.admin, privateFields.private_user);
|
||||
}
|
||||
break;
|
||||
|
||||
case 'public_form':
|
||||
removeKeysFromDict(object, privateFields[type]);
|
||||
if(object.admin){
|
||||
removeKeysFromDict(object.admin, privateFields.public_user);
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
if(privateFields.hasOwnProperty(type)){
|
||||
removeKeysFromDict(object, privateFields[type]);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
return object;
|
||||
}
|
||||
};
|
|
@ -12,8 +12,7 @@ var errorHandler = require('../errors.server.controller'),
|
|||
fs = require('fs'),
|
||||
i18n = require('i18n'),
|
||||
async = require('async'),
|
||||
pug = require('pug'),
|
||||
helpers = require('../helpers.server.controller');
|
||||
pug = require('pug');
|
||||
|
||||
var nev = require('email-verification')(mongoose);
|
||||
|
||||
|
@ -61,7 +60,7 @@ config_nev();
|
|||
|
||||
exports.validateVerificationToken = function(req, res){
|
||||
|
||||
const fn = pug.compileFile(__dirname + '/../../views/welcome.email.view.pug');
|
||||
const fn = pug.compileFile(__dirname + "/../../views/welcome.email.view.pug");
|
||||
var renderedHtml = fn(res.locals);
|
||||
|
||||
var emailTemplate = {
|
||||
|
@ -84,7 +83,7 @@ exports.validateVerificationToken = function(req, res){
|
|||
};
|
||||
|
||||
exports.resendVerificationEmail = function(req, res, next){
|
||||
const fn = pug.compileFile(__dirname + '/../../views/verification.email.view.pug');
|
||||
const fn = pug.compileFile(__dirname + "/../../views/verification.email.view.pug");
|
||||
var renderedHtml = fn(res.locals);
|
||||
|
||||
var emailTemplate = {
|
||||
|
@ -118,7 +117,7 @@ exports.signup = function(req, res) {
|
|||
var user = new User(req.body);
|
||||
|
||||
// Set language to visitor's language
|
||||
user.language = req.cookies.userLang;
|
||||
user.language = req.cookies['userLang'];
|
||||
|
||||
// Add missing user fields
|
||||
user.provider = 'local';
|
||||
|
@ -134,7 +133,7 @@ exports.signup = function(req, res) {
|
|||
|
||||
// new user created
|
||||
if (newTempUser) {
|
||||
const fn = pug.compileFile(__dirname + '/../../views/verification.email.view.pug');
|
||||
const fn = pug.compileFile(__dirname + "/../../views/verification.email.view.pug");
|
||||
var renderedHtml = fn(res.locals);
|
||||
|
||||
var URL = newTempUser[nev.options.URLFieldName];
|
||||
|
@ -180,8 +179,6 @@ exports.signin = function(req, res, next) {
|
|||
}
|
||||
|
||||
res.cookie('langCookie', user.language, { maxAge: 90000, httpOnly: true });
|
||||
|
||||
user = helpers.removeSensitiveModelData('private_user', user);
|
||||
return res.json(user);
|
||||
});
|
||||
}
|
||||
|
@ -201,12 +198,16 @@ exports.signout = function(req, res) {
|
|||
|
||||
/* Generate API Key for User */
|
||||
exports.generateAPIKey = function(req, res) {
|
||||
if (!req.isAuthenticated()){
|
||||
return res.status(400).send({
|
||||
message: 'User is not Authorized'
|
||||
});
|
||||
}
|
||||
|
||||
User.findById(req.user.id)
|
||||
.exec( function(err, user) {
|
||||
if (err) {
|
||||
return res.status(400).send({
|
||||
message: errorHandler.getErrorMessage(err)
|
||||
});
|
||||
return res.status(400).send(err);
|
||||
}
|
||||
|
||||
if (!user) {
|
||||
|
@ -225,8 +226,12 @@ exports.generateAPIKey = function(req, res) {
|
|||
}
|
||||
|
||||
var newUser = _user.toObject();
|
||||
delete newUser.salt;
|
||||
delete newUser.__v;
|
||||
delete newUser.passwordHash;
|
||||
delete newUser.provider;
|
||||
|
||||
return res.json({ id: newUser._id, apiKey: newUser.apiKey });
|
||||
return res.json(newUser);
|
||||
});
|
||||
|
||||
});
|
||||
|
|
|
@ -3,7 +3,36 @@
|
|||
/**
|
||||
* Module dependencies.
|
||||
*/
|
||||
var auth = require('../../../config/passport_helpers');
|
||||
var _ = require('lodash'),
|
||||
mongoose = require('mongoose'),
|
||||
User = mongoose.model('User');
|
||||
|
||||
/**
|
||||
* User middleware
|
||||
*/
|
||||
exports.userByID = function (req, res, next, id) {
|
||||
if (!mongoose.Types.ObjectId.isValid(id)) {
|
||||
return res.status(400).send({
|
||||
message: 'User is invalid'
|
||||
});
|
||||
}
|
||||
|
||||
User.findOne({
|
||||
_id: id
|
||||
}).exec(function (err, user) {
|
||||
if (err) {
|
||||
return next(err);
|
||||
} else if (!user) {
|
||||
return res.status(404).send({
|
||||
message: 'User does not exist'
|
||||
});
|
||||
}
|
||||
|
||||
req.profile = user;
|
||||
next();
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* Require login routing middleware
|
||||
*/
|
||||
|
@ -16,3 +45,22 @@ exports.requiresLogin = function(req, res, next) {
|
|||
return next();
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* User authorizations routing middleware
|
||||
*/
|
||||
exports.hasAuthorization = function(roles) {
|
||||
var _this = this;
|
||||
|
||||
return function(req, res, next) {
|
||||
_this.requiresLogin(req, res, function() {
|
||||
if (_.intersection(req.user.roles, roles).length) {
|
||||
return next();
|
||||
} else {
|
||||
return res.status(403).send({
|
||||
message: 'User is not authorized'
|
||||
});
|
||||
}
|
||||
});
|
||||
};
|
||||
};
|
||||
|
|
|
@ -81,9 +81,10 @@ exports.forgot = function(req, res) {
|
|||
}
|
||||
},
|
||||
function(token, user, done) {
|
||||
const fn = pug.compileFile(__dirname + '/../../views/templates/reset-password-email.server.view.pug');
|
||||
res.locals.url = 'http://' + req.headers.host + '/auth/reset/' + token;
|
||||
const fn = pug.compileFile(__dirname + "/../../views/templates/reset-password-email.server.view.pug");
|
||||
res.locals['url'] = 'http://' + req.headers.host + '/auth/reset/' + token;
|
||||
|
||||
console.log(res.locals);
|
||||
var renderedHtml = fn(res.locals);
|
||||
done(null, renderedHtml, user);
|
||||
},
|
||||
|
@ -97,10 +98,10 @@ exports.forgot = function(req, res) {
|
|||
};
|
||||
|
||||
var userEmail = user.email;
|
||||
var emailUsername = userEmail.split('@')[0];
|
||||
var user = userEmail.split('@')[0];
|
||||
var domain = userEmail.split('@')[1];
|
||||
|
||||
var obfuscatedUser = emailUsername.substring(0, 1) + emailUsername.substring(1).replace(/./g, '*');
|
||||
var obfuscatedUser = user.substring(0, 1) + user.substring(1).replace(/./g, '*');
|
||||
var domainName = domain.split('.')[0];
|
||||
var tld = domain.split('.')[1];
|
||||
|
||||
|
@ -141,9 +142,9 @@ exports.validateResetToken = function(req, res) {
|
|||
});
|
||||
}
|
||||
if (!user) {
|
||||
return res.redirect(400, '/#!/password/reset/invalid');
|
||||
return res.redirect('/#!/password/reset/invalid');
|
||||
}
|
||||
|
||||
|
||||
res.redirect('/#!/password/reset/' + req.params.token);
|
||||
});
|
||||
};
|
||||
|
@ -186,13 +187,13 @@ exports.reset = function(req, res, next) {
|
|||
done(null, savedUser);
|
||||
});
|
||||
} else {
|
||||
done('invalid_reset_token', null);
|
||||
done('Password reset token is invalid or has expired.', null);
|
||||
}
|
||||
});
|
||||
},
|
||||
function(user, done) {
|
||||
const fn = pug.compileFile(__dirname + '/../../views/templates/reset-password-confirm-email.server.view.pug');
|
||||
const renderedHtml = fn(res.locals);
|
||||
const fn = pug.compileFile(__dirname + "/../../views/templates/reset-password-confirm-email.server.view.pug");
|
||||
var renderedHtml = fn(res.locals);
|
||||
done(null, renderedHtml, user);
|
||||
},
|
||||
// If valid email, send reset email using service
|
||||
|
@ -210,18 +211,12 @@ exports.reset = function(req, res, next) {
|
|||
}
|
||||
], function(err) {
|
||||
if (err) {
|
||||
if(err === 'invalid_reset_token'){
|
||||
return res.status(400).send({
|
||||
message: 'Password reset token is invalid or has expired.'
|
||||
});
|
||||
}
|
||||
|
||||
return res.status(500).send({
|
||||
res.status(500).send({
|
||||
message: err.message || err
|
||||
});
|
||||
}
|
||||
|
||||
res.json({
|
||||
return res.json({
|
||||
message: 'Successfully changed your password!'
|
||||
});
|
||||
});
|
||||
|
|
|
@ -5,8 +5,7 @@
|
|||
*/
|
||||
var _ = require('lodash'),
|
||||
errorHandler = require('../errors.server.controller.js'),
|
||||
mongoose = require('mongoose'),
|
||||
helpers = require('../helpers.server.controller');
|
||||
mongoose = require('mongoose');
|
||||
|
||||
/**
|
||||
* Update user details
|
||||
|
@ -15,36 +14,47 @@ exports.update = function(req, res) {
|
|||
// Init Variables
|
||||
var user = req.user;
|
||||
|
||||
// To improve security we remove the roles from the req.body object
|
||||
// For security measurement we remove the roles from the req.body object
|
||||
delete req.body.roles;
|
||||
|
||||
// Merge existing user
|
||||
user = _.extend(user, req.body);
|
||||
user.updated = Date.now();
|
||||
if (user) {
|
||||
// Merge existing user
|
||||
user = _.extend(user, req.body);
|
||||
user.updated = Date.now();
|
||||
|
||||
user.save(function(err) {
|
||||
if (err) {
|
||||
return res.status(500).send({
|
||||
message: errorHandler.getErrorMessage(err)
|
||||
});
|
||||
}
|
||||
req.login(user, function(loginErr) {
|
||||
user.save(function(err) {
|
||||
if (err) {
|
||||
res.status(500).send(loginErr);
|
||||
} else {
|
||||
user = helpers.removeSensitiveModelData('private_user', user);
|
||||
res.json(user);
|
||||
}
|
||||
return res.status(500).send({
|
||||
message: errorHandler.getErrorMessage(err)
|
||||
});
|
||||
}
|
||||
req.login(user, function(loginErr) {
|
||||
if (err) {
|
||||
res.status(500).send(loginErr);
|
||||
} else {
|
||||
res.json(user);
|
||||
}
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
});
|
||||
} else {
|
||||
res.status(401).send({
|
||||
message: 'User is not signed in'
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Send User
|
||||
*/
|
||||
exports.getUser = function(req, res) {
|
||||
var user = helpers.removeSensitiveModelData('private_user', req.user);
|
||||
var _user = req.user;
|
||||
delete _user.password;
|
||||
delete _user.salt;
|
||||
delete _user.provider;
|
||||
delete _user.__v;
|
||||
|
||||
return res.json(user);
|
||||
res.json(req.user || null);
|
||||
|
||||
res.end();
|
||||
};
|
||||
|
|
|
@ -4,6 +4,7 @@ module.exports = {
|
|||
fieldTypes: ['textfield',
|
||||
'date',
|
||||
'email',
|
||||
'link',
|
||||
'legal',
|
||||
'url',
|
||||
'textarea',
|
||||
|
@ -73,9 +74,6 @@ module.exports = {
|
|||
regex: {
|
||||
url: /((([A-Za-z]{3,9}:(?:\/\/)?)(?:[-;:&=\+\$,\w]+@)?[A-Za-z0-9.-]+|(?:www.|[-;:&=\+\$,\w]+@)[A-Za-z0-9.-]+)((?:\/[\+~%\/.\w-_]*)?\??(?:[-\+=&;%@.\w_]*)#?(?:[\w]*))?)/,
|
||||
hexCode: /^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$/,
|
||||
email: /^(([^<>()\[\]\\.,;:\s@']+(\.[^<>()\[\]\\.,;:\s@']+)*)|('.+'))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/,
|
||||
templateVariable: /<var(.*)id(.*)>(.|\n)*?<\/var>/g
|
||||
},
|
||||
|
||||
varFormat: ['<var([^<>]+)id=["\']{1}field:', '["\']{1}>([^<>]+)*?<\/var>'],
|
||||
email: /^(([^<>()\[\]\\.,;:\s@']+(\.[^<>()\[\]\\.,;:\s@']+)*)|('.+'))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/
|
||||
}
|
||||
};
|
|
@ -1,44 +0,0 @@
|
|||
'use strict';
|
||||
|
||||
module.exports = {
|
||||
send: function(emailSettings, emailTemplateVars, smtpTransport, varFormat, cb){
|
||||
var parsedTemplate = this.parseTemplate(emailSettings.htmlTemplate, emailTemplateVars, varFormat);
|
||||
var parsedSubject = this.parseTemplate(emailSettings.subject, emailTemplateVars, varFormat);
|
||||
var mailOptions = {
|
||||
replyTo: emailSettings.fromEmails,
|
||||
from: 'noreply@tellform.com',
|
||||
cc: emailSettings.toEmails,
|
||||
subject: parsedSubject,
|
||||
html: parsedTemplate
|
||||
};
|
||||
|
||||
console.log('HERE');
|
||||
smtpTransport.sendMail(mailOptions, function(){
|
||||
console.log('THERE');
|
||||
cb();
|
||||
});
|
||||
},
|
||||
|
||||
parseTemplate: function(emailTemplate, emailAttrs, varFormat){
|
||||
var resolvedTemplate = emailTemplate;
|
||||
var that = this;
|
||||
Object.keys(emailAttrs).forEach(function (key) {
|
||||
resolvedTemplate = that.replaceTemplateVal(key, emailAttrs[key], resolvedTemplate, varFormat);
|
||||
});
|
||||
return resolvedTemplate;
|
||||
},
|
||||
|
||||
replaceTemplateVal: function(key, val, template, varFormat){
|
||||
return template.replace( new RegExp(varFormat[0] + key + varFormat[1], 'g'), val);
|
||||
},
|
||||
|
||||
createFieldDict: function(form_fields){
|
||||
var formFieldDict = {};
|
||||
form_fields.forEach(function(field){
|
||||
if(field.hasOwnProperty('globalId') && field.hasOwnProperty('fieldValue')){
|
||||
formFieldDict[field.globalId] = field.fieldValue;
|
||||
}
|
||||
});
|
||||
return formFieldDict;
|
||||
}
|
||||
};
|
|
@ -2,36 +2,38 @@
|
|||
|
||||
// Plugin
|
||||
module.exports = function timestamp (schema, options) {
|
||||
options = options || (options === {});
|
||||
options || (options = {})
|
||||
|
||||
// Options
|
||||
var fields = {},
|
||||
createdPath = options.createdPath || 'created',
|
||||
modifiedPath = options.modifiedPath || 'modified',
|
||||
useVirtual = (options.useVirtual !== undefined) ? options.useVirtual : true;
|
||||
var fields = {}
|
||||
, createdPath = options.createdPath || 'created'
|
||||
, modifiedPath = options.modifiedPath || 'modified'
|
||||
, useVirtual = (options.useVirtual !== undefined)
|
||||
? options.useVirtual
|
||||
: true
|
||||
|
||||
// Add paths to schema if not present
|
||||
if (!schema.paths[createdPath]) {
|
||||
fields[modifiedPath] = { type: Date };
|
||||
fields[modifiedPath] = { type: Date }
|
||||
}
|
||||
if (useVirtual) {
|
||||
// Use the ObjectID for extracting the created time
|
||||
schema.virtual(createdPath).get(function () {
|
||||
return new Date(this._id.generationTime * 1000);
|
||||
});
|
||||
return new Date(this._id.generationTime * 1000)
|
||||
})
|
||||
} else {
|
||||
if (!schema.paths[createdPath]) {
|
||||
fields[createdPath] = {
|
||||
type: Date,
|
||||
default: Date.now
|
||||
};
|
||||
type: Date
|
||||
, default: Date.now
|
||||
}
|
||||
}
|
||||
}
|
||||
schema.add(fields);
|
||||
schema.add(fields)
|
||||
|
||||
// Update the modified timestamp on save
|
||||
schema.pre('save', function (next) {
|
||||
this[modifiedPath] = new Date();
|
||||
next();
|
||||
});
|
||||
};
|
||||
this[modifiedPath] = new Date
|
||||
next()
|
||||
})
|
||||
}
|
|
@ -9,8 +9,7 @@ var mongoose = require('mongoose'),
|
|||
timeStampPlugin = require('../libs/timestamp.server.plugin'),
|
||||
async = require('async'),
|
||||
Random = require('random-js'),
|
||||
mt = Random.engines.mt19937(),
|
||||
constants = require('../libs/constants');
|
||||
mt = Random.engines.mt19937();
|
||||
|
||||
|
||||
mt.autoSeed();
|
||||
|
@ -58,12 +57,11 @@ var VisitorDataSchema = new Schema({
|
|||
type: Boolean
|
||||
},
|
||||
language: {
|
||||
type: String,
|
||||
enum: constants.languageTypes,
|
||||
default: 'en',
|
||||
type: String
|
||||
},
|
||||
ipAddr: {
|
||||
type: String
|
||||
type: String,
|
||||
default: ''
|
||||
},
|
||||
deviceType: {
|
||||
type: String,
|
||||
|
@ -103,17 +101,12 @@ var FormSchema = new Schema({
|
|||
visitors: [VisitorDataSchema]
|
||||
},
|
||||
|
||||
form_fields: {
|
||||
type: [FieldSchema],
|
||||
default: []
|
||||
},
|
||||
submissions: {
|
||||
type: [{
|
||||
type: Schema.Types.ObjectId,
|
||||
ref: 'FormSubmission'
|
||||
}],
|
||||
dfeault: []
|
||||
},
|
||||
form_fields: [FieldSchema],
|
||||
submissions: [{
|
||||
type: Schema.Types.ObjectId,
|
||||
ref: 'FormSubmission'
|
||||
}],
|
||||
|
||||
admin: {
|
||||
type: Schema.Types.ObjectId,
|
||||
ref: 'User',
|
||||
|
@ -156,52 +149,10 @@ var FormSchema = new Schema({
|
|||
buttons:[ButtonSchema]
|
||||
},
|
||||
|
||||
selfNotifications: {
|
||||
fromField: {
|
||||
type: String
|
||||
},
|
||||
toEmails: {
|
||||
type: String
|
||||
},
|
||||
subject: {
|
||||
type: String
|
||||
},
|
||||
htmlTemplate: {
|
||||
type: String
|
||||
},
|
||||
enabled: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
}
|
||||
},
|
||||
|
||||
respondentNotifications: {
|
||||
toField: {
|
||||
type: String
|
||||
},
|
||||
fromEmails: {
|
||||
type: String,
|
||||
match: [/.+\@.+\..+/, 'Please fill a valid email address']
|
||||
},
|
||||
subject: {
|
||||
type: String,
|
||||
default: 'Tellform: Thank you for filling out this TellForm'
|
||||
},
|
||||
htmlTemplate: {
|
||||
type: String,
|
||||
default: 'Hello, <br><br> We’ve received your submission. <br><br> Thank you & have a nice day!',
|
||||
},
|
||||
enabled: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
}
|
||||
},
|
||||
|
||||
hideFooter: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
},
|
||||
|
||||
isLive: {
|
||||
type: Boolean,
|
||||
default: true
|
||||
|
@ -250,6 +201,10 @@ FormSchema.virtual('analytics.views').get(function () {
|
|||
}
|
||||
});
|
||||
|
||||
FormSchema.virtual('analytics.submissions').get(function () {
|
||||
return this.submissions.length;
|
||||
});
|
||||
|
||||
FormSchema.virtual('analytics.conversionRate').get(function () {
|
||||
if(this.analytics && this.analytics.visitors && this.analytics.visitors.length > 0){
|
||||
return this.submissions.length/this.analytics.visitors.length*100;
|
||||
|
@ -333,6 +288,26 @@ FormSchema.plugin(timeStampPlugin, {
|
|||
useVirtual: false
|
||||
});
|
||||
|
||||
FormSchema.pre('save', function (next) {
|
||||
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:
|
||||
break;
|
||||
}
|
||||
next();
|
||||
});
|
||||
|
||||
function getDeletedIndexes(needle, haystack){
|
||||
var deletedIndexes = [];
|
||||
|
||||
|
|
|
@ -9,8 +9,7 @@ var mongoose = require('mongoose'),
|
|||
_ = require('lodash'),
|
||||
Schema = mongoose.Schema,
|
||||
LogicJumpSchema = require('./logic_jump.server.model'),
|
||||
tokgen = require('../libs/tokenGenerator'),
|
||||
constants = require('../libs/constants');
|
||||
tokgen = require('../libs/tokenGenerator');
|
||||
|
||||
var FieldOptionSchema = new Schema({
|
||||
option_id: {
|
||||
|
@ -35,7 +34,21 @@ var RatingFieldSchema = new Schema({
|
|||
},
|
||||
shape: {
|
||||
type: String,
|
||||
enum: constants.ratingShapeTypes
|
||||
enum: [
|
||||
'Heart',
|
||||
'Star',
|
||||
'thumbs-up',
|
||||
'thumbs-down',
|
||||
'Circle',
|
||||
'Square',
|
||||
'Check Circle',
|
||||
'Smile Outlined',
|
||||
'Hourglass',
|
||||
'bell',
|
||||
'Paper Plane',
|
||||
'Comment',
|
||||
'Trash'
|
||||
]
|
||||
},
|
||||
validShapes: {
|
||||
type: [String]
|
||||
|
@ -49,10 +62,6 @@ function BaseFieldSchema(){
|
|||
Schema.apply(this, arguments);
|
||||
|
||||
this.add({
|
||||
newOptionSchema: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
},
|
||||
globalId: {
|
||||
type: String,
|
||||
},
|
||||
|
@ -76,7 +85,6 @@ function BaseFieldSchema(){
|
|||
|
||||
ratingOptions: RatingFieldSchema,
|
||||
fieldOptions: [FieldOptionSchema],
|
||||
|
||||
required: {
|
||||
type: Boolean,
|
||||
default: true
|
||||
|
@ -95,7 +103,29 @@ function BaseFieldSchema(){
|
|||
},
|
||||
fieldType: {
|
||||
type: String,
|
||||
enum: constants.fieldTypes
|
||||
enum: [
|
||||
'textfield',
|
||||
'date',
|
||||
'email',
|
||||
'link',
|
||||
'legal',
|
||||
'url',
|
||||
'textarea',
|
||||
'statement',
|
||||
'welcome',
|
||||
'thankyou',
|
||||
'file',
|
||||
'dropdown',
|
||||
'scale',
|
||||
'rating',
|
||||
'radio',
|
||||
'checkbox',
|
||||
'hidden',
|
||||
'yes_no',
|
||||
'natural',
|
||||
'stripe',
|
||||
'number'
|
||||
]
|
||||
},
|
||||
fieldValue: Schema.Types.Mixed
|
||||
});
|
||||
|
@ -110,7 +140,7 @@ function BaseFieldSchema(){
|
|||
this.validFieldTypes = mongoose.model('Field').schema.path('fieldType').enumValues;
|
||||
|
||||
if(this.fieldType === 'rating' && this.ratingOptions.validShapes.length === 0){
|
||||
this.ratingOptions.validShapes = constants.ratingShapeTypes;
|
||||
this.ratingOptions.validShapes = mongoose.model('RatingOptions').schema.path('shape').enumValues;
|
||||
}
|
||||
|
||||
next();
|
||||
|
@ -173,6 +203,7 @@ FormFieldSchema.pre('save', function(next) {
|
|||
if(this.fieldType === 'dropdown' && this.isSubmission){
|
||||
this.fieldValue = this.fieldValue.option_value;
|
||||
}
|
||||
|
||||
return next();
|
||||
});
|
||||
|
||||
|
|
|
@ -55,18 +55,18 @@ FormSubmissionSchema.pre('save', function (next) {
|
|||
this.form_fields[i].fieldValue = this.form_fields[i].fieldValue.option_value;
|
||||
}
|
||||
|
||||
delete this.form_fields[i].validFieldTypes;
|
||||
delete this.form_fields[i].disabled;
|
||||
delete this.form_fields[i].required;
|
||||
delete this.form_fields[i].isSubmission;
|
||||
delete this.form_fields[i].title;
|
||||
delete this.form_fields[i].fieldOptions;
|
||||
delete this.form_fields[i].ratingOptions;
|
||||
delete this.form_fields[i].logicJump;
|
||||
delete this.form_fields[i].description;
|
||||
delete this.form_fields[i].created;
|
||||
delete this.form_fields[i].lastModified;
|
||||
delete this.form_fields[i].deletePreserved;
|
||||
delete form_fields[i].validFieldTypes;
|
||||
delete form_fields[i].disabled;
|
||||
delete form_fields[i].required;
|
||||
delete form_fields[i].isSubmission;
|
||||
delete form_fields[i].title;
|
||||
delete form_fields[i].fieldOptions;
|
||||
delete form_fields[i].ratingOptions;
|
||||
delete form_fields[i].logicJump;
|
||||
delete form_fields[i].description;
|
||||
delete form_fields[i].created;
|
||||
delete form_fields[i].lastModified;
|
||||
delete form_fields[i].deletePreserved;
|
||||
}
|
||||
next();
|
||||
});
|
||||
|
|
26
app/models/plugins/languagePlugin.js
Normal file
26
app/models/plugins/languagePlugin.js
Normal file
|
@ -0,0 +1,26 @@
|
|||
'use strict';
|
||||
|
||||
const constants = require('../../libs/constants'),
|
||||
config = require('../../../config/config');
|
||||
|
||||
module.exports = exports = function lastModifiedPlugin (schema, options) {
|
||||
schema.add({
|
||||
language: {
|
||||
type: String,
|
||||
enum: constants.languageTypes,
|
||||
default: config.defaultLanguage,
|
||||
required: options.required || 'Must be a valid language'
|
||||
}
|
||||
});
|
||||
|
||||
schema.pre('save', function (next) {
|
||||
var currWord = this.language;
|
||||
|
||||
//English is the default backup language
|
||||
this.language = 'en';
|
||||
if(constants.wordToLangCode.has(currWord)){
|
||||
this.language = constants.wordToLangCode[currWord];
|
||||
}
|
||||
next();
|
||||
});
|
||||
};
|
|
@ -9,8 +9,29 @@ var mongoose = require('mongoose'),
|
|||
config = require('../../config/config'),
|
||||
timeStampPlugin = require('../libs/timestamp.server.plugin'),
|
||||
path = require('path'),
|
||||
querystring = require('querystring'),
|
||||
constants = require('../libs/constants');
|
||||
querystring = require('querystring');
|
||||
|
||||
/**
|
||||
* A Validation function for local strategy properties
|
||||
*/
|
||||
var validateLocalStrategyProperty = function(property) {
|
||||
var propHasLength;
|
||||
if (property) {
|
||||
propHasLength = !!property.length;
|
||||
} else {
|
||||
propHasLength = false;
|
||||
}
|
||||
|
||||
return ((this.provider !== 'local' && !this.updated) || propHasLength);
|
||||
};
|
||||
|
||||
/**
|
||||
* A Validation function for username
|
||||
*/
|
||||
var validateUsername = function(username) {
|
||||
return (username.match(/^[a-zA-Z0-9.-_]+$/) !== null);
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* User Schema
|
||||
|
@ -31,7 +52,7 @@ var UserSchema = new Schema({
|
|||
trim: true,
|
||||
lowercase: true,
|
||||
unique: 'Account already exists with this email',
|
||||
match: [constants.regex.email, 'Please fill a valid email address'],
|
||||
match: [/.+\@.+\..+/, 'Please fill a valid email address'],
|
||||
required: [true, 'Email is required']
|
||||
},
|
||||
username: {
|
||||
|
@ -52,16 +73,18 @@ var UserSchema = new Schema({
|
|||
type: String,
|
||||
default: 'local'
|
||||
},
|
||||
providerData: {},
|
||||
additionalProvidersData: {},
|
||||
roles: {
|
||||
type: [{
|
||||
type: String,
|
||||
enum: constants.userRoleTypes
|
||||
enum: ['user', 'admin', 'superuser']
|
||||
}],
|
||||
default: ['user']
|
||||
},
|
||||
language: {
|
||||
type: String,
|
||||
enum: constants.languageTypes,
|
||||
enum: ['en', 'fr', 'es', 'it', 'de'],
|
||||
default: 'en',
|
||||
},
|
||||
lastModified: {
|
||||
|
@ -88,6 +111,10 @@ var UserSchema = new Schema({
|
|||
}
|
||||
});
|
||||
|
||||
UserSchema.virtual('displayName').get(function () {
|
||||
return this.firstName + ' ' + this.lastName;
|
||||
});
|
||||
|
||||
UserSchema.plugin(timeStampPlugin, {
|
||||
createdPath: 'created',
|
||||
modifiedPath: 'lastModified',
|
||||
|
|
|
@ -31,7 +31,7 @@ module.exports = function(app) {
|
|||
}
|
||||
|
||||
app.route('/forms/:formIdFast([a-zA-Z0-9]+)')
|
||||
.post(forms.createSubmission);
|
||||
.post(forms.createSubmission)
|
||||
|
||||
app.route('/forms')
|
||||
.get(auth.isAuthenticatedOrApiKey, forms.list)
|
||||
|
|
|
@ -12,7 +12,6 @@ module.exports = function(app) {
|
|||
var users = require('../../app/controllers/users.server.controller');
|
||||
|
||||
// Setting up the users profile api
|
||||
app.route('/users/password').post(users.requiresLogin, users.changePassword);
|
||||
app.route('/users/me').get(auth.isAuthenticatedOrApiKey, users.getUser);
|
||||
app.route('/users').put(auth.isAuthenticatedOrApiKey, users.update);
|
||||
|
||||
|
@ -20,7 +19,8 @@ module.exports = function(app) {
|
|||
app.route('/auth/verify/:token').get(users.validateVerificationToken);
|
||||
app.route('/auth/verify').post(users.resendVerificationEmail);
|
||||
|
||||
// Setting up the password reset api
|
||||
// Setting up the users password api
|
||||
app.route('/users/password').post(users.requiresLogin, users.changePassword);
|
||||
app.route('/auth/forgot').post(users.forgot);
|
||||
app.route('/auth/reset/:token').get(users.validateResetToken);
|
||||
app.route('/auth/reset/:token').post(users.reset);
|
||||
|
@ -33,4 +33,7 @@ module.exports = function(app) {
|
|||
app.route('/auth/signout').get(users.signout);
|
||||
|
||||
app.route('/auth/genkey').get(users.requiresLogin, users.generateAPIKey);
|
||||
|
||||
// Finish by binding the user middleware
|
||||
app.param('userId', users.userByID);
|
||||
};
|
||||
|
|
|
@ -69,6 +69,7 @@ describe('Form Routes Unit tests', function() {
|
|||
.send({form: myForm})
|
||||
.expect(401)
|
||||
.end(function(FormSaveErr, FormSaveRes) {
|
||||
console.log(FormSaveRes.text);
|
||||
// Call the assertion callback
|
||||
done(FormSaveErr);
|
||||
});
|
||||
|
@ -166,7 +167,7 @@ describe('Form Routes Unit tests', function() {
|
|||
it(' > should not be able to create a Form if body is empty', function(done) {
|
||||
loginSession.post('/forms')
|
||||
.send({form: null})
|
||||
.expect(400, {'message':'Invalid Input'})
|
||||
.expect(400, {"message":"Invalid Input"})
|
||||
.end(function(FormSaveErr, FormSaveRes) {
|
||||
// Call the assertion callback
|
||||
done(FormSaveErr);
|
||||
|
|
|
@ -17,6 +17,7 @@ var exampleDemo = {
|
|||
address: '880-9650 Velit. St.',
|
||||
city: '',
|
||||
dateOfBirth: '10',
|
||||
displayName: 'Test User',
|
||||
email: 'polydaic@gmail.com',
|
||||
firstName: 'Test User',
|
||||
hin: '',
|
||||
|
@ -81,8 +82,9 @@ describe('FormSubmission Model Unit Tests:', function() {
|
|||
user = new User({
|
||||
firstName: 'Full',
|
||||
lastName: 'Name',
|
||||
email: 'test1@test.com',
|
||||
username: 'test1',
|
||||
displayName: 'Full Name',
|
||||
email: 'test1@test.com'+Date.now(),
|
||||
username: 'test1'+Date.now(),
|
||||
password: 'password',
|
||||
provider: 'local'
|
||||
});
|
||||
|
|
|
@ -21,14 +21,15 @@ var credentials, user;
|
|||
* Form routes tests
|
||||
*/
|
||||
describe('Form Submission Routes Unit tests', function() {
|
||||
var FormObj, _Submission, submissionSession, _SubmissionBody;
|
||||
var FormObj, _Submission, submissionSession, _SubmissionBody
|
||||
|
||||
|
||||
beforeEach(function(done) {
|
||||
|
||||
// Create user credentials
|
||||
credentials = {
|
||||
email: 'test423@test.com',
|
||||
username: 'test534',
|
||||
email: 'test@test.com',
|
||||
username: 'test',
|
||||
password: 'password'
|
||||
};
|
||||
|
||||
|
@ -44,10 +45,7 @@ describe('Form Submission Routes Unit tests', function() {
|
|||
|
||||
// Save a user to the test db and create new Form
|
||||
user.save(function(err) {
|
||||
if(err) {
|
||||
return done(err);
|
||||
}
|
||||
|
||||
if(err) return done(err);
|
||||
FormObj = new Form({
|
||||
title: 'Form Title',
|
||||
language: 'en',
|
||||
|
@ -56,22 +54,7 @@ describe('Form Submission Routes Unit tests', function() {
|
|||
new Field({'fieldType':'textfield', 'title':'First Name', 'fieldValue': ''}),
|
||||
new Field({'fieldType':'checkbox', 'title':'nascar', 'fieldValue': ''}),
|
||||
new Field({'fieldType':'checkbox', 'title':'hockey', 'fieldValue': ''})
|
||||
],
|
||||
selfNotifications: {
|
||||
fromField: mongoose.Types.ObjectId(),
|
||||
toEmails: 'john@smith.com',
|
||||
subject: 'Hello there',
|
||||
htmlTemplate: '<p> A form was submitted </p>',
|
||||
enabled: true
|
||||
},
|
||||
|
||||
respondentNotifications: {
|
||||
toField: mongoose.Types.ObjectId(),
|
||||
fromEmails: 'john@smith.com',
|
||||
subject: 'Tellform: Thank you for filling out this TellForm',
|
||||
htmlTemplate:'Hello, <br><br> We’ve received your submission. <br><br> Thank you & have a nice day!',
|
||||
enabled: true
|
||||
}
|
||||
]
|
||||
});
|
||||
|
||||
FormObj.save(function(formSaveErr, form) {
|
||||
|
@ -254,4 +237,6 @@ describe('Form Submission Routes Unit tests', function() {
|
|||
});
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
});
|
||||
|
|
|
@ -1,94 +0,0 @@
|
|||
'use strict';
|
||||
|
||||
/**
|
||||
* Module dependencies.
|
||||
*/
|
||||
const emailNotifications = require('../../libs/send-email-notifications'),
|
||||
constants = require('../../libs/constants'),
|
||||
mockTransport = require("nodemailer").createTransport("Stub"),
|
||||
config = require('../../../config/config');
|
||||
|
||||
/**
|
||||
* Globals
|
||||
*/
|
||||
const validFormFields = [
|
||||
{fieldType:'textfield', title:'First Name', fieldValue: 'John Smith', deletePreserved: false, globalId:'56340745f59a6fc9e22028e9'},
|
||||
{fieldType:'link', title:'Your Website', fieldValue: 'https://johnsmith.me', deletePreserved: false, globalId:'5c9e22028e907634f45f59a6'},
|
||||
{fieldType:'number', title:'Your Age', fieldValue: 45, deletePreserved: false, globalId:'56e90745f5934fc9e22028a6'}
|
||||
];
|
||||
|
||||
const validFieldDict = {
|
||||
'56340745f59a6fc9e22028e9': 'John Smith',
|
||||
'5c9e22028e907634f45f59a6': 'https://johnsmith.me',
|
||||
'56e90745f5934fc9e22028a6': 45
|
||||
};
|
||||
|
||||
const invalidFormFields = [
|
||||
{fieldType:'textfield', title:'First Name', fieldValue: 'John Smith', deletePreserved: false},
|
||||
{fieldType:'link', title:'Your Website', deletePreserved: false, _id:'5c9e22028e907634f45f59a6'},
|
||||
{fieldType:'number', title:'Your Age'}
|
||||
];
|
||||
|
||||
const htmlTemplate = '<p><var class="tag" id="field:56340745f59a6fc9e22028e9">First Name</var> \
|
||||
<br><var class="tag" id="field:5c9e22028e907634f45f59a6">Your Website</var> \
|
||||
<br><var class="tag" id="field:56e90745f5934fc9e22028a6">Your Age</var></p>';
|
||||
|
||||
const renderedTemplate = '<p>John Smith \
|
||||
<br>https://johnsmith.me \
|
||||
<br>45</p>';
|
||||
|
||||
/**
|
||||
* Unit tests
|
||||
*/
|
||||
describe('Send Email Notification Unit Tests', function() {
|
||||
|
||||
describe('Method createFieldDict', function() {
|
||||
it('should be return a fieldDict from valid form fields', function() {
|
||||
var actualFieldDict = emailNotifications.createFieldDict(validFormFields);
|
||||
actualFieldDict.should.deepEqual(validFieldDict);
|
||||
});
|
||||
|
||||
it('should return empty object if form fields are invalid or empty ', function() {
|
||||
var actualFieldDict = emailNotifications.createFieldDict(invalidFormFields);
|
||||
actualFieldDict.should.be.empty();
|
||||
});
|
||||
});
|
||||
|
||||
describe('Method parseTemplate', function(){
|
||||
it('should properly render a template given a valid field dict', function() {
|
||||
var actualRenderedTemplate = emailNotifications.parseTemplate(htmlTemplate, validFieldDict, constants.varFormat).replace((/ |\r\n|\n|\r|\t/gm),'');
|
||||
actualRenderedTemplate.should.equal(renderedTemplate.replace((/ |\r\n|\n|\r|\t/gm),''));
|
||||
});
|
||||
});
|
||||
|
||||
describe('Method replaceTemplateVal', function() {
|
||||
it('should properly replace a template var in a valid template', function() {
|
||||
var expectedHtml = '<p>John Smith \
|
||||
<br><var class="tag" id="field:5c9e22028e907634f45f59a6">Your Website</var> \
|
||||
<br><var class="tag" id="field:56e90745f5934fc9e22028a6">Your Age</var></p>';
|
||||
|
||||
var actualRenderedTemplate = emailNotifications.replaceTemplateVal('56340745f59a6fc9e22028e9', validFieldDict['56340745f59a6fc9e22028e9'], htmlTemplate, constants.varFormat).replace((/ |\r\n|\n|\r|\t/gm),'');
|
||||
actualRenderedTemplate.should.equal(expectedHtml.replace((/ |\r\n|\n|\r|\t/gm),''));
|
||||
});
|
||||
});
|
||||
|
||||
describe('Method send', function() {
|
||||
this.timeout(10000);
|
||||
const emailSettings = {
|
||||
fromEmails: 'somewhere@somewhere.com',
|
||||
toEmails: 'there@there.com',
|
||||
subject: 'Hello <var class="tag" id="field:56340745f59a6fc9e22028e9">First Name</var>!',
|
||||
htmlTemplate: htmlTemplate
|
||||
};
|
||||
|
||||
const emailTemplateVars = validFieldDict;
|
||||
const varFormat = constants.varFormat;
|
||||
|
||||
it('should properly replace a template var in a valid template', function(done) {
|
||||
emailNotifications.send(emailSettings, emailTemplateVars, mockTransport, varFormat, function(err){
|
||||
should.not.exist(err);
|
||||
done();
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
|
@ -1,72 +1,70 @@
|
|||
'use strict';
|
||||
|
||||
// Dependencies
|
||||
var util = require('util'),
|
||||
assert = require('assert'),
|
||||
mongoose = require('mongoose'),
|
||||
timestamp = require('../../libs/timestamp.server.plugin'),
|
||||
Schema = mongoose.Schema,
|
||||
ObjectId = Schema.ObjectId;
|
||||
var util = require('util')
|
||||
, assert = require('assert')
|
||||
, mongoose = require('mongoose')
|
||||
, timestamp = require('../../libs/timestamp.server.plugin')
|
||||
, Schema = mongoose.Schema
|
||||
, ObjectId = Schema.ObjectId
|
||||
|
||||
// Run tests
|
||||
describe('Timestamp', function () {
|
||||
describe('#default()', function () {
|
||||
var FooSchema = new Schema();
|
||||
FooSchema.plugin(timestamp);
|
||||
var FooModel = mongoose.model('timeFoo', FooSchema),
|
||||
bar = new FooModel();
|
||||
var FooSchema = new Schema()
|
||||
FooSchema.plugin(timestamp)
|
||||
var FooModel = mongoose.model('timeFoo', FooSchema)
|
||||
, bar = new FooModel()
|
||||
|
||||
before(function () {
|
||||
FooModel.remove(function (err) {
|
||||
assert.strictEqual(err, null);
|
||||
});
|
||||
});
|
||||
assert.strictEqual(err, null)
|
||||
})
|
||||
})
|
||||
|
||||
it('should have custom properties', function (done) {
|
||||
assert.strictEqual(typeof FooSchema.virtuals.created, 'object');
|
||||
assert.strictEqual(typeof FooSchema.paths.modified, 'object');
|
||||
done();
|
||||
});
|
||||
assert.strictEqual(typeof FooSchema.virtuals.created, 'object')
|
||||
assert.strictEqual(typeof FooSchema.paths.modified, 'object')
|
||||
done()
|
||||
})
|
||||
|
||||
it('should create the default attributes', function (done) {
|
||||
bar.save(function (err, doc) {
|
||||
assert.strictEqual(err, null);
|
||||
assert.strictEqual(util.isDate(doc.created), true);
|
||||
assert.strictEqual(util.isDate(doc.modified), true);
|
||||
done();
|
||||
});
|
||||
});
|
||||
});
|
||||
assert.strictEqual(err, null)
|
||||
assert.strictEqual(util.isDate(doc.created), true)
|
||||
assert.strictEqual(util.isDate(doc.modified), true)
|
||||
done()
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
describe('#custom()', function () {
|
||||
var FooSchema = new Schema();
|
||||
var FooSchema = new Schema()
|
||||
FooSchema.plugin(timestamp, {
|
||||
createdPath: 'oh',
|
||||
modifiedPath: 'hai',
|
||||
useVirtual: false
|
||||
});
|
||||
var BarModel = mongoose.model('timeBar', FooSchema),
|
||||
bar = new BarModel();
|
||||
createdPath: 'oh'
|
||||
, modifiedPath: 'hai'
|
||||
, useVirtual: false
|
||||
})
|
||||
var BarModel = mongoose.model('timeBar', FooSchema)
|
||||
, bar = new BarModel()
|
||||
|
||||
before(function () {
|
||||
BarModel.remove(function (err) {
|
||||
assert.strictEqual(err, null);
|
||||
});
|
||||
});
|
||||
assert.strictEqual(err, null)
|
||||
})
|
||||
})
|
||||
|
||||
it('should have custom properties', function (done) {
|
||||
assert.strictEqual(typeof FooSchema.paths.oh, 'object');
|
||||
assert.strictEqual(typeof FooSchema.paths.hai, 'object');
|
||||
done();
|
||||
});
|
||||
assert.strictEqual(typeof FooSchema.paths.oh, 'object')
|
||||
assert.strictEqual(typeof FooSchema.paths.hai, 'object')
|
||||
done()
|
||||
})
|
||||
|
||||
it('should create custom attributes', function (done) {
|
||||
bar.save(function (err, doc) {
|
||||
assert.strictEqual(err, null);
|
||||
assert.strictEqual(util.isDate(doc.oh), true);
|
||||
assert.strictEqual(util.isDate(doc.hai), true);
|
||||
done();
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
assert.strictEqual(err, null)
|
||||
assert.strictEqual(util.isDate(doc.oh), true)
|
||||
assert.strictEqual(util.isDate(doc.hai), true)
|
||||
done()
|
||||
})
|
||||
})
|
||||
})
|
||||
})
|
|
@ -6,23 +6,24 @@ var should = require('should'),
|
|||
mongoose = require('mongoose'),
|
||||
User = mongoose.model('User'),
|
||||
config = require('../../config/config'),
|
||||
tmpUser = mongoose.model(config.tempUserCollection),
|
||||
async = require('async');
|
||||
tmpUser = mongoose.model(config.tempUserCollection);
|
||||
|
||||
/**
|
||||
* Globals
|
||||
*/
|
||||
var credentials, _User, userSession;
|
||||
var credentials, _User, activateToken, userSession;
|
||||
|
||||
/**
|
||||
* Form routes tests
|
||||
*/
|
||||
describe('User CRUD tests', function() {
|
||||
before(function() {
|
||||
this.timeout(30000);
|
||||
|
||||
beforeEach(function() {
|
||||
// Create user credentials
|
||||
credentials = {
|
||||
email: 'test099@test.com',
|
||||
username: 'test099',
|
||||
email: 'test732@test.com',
|
||||
username: 'test732',
|
||||
password: 'password3223'
|
||||
};
|
||||
|
||||
|
@ -30,424 +31,77 @@ describe('User CRUD tests', function() {
|
|||
_User = {
|
||||
email: credentials.email,
|
||||
username: credentials.username,
|
||||
password: credentials.password,
|
||||
firstName: 'John',
|
||||
lastName: 'Smith'
|
||||
password: credentials.password
|
||||
};
|
||||
|
||||
//Initialize Session
|
||||
userSession = Session(app);
|
||||
});
|
||||
|
||||
describe(' > Create, Verify and Activate a User > ', function() {
|
||||
this.timeout(10000);
|
||||
it('should be able to create and activate a User', function(done) {
|
||||
async.waterfall([
|
||||
function(callback) {
|
||||
userSession.post('/auth/signup')
|
||||
.send(_User)
|
||||
.expect(200)
|
||||
.end(function(err) {
|
||||
callback(err);
|
||||
});
|
||||
},
|
||||
function(callback) {
|
||||
tmpUser.findOne({username: _User.username})
|
||||
.lean()
|
||||
.exec(function (err, user) {
|
||||
it(' > Create, Verify and Activate a User > ', function() {
|
||||
|
||||
it('should be able to create a temporary (non-activated) User', function(done) {
|
||||
userSession.post('/auth/signup')
|
||||
.send(_User)
|
||||
.expect(200)
|
||||
.end(function(FormSaveErr) {
|
||||
// Handle error
|
||||
should.not.exist(FormSaveErr);
|
||||
|
||||
tmpUser.findOne({username: _User.username}, function (err, user) {
|
||||
should.not.exist(err);
|
||||
should.exist(user);
|
||||
|
||||
_User.username.should.equal(user.username);
|
||||
_User.firstName.should.equal(user.firstName);
|
||||
_User.lastName.should.equal(user.lastName);
|
||||
callback(err, user.GENERATED_VERIFYING_URL);
|
||||
activateToken = user.GENERATED_VERIFYING_URL;
|
||||
|
||||
userSession.get('/auth/verify/'+activateToken)
|
||||
.expect(200)
|
||||
.end(function(VerifyErr, VerifyRes) {
|
||||
// Handle error
|
||||
if (VerifyErr) {
|
||||
return done(VerifyErr);
|
||||
}
|
||||
|
||||
(VerifyRes.text).should.equal('User successfully verified');
|
||||
|
||||
userSession.post('/auth/signin')
|
||||
.send(credentials)
|
||||
.expect('Content-Type', /json/)
|
||||
.expect(200)
|
||||
.end(function(signinErr, signinRes) {
|
||||
// Handle signin error
|
||||
if (signinErr) {
|
||||
return done(signinErr);
|
||||
}
|
||||
|
||||
var user = signinRes.body;
|
||||
(user.username).should.equal(credentials.username);
|
||||
|
||||
userSession.get('/auth/signout')
|
||||
.expect(200)
|
||||
.end(function(signoutErr, signoutRes) {
|
||||
|
||||
// Handle signout error
|
||||
if (signoutErr) {
|
||||
return done(signoutErr);
|
||||
}
|
||||
|
||||
(signoutRes.text).should.equal('You have successfully logged out.');
|
||||
|
||||
done();
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
},
|
||||
function(activateToken, callback) {
|
||||
userSession.get('/auth/verify/' + activateToken)
|
||||
.expect(200)
|
||||
.end(function(err, res) {
|
||||
(res.text).should.equal('User successfully verified');
|
||||
callback(err);
|
||||
});
|
||||
},
|
||||
function(callback) {
|
||||
userSession.post('/auth/signin')
|
||||
.send(credentials)
|
||||
.expect('Content-Type', /json/)
|
||||
.expect(200)
|
||||
.end(function(err, res) {
|
||||
(res.body.username).should.equal(credentials.username);
|
||||
callback(err);
|
||||
});
|
||||
},
|
||||
function(callback) {
|
||||
userSession.get('/auth/signout')
|
||||
.expect(200)
|
||||
.end(function(err, res) {
|
||||
(res.text).should.equal('You have successfully logged out.');
|
||||
callback(err);
|
||||
});
|
||||
},
|
||||
function(callback) {
|
||||
User.findOne({ username: _User.username })
|
||||
.lean()
|
||||
.exec(function(err, user){
|
||||
should.exist(user);
|
||||
callback(err);
|
||||
});
|
||||
}
|
||||
], function (err) {
|
||||
done(err);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
after(function(done){
|
||||
User.remove().exec(done);
|
||||
});
|
||||
});
|
||||
|
||||
describe(' > Reset Password > ', function(){
|
||||
this.timeout(10000);
|
||||
beforeEach(function(done){
|
||||
var UserObj = new User(_User);
|
||||
UserObj.save(function(err){
|
||||
done(err);
|
||||
});
|
||||
});
|
||||
|
||||
it('should be able to reset password of a created User with a valid passwordResetToken', function(done) {
|
||||
var changedPassword = 'password1234';
|
||||
var resetPasswordToken;
|
||||
|
||||
async.waterfall([
|
||||
function(callback) {
|
||||
userSession.post('/auth/forgot')
|
||||
.send({ username: _User.username })
|
||||
.expect(200)
|
||||
.end(function(err) {
|
||||
callback(err);
|
||||
});
|
||||
},
|
||||
function(callback) {
|
||||
User.findOne({ username: _User.username })
|
||||
.lean()
|
||||
.exec(function(err, user){
|
||||
if(err){
|
||||
callback(err);
|
||||
}
|
||||
callback(null, user.resetPasswordToken);
|
||||
});
|
||||
},
|
||||
function(resetPasswordToken, callback) {
|
||||
userSession.get('/auth/reset/' + resetPasswordToken)
|
||||
.expect(302)
|
||||
.end(function(err) {
|
||||
callback(err, resetPasswordToken);
|
||||
});
|
||||
},
|
||||
function(resetPasswordToken, callback) {
|
||||
userSession.post('/auth/reset/' + resetPasswordToken)
|
||||
.send({
|
||||
newPassword: changedPassword,
|
||||
verifyPassword: changedPassword
|
||||
})
|
||||
.expect(200)
|
||||
.end(function(err, res) {
|
||||
callback(err, resetPasswordToken);
|
||||
});
|
||||
},
|
||||
function(resetPasswordToken, callback) {
|
||||
User.findOne({ username: _User.username })
|
||||
.exec(function(err, user){
|
||||
should.exist(user);
|
||||
user.authenticate(changedPassword).should.be.true();
|
||||
should.not.exist(user.resetPasswordToken);
|
||||
|
||||
callback(err);
|
||||
});
|
||||
}
|
||||
], function (err, result) {
|
||||
credentials.password = changedPassword;
|
||||
done(err);
|
||||
});
|
||||
});
|
||||
|
||||
it('should be not able to reset password of a created User with a invalid passwordResetToken', function(done) {
|
||||
var changedPassword = 'password4321';
|
||||
var resetPasswordToken = 'thisIsNotAValidToken';
|
||||
|
||||
async.waterfall([
|
||||
function(callback) {
|
||||
userSession.post('/auth/forgot')
|
||||
.send({ username: credentials.username })
|
||||
.expect(200)
|
||||
.end(function(err, res) {
|
||||
callback(err);
|
||||
});
|
||||
},
|
||||
function(callback) {
|
||||
userSession.get('/auth/reset/' + resetPasswordToken)
|
||||
.expect(400)
|
||||
.end(function(err) {
|
||||
callback(err);
|
||||
});
|
||||
},
|
||||
function(callback) {
|
||||
userSession.post('/auth/reset/' + resetPasswordToken)
|
||||
.send({
|
||||
newPassword: changedPassword,
|
||||
verifyPassword: changedPassword
|
||||
})
|
||||
.expect(400)
|
||||
.end(function(err, res) {
|
||||
callback(err);
|
||||
});
|
||||
},
|
||||
function(callback) {
|
||||
User.findOne({ username: _User.username })
|
||||
.exec(function(err, user){
|
||||
should.exist(user);
|
||||
user.authenticate(changedPassword).should.be.false();
|
||||
callback(err);
|
||||
});
|
||||
}
|
||||
], function (err, result) {
|
||||
done(err);
|
||||
});
|
||||
});
|
||||
|
||||
afterEach(function(done){
|
||||
User.remove({ username: credentials.username }).exec(done);
|
||||
});
|
||||
});
|
||||
|
||||
describe(' > User Profile Changes > ', function(){
|
||||
var profileSession = new Session(app);
|
||||
|
||||
this.timeout(10000);
|
||||
beforeEach(function(done){
|
||||
var UserObj = new User(_User);
|
||||
UserObj.save(function(err, user){
|
||||
done(err);
|
||||
});
|
||||
});
|
||||
|
||||
it('should be able to change password when logged in', function(done) {
|
||||
var changedPassword = 'aVeryBadPassword';
|
||||
|
||||
async.waterfall([
|
||||
function(callback) {
|
||||
userSession.post('/auth/signin')
|
||||
.send({
|
||||
username: _User.username,
|
||||
password: _User.password
|
||||
})
|
||||
.expect(200)
|
||||
.end(function(err, res) {
|
||||
callback(err);
|
||||
});
|
||||
},
|
||||
function(callback) {
|
||||
userSession.post('/users/password')
|
||||
.send({
|
||||
currentPassword: _User.password,
|
||||
newPassword: changedPassword,
|
||||
verifyPassword: changedPassword
|
||||
})
|
||||
.expect(200)
|
||||
.end(function(err, res) {
|
||||
callback(err);
|
||||
});
|
||||
},
|
||||
function(callback) {
|
||||
User.findOne({ username: _User.username })
|
||||
.exec(function(err, user){
|
||||
user.authenticate(changedPassword).should.be.true();
|
||||
callback(err);
|
||||
});
|
||||
}
|
||||
], function (err) {
|
||||
done(err);
|
||||
});
|
||||
});
|
||||
|
||||
it('should be able to update user when logged in', function(done) {
|
||||
var newUser = {};
|
||||
newUser.firstName = 'goodnight';
|
||||
newUser.lastName = 'everyone';
|
||||
|
||||
newUser.email = 'grcg@gcrc.com';
|
||||
newUser.username = 'grcg';
|
||||
|
||||
async.waterfall([
|
||||
function(callback) {
|
||||
userSession.post('/auth/signin')
|
||||
.send({
|
||||
username: _User.username,
|
||||
password: _User.password
|
||||
})
|
||||
.expect(200)
|
||||
.end(function(err, res) {
|
||||
callback(err);
|
||||
});
|
||||
},
|
||||
function(callback) {
|
||||
userSession.put('/users')
|
||||
.send(newUser)
|
||||
.expect(200)
|
||||
.end(function(err, res) {
|
||||
callback(err);
|
||||
});
|
||||
},
|
||||
function(callback) {
|
||||
User.findOne({ username: newUser.username })
|
||||
.exec(function(err, user){
|
||||
user.firstName.should.equal(newUser.firstName);
|
||||
user.lastName.should.equal(newUser.lastName);
|
||||
user.email.should.equal(newUser.email);
|
||||
user.username.should.equal(newUser.username);
|
||||
callback(err);
|
||||
});
|
||||
}
|
||||
], function (err) {
|
||||
done(err);
|
||||
});
|
||||
});
|
||||
|
||||
it('should be able to fetch user when logged in', function(done) {
|
||||
async.waterfall([
|
||||
function(callback) {
|
||||
userSession.post('/auth/signin')
|
||||
.send({
|
||||
username: _User.username,
|
||||
password: _User.password
|
||||
})
|
||||
.expect(200)
|
||||
.end(function(err, res) {
|
||||
callback(err);
|
||||
});
|
||||
},
|
||||
function(callback) {
|
||||
userSession.get('/users/me')
|
||||
.expect(200)
|
||||
.end(function(err, res) {
|
||||
var user = res.body;
|
||||
user.firstName.should.equal(_User.firstName);
|
||||
user.lastName.should.equal(_User.lastName);
|
||||
user.email.should.equal(_User.email);
|
||||
user.username.should.equal(_User.username);
|
||||
callback(err);
|
||||
});
|
||||
}
|
||||
], function (err) {
|
||||
done(err);
|
||||
});
|
||||
});
|
||||
|
||||
afterEach(function(done){
|
||||
userSession.get('/auth/signout')
|
||||
.end(function(err, res) {
|
||||
User.remove().exec(done);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe(' > User API > ', function(){
|
||||
var apiKey;
|
||||
|
||||
this.timeout(10000);
|
||||
before(function(done){
|
||||
var UserObj = new User(_User);
|
||||
UserObj.save(function(err, user){
|
||||
done(err);
|
||||
});
|
||||
});
|
||||
|
||||
it('should be able to request API Key', function(done) {
|
||||
async.waterfall([
|
||||
function(callback) {
|
||||
userSession.post('/auth/signin')
|
||||
.send({
|
||||
username: _User.username,
|
||||
password: _User.password
|
||||
})
|
||||
.expect(200)
|
||||
.end(function(err, res) {
|
||||
callback(err);
|
||||
});
|
||||
},
|
||||
function(callback) {
|
||||
userSession.get('/auth/genkey')
|
||||
.expect(200)
|
||||
.end(function(err, res) {
|
||||
apiKey = res.body.apiKey;
|
||||
callback(err);
|
||||
});
|
||||
},
|
||||
function(callback) {
|
||||
userSession.get('/auth/signout')
|
||||
.expect(200)
|
||||
.end(function(err, res) {
|
||||
callback(err);
|
||||
});
|
||||
},
|
||||
function(callback) {
|
||||
userSession.get('/users/me?apikey=' + apiKey)
|
||||
.expect(200)
|
||||
.end(function(err, res) {
|
||||
var user = res.body;
|
||||
|
||||
user.firstName.should.equal(_User.firstName);
|
||||
user.lastName.should.equal(_User.lastName);
|
||||
user.email.should.equal(_User.email);
|
||||
user.username.should.equal(_User.username);
|
||||
callback(err);
|
||||
});
|
||||
},
|
||||
], function (err) {
|
||||
done(err);
|
||||
});
|
||||
});
|
||||
|
||||
it('should be able to update user with API key', function(done) {
|
||||
var newUser = {};
|
||||
newUser.firstName = 'goodnight';
|
||||
newUser.lastName = 'everyone';
|
||||
|
||||
newUser.email = 'grcg@gcrc.com';
|
||||
newUser.username = 'grcg';
|
||||
|
||||
async.waterfall([
|
||||
function(callback) {
|
||||
userSession.put('/users?apikey=' + apiKey)
|
||||
.send(newUser)
|
||||
.expect(200)
|
||||
.end(function(err, res) {
|
||||
callback(err);
|
||||
});
|
||||
},
|
||||
function(callback) {
|
||||
User.findOne({ username: newUser.username })
|
||||
.exec(function(err, user){
|
||||
user.firstName.should.equal(newUser.firstName);
|
||||
user.lastName.should.equal(newUser.lastName);
|
||||
user.email.should.equal(newUser.email);
|
||||
user.username.should.equal(newUser.username);
|
||||
callback(err);
|
||||
});
|
||||
}
|
||||
], function (err) {
|
||||
done(err);
|
||||
});
|
||||
});
|
||||
|
||||
after(function(done){
|
||||
User.remove().exec(done);
|
||||
});
|
||||
});
|
||||
|
||||
after(function(done) {
|
||||
afterEach(function(done) {
|
||||
User.remove().exec(function () {
|
||||
tmpUser.remove().exec(function(){
|
||||
userSession.destroy();
|
||||
|
|
|
@ -9,4 +9,4 @@ block content
|
|||
div.col-md-12.text-center(style="padding-bottom: 50px;")
|
||||
| #{error}
|
||||
else
|
||||
div.col-md-12.text-center(style="padding-bottom: 50px;")=__('500_BODY')
|
||||
div.col-md-12.text-center(style="padding-bottom: 50px;")=__('500_BODY')
|
||||
|
|
|
@ -59,6 +59,9 @@ html(lang='en', xmlns='http://www.w3.org/1999/xhtml')
|
|||
script(type='text/javascript').
|
||||
socketUrl = "!{socketUrl}"
|
||||
|
||||
//JSEP
|
||||
script(src='https://cdn.jsdelivr.net/npm/jsep@0.3.4/build/jsep.min.js', type='text/javascript')
|
||||
|
||||
script(src='/static/lib/jquery/dist/jquery.min.js', type='text/javascript')
|
||||
link(rel='stylesheet', href='/static/lib/font-awesome/css/font-awesome.min.css')
|
||||
link(rel='stylesheet', href='/static/lib/bootstrap/dist/css/bootstrap.min.css')
|
||||
|
@ -78,15 +81,13 @@ html(lang='en', xmlns='http://www.w3.org/1999/xhtml')
|
|||
|
||||
//Socket.io Client Dependency
|
||||
script(src='/static/lib/socket.io-client/dist/socket.io.min.js')
|
||||
script(src='/static/lib/jquery-ui/jquery-ui.js', type='text/javascript')
|
||||
|
||||
//Minified Bower Dependencies
|
||||
script(src='/static/lib/angular/angular.min.js')
|
||||
script(src='/static/dist/vendor.min.js')
|
||||
script(src='/static/dist/form-vendor.min.js')
|
||||
script(src='/static/lib/angular-ui-date/src/date.js', type='text/javascript')
|
||||
|
||||
script(src='/static/lib/jquery-ui/jquery-ui.js', type='text/javascript')
|
||||
script(src='https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js', integrity='sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa', crossorigin='anonymous')
|
||||
|
||||
//Application JavaScript Files
|
||||
each jsFile in formJSFiles
|
||||
script(type='text/javascript', src=jsFile)
|
||||
|
|
|
@ -3,9 +3,7 @@ extends layout.server.view.pug
|
|||
block content
|
||||
section.content(ui-view='', ng-cloak='')
|
||||
|
||||
|
||||
link(rel='stylesheet', href='/static/lib/jquery-ui/themes/flick/jquery-ui.min.css')
|
||||
script(src='/static/lib/jquery/jquery.min.js')
|
||||
script(src='/static/lib/file-saver.js/FileSaver.js', type='text/javascript')
|
||||
|
||||
//Embedding The User Object
|
||||
script(type='text/javascript').
|
||||
|
|
|
@ -31,8 +31,8 @@ html(lang='en', xmlns='http://www.w3.org/1999/xhtml')
|
|||
|
||||
// Fav Icon
|
||||
link(href='/static/modules/core/img/brand/favicon.ico', rel='shortcut icon', type='image/x-icon')
|
||||
link(rel='stylesheet', href='/static/lib/font-awesome/css/font-awesome.min.css')
|
||||
link(rel='stylesheet', href='/static/lib/bootstrap/dist/css/bootstrap.min.css')
|
||||
link(rel='stylesheet', href='https://maxcdn.bootstrapcdn.com/font-awesome/4.6.1/css/font-awesome.min.css')
|
||||
link(rel='stylesheet', href='https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css', integrity='sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u', crossorigin='anonymous')
|
||||
link(rel='stylesheet', href='https://fonts.googleapis.com/css?family=Source+Sans+Pro:300,400,600,700,900')
|
||||
|
||||
//Bower CSS dependencies
|
||||
|
@ -40,6 +40,7 @@ html(lang='en', xmlns='http://www.w3.org/1999/xhtml')
|
|||
link(rel='stylesheet', href=bowerCssFile)
|
||||
link(rel='stylesheet', href='/static/lib/angular-input-stars/angular-input-stars.css')
|
||||
link(rel='stylesheet', href='/static/lib/jquery-ui/themes/flick/jquery-ui.css')
|
||||
link(rel='stylesheet', href='/static/modules/core/css/github-fork-ribbon.css')
|
||||
// end Bower CSS dependencies
|
||||
|
||||
//Application CSS Files
|
||||
|
|
15
bower.json
15
bower.json
|
@ -25,6 +25,7 @@
|
|||
"angular-permission": "~1.1.1",
|
||||
"file-saver.js": "~1.20150507.2",
|
||||
"angular-bootstrap-colorpicker": "~3.0.19",
|
||||
"angular-ui-router-tabs": "~1.7.0",
|
||||
"angular-scroll": "^1.0.0",
|
||||
"angular-sanitize": "1.4.14",
|
||||
"v-button": "^1.1.1",
|
||||
|
@ -32,30 +33,26 @@
|
|||
"raven-js": "^3.0.4",
|
||||
"tableExport.jquery.plugin": "^1.5.1",
|
||||
"js-yaml": "^3.6.1",
|
||||
"angular-ui-select": "https://github.com/tellform/ui-select.git#compiled",
|
||||
"angular-translate": "~2.11.0",
|
||||
"ng-translate": "*",
|
||||
"deep-diff": "^0.3.4",
|
||||
"jsep": "^0.3.1",
|
||||
"jsep": "0.3.1",
|
||||
"ngclipboard": "^1.1.1",
|
||||
"mobile-detect": "^1.3.3",
|
||||
"socket.io-client": "^1.7.2",
|
||||
"css-toggle-switch": "^4.0.2",
|
||||
"angular-strap": "^2.3.12",
|
||||
"textAngular": "^1.5.16",
|
||||
"angular-ui-select": "^0.19.8",
|
||||
"angular-bootstrap-switch": "^0.5.2",
|
||||
"jquery": "^3.2.1"
|
||||
"angular-strap": "^2.3.12"
|
||||
},
|
||||
"resolutions": {
|
||||
"angular-bootstrap": "^0.14.0",
|
||||
"angular": "1.4.14",
|
||||
"angular-ui-select": "compiled",
|
||||
"jspdf": "~1.0.178",
|
||||
"angular-sanitize": "1.4.14",
|
||||
"angular-ui-sortable": "^0.17.1",
|
||||
"angular-ui-date": "~0.0.11",
|
||||
"angular-input-stars-directive": "master",
|
||||
"angular-ui-select": "^0.19.8",
|
||||
"jquery": "^3.2.1"
|
||||
"angular-input-stars-directive": "master"
|
||||
},
|
||||
"overrides": {
|
||||
"BOWER-PACKAGE": {
|
||||
|
|
2
config/env/all.js
vendored
2
config/env/all.js
vendored
|
@ -40,7 +40,7 @@ module.exports = {
|
|||
options: process.env.MAILER_SMTP_HOST ? { //Uses custom SMTP if MAILER_SMTP_HOST is set
|
||||
host: process.env.MAILER_SMTP_HOST || '',
|
||||
port: process.env.MAILER_SMTP_PORT || 465,
|
||||
secure: process.env.MAILER_SMTP_SECURE || true,
|
||||
secure: (process.env.MAILER_SMTP_SECURE === 'TRUE'),
|
||||
auth: {
|
||||
user: process.env.MAILER_EMAIL_ID || '',
|
||||
pass: process.env.MAILER_PASSWORD || ''
|
||||
|
|
2
config/env/development.js
vendored
2
config/env/development.js
vendored
|
@ -21,7 +21,7 @@ module.exports = {
|
|||
options: process.env.MAILER_SMTP_HOST ? { //Uses custom SMTP if MAILER_SMTP_HOST is set
|
||||
host: process.env.MAILER_SMTP_HOST || '',
|
||||
port: process.env.MAILER_SMTP_PORT || 465,
|
||||
secure: process.env.MAILER_SMTP_SECURE || true,
|
||||
secure: (process.env.MAILER_SMTP_SECURE === 'TRUE'),
|
||||
auth: {
|
||||
user: process.env.MAILER_EMAIL_ID || '',
|
||||
pass: process.env.MAILER_PASSWORD || ''
|
||||
|
|
60
config/env/secure.js
vendored
Executable file
60
config/env/secure.js
vendored
Executable file
|
@ -0,0 +1,60 @@
|
|||
'use strict';
|
||||
|
||||
module.exports = {
|
||||
baseUrl: 'https://forms.polydaic.com',
|
||||
port: 8443,
|
||||
db: {
|
||||
uri: process.env.MONGOHQ_URL || process.env.MONGOLAB_URI || process.env.MONGODB_URI || 'mongodb://127.0.0.1/mean',
|
||||
options: {
|
||||
user: '',
|
||||
pass: ''
|
||||
}
|
||||
},
|
||||
log: {
|
||||
// Can specify one of 'combined', 'common', 'dev', 'short', 'tiny'
|
||||
format: 'combined',
|
||||
// Stream defaults to process.stdout
|
||||
// Uncomment to enable logging to a log on the file system
|
||||
options: {
|
||||
stream: 'access.log'
|
||||
}
|
||||
},
|
||||
|
||||
sessionCookie: {
|
||||
path: '/',
|
||||
httpOnly: false,
|
||||
// If secure is set to true then it will cause the cookie to be set
|
||||
// only when SSL-enabled (HTTPS) is used, and otherwise it won't
|
||||
// set a cookie. 'true' is recommended yet it requires the above
|
||||
// mentioned pre-requisite.
|
||||
secure: true,
|
||||
// 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: 7200,
|
||||
// To set the cookie in a specific domain uncomment the following
|
||||
// setting:
|
||||
domain: process.env.BASE_URL || 'localhost:3000'
|
||||
},
|
||||
assets: {
|
||||
css: 'public/dist/application.min.css',
|
||||
js: 'public/dist/application.min.js'
|
||||
},
|
||||
mailer: {
|
||||
from: process.env.MAILER_FROM || '',
|
||||
options: process.env.MAILER_SMTP_HOST ? { //Uses custom SMTP if MAILER_SMTP_HOST is set
|
||||
host: process.env.MAILER_SMTP_HOST || '',
|
||||
port: process.env.MAILER_SMTP_PORT || 587,
|
||||
secure: (process.env.MAILER_SMTP_SECURE === 'TRUE'),
|
||||
auth: {
|
||||
user: process.env.MAILER_EMAIL_ID || '',
|
||||
pass: process.env.MAILER_PASSWORD || ''
|
||||
}
|
||||
} : {
|
||||
service: process.env.MAILER_SERVICE_PROVIDER || '',
|
||||
auth: {
|
||||
user: process.env.MAILER_EMAIL_ID || '',
|
||||
pass: process.env.MAILER_PASSWORD || ''
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
2
config/env/test.js
vendored
2
config/env/test.js
vendored
|
@ -30,7 +30,7 @@ module.exports = {
|
|||
options: process.env.MAILER_SMTP_HOST ? { //Uses custom SMTP if MAILER_SMTP_HOST is set
|
||||
host: process.env.MAILER_SMTP_HOST || '',
|
||||
port: process.env.MAILER_SMTP_PORT || 587,
|
||||
secure: process.env.MAILER_SMTP_SECURE || true,
|
||||
secure: (process.env.MAILER_SMTP_SECURE === 'TRUE'),
|
||||
auth: {
|
||||
user: process.env.MAILER_EMAIL_ID || '',
|
||||
pass: process.env.MAILER_PASSWORD || ''
|
||||
|
|
|
@ -39,9 +39,8 @@ var configureSocketIO = function (app, db) {
|
|||
var supportedLanguages = ['en', 'de', 'fr', 'it', 'es'];
|
||||
|
||||
function containsAnySupportedLanguages(preferredLanguages){
|
||||
var i, currIndex;
|
||||
for (i = 0; i < preferredLanguages.length; i++) {
|
||||
currIndex = supportedLanguages.indexOf(preferredLanguages[i]);
|
||||
for (var i = 0; i < preferredLanguages.length; i++) {
|
||||
var currIndex = supportedLanguages.indexOf(preferredLanguages[i]);
|
||||
if (currIndex > -1) {
|
||||
return supportedLanguages[currIndex];
|
||||
}
|
||||
|
@ -187,6 +186,24 @@ module.exports = function(db) {
|
|||
level: 9
|
||||
}));
|
||||
|
||||
//Setup i18n
|
||||
i18n.configure({
|
||||
locales: supportedLanguages,
|
||||
directory: __dirname + '/locales',
|
||||
defaultLocale: 'en',
|
||||
cookie: 'userLang'
|
||||
});
|
||||
|
||||
app.use(i18n.init);
|
||||
|
||||
app.use(function(req, res, next) {
|
||||
// express helper for natively supported engines
|
||||
res.locals.__ = res.__ = function() {
|
||||
return i18n.__.apply(req, arguments);
|
||||
};
|
||||
|
||||
next();
|
||||
});
|
||||
|
||||
// Set template engine as defined in the config files
|
||||
app.engine('server.view.pug', consolidate.pug);
|
||||
|
@ -227,6 +244,7 @@ module.exports = function(db) {
|
|||
|
||||
// Setting the app router and static folder
|
||||
app.use('/static', express.static(path.resolve('./public')));
|
||||
app.use('/uploads', express.static(path.resolve('./uploads')));
|
||||
|
||||
// CookieParser should be above session
|
||||
app.use(cookieParser());
|
||||
|
@ -248,20 +266,10 @@ module.exports = function(db) {
|
|||
app.use(passport.initialize());
|
||||
app.use(passport.session());
|
||||
|
||||
//Setup i18n
|
||||
i18n.configure({
|
||||
locales: supportedLanguages,
|
||||
directory: __dirname + '/locales',
|
||||
defaultLocale: 'en',
|
||||
cookie: 'userLang'
|
||||
});
|
||||
|
||||
app.use(i18n.init);
|
||||
|
||||
//Visitor Language Detection
|
||||
app.use(function(req, res, next) {
|
||||
var acceptLanguage = req.headers['accept-language'];
|
||||
|
||||
var languages, supportedLanguage;
|
||||
|
||||
if(acceptLanguage){
|
||||
|
@ -271,12 +279,13 @@ module.exports = function(db) {
|
|||
|
||||
if(!req.user && supportedLanguage !== null){
|
||||
var currLanguage = res.cookie('userLang');
|
||||
|
||||
if(currLanguage && currLanguage !== supportedLanguage || !currLanguage){
|
||||
res.clearCookie('userLang');
|
||||
res.cookie('userLang', supportedLanguage, { maxAge: 90000, httpOnly: true });
|
||||
} else if(req.user && (!req.cookies.hasOwnProperty('userLang') || req.cookies.userLang !== req.user.language) ){
|
||||
res.cookie('userLang', req.user.language, { maxAge: 90000, httpOnly: true });
|
||||
}
|
||||
} else if(req.user && (!req.cookies.hasOwnProperty('userLang') || req.cookies['userLang'] !== req.user.language) ){
|
||||
res.cookie('userLang', req.user.language, { maxAge: 90000, httpOnly: true });
|
||||
}
|
||||
next();
|
||||
});
|
||||
|
@ -324,7 +333,8 @@ module.exports = function(db) {
|
|||
|
||||
// Error page
|
||||
res.status(500).render('500', {
|
||||
error: err.stack
|
||||
__: i18n.__,
|
||||
error: err.stack
|
||||
});
|
||||
});
|
||||
|
||||
|
@ -333,10 +343,27 @@ module.exports = function(db) {
|
|||
client.captureError(new Error('Page Not Found'));
|
||||
res.status(404).render('404', {
|
||||
url: req.originalUrl,
|
||||
error: 'Not Found'
|
||||
error: 'Not Found',
|
||||
__: i18n.__
|
||||
});
|
||||
});
|
||||
|
||||
if (process.env.NODE_ENV === 'secure') {
|
||||
// Load SSL key and certificate
|
||||
var privateKey = fs.readFileSync('./config/sslcerts/key.pem', 'utf8');
|
||||
var certificate = fs.readFileSync('./config/sslcerts/cert.pem', 'utf8');
|
||||
|
||||
// Create HTTPS Server
|
||||
var httpsServer = https.createServer({
|
||||
key: privateKey,
|
||||
cert: certificate
|
||||
}, app);
|
||||
|
||||
// Return HTTPS server instance
|
||||
return httpsServer;
|
||||
}
|
||||
|
||||
|
||||
app = configureSocketIO(app, db);
|
||||
|
||||
// Return Express server instance
|
||||
|
|
|
@ -2,20 +2,20 @@
|
|||
"404_HEADER": "404 - Page non trouvée",
|
||||
"500_HEADER": "500 - Erreur interne du serveur",
|
||||
"404_BODY": "%s n'est pas un chemin valide.",
|
||||
"500_BODY": "Une erreur inattendue semble s'être produite, pourquoi ne pas essayer d'actualiser votre page? Ou vous pouvez nous contacter si le problème persiste.",
|
||||
"EMAIL_GREETING": "Bonjour!",
|
||||
"VERIFICATION_EMAIL_PARAGRAPH_1": "Bienvenue sur TellForm! Voici un lien spécial pour activer votre nouveau compte:",
|
||||
"500_BODY": "Une erreur inattendue semble s'être produite, pourquoi ne pas essayer d'actualiser votre page ? Ou vous pouvez nous contacter si le problème persiste.",
|
||||
"EMAIL_GREETING": "Bonjour !",
|
||||
"VERIFICATION_EMAIL_PARAGRAPH_1": "Bienvenue sur TellForm ! Voici un lien spécial pour activer votre nouveau compte : ",
|
||||
"VERIFICATION_EMAIL_LINK_TEXT": "Activer mon compte",
|
||||
"VERIFICATION_EMAIL_PARAGRAPH_2": "Merci beaucoup pour l'utilisation de nos services! Si vous avez des questions ou des suggestions, n'hésitez pas à nous envoyer un courriel ici",
|
||||
"VERIFICATION_EMAIL_SUBJECT": "¡Active su nueva cuenta TellForm!",
|
||||
"VERIFICATION_EMAIL_TEXT": "Verifique su cuenta haciendo clic en el siguiente enlace, o copiándolo y pegándolo en su navegador: $ {URL}",
|
||||
"VERIFICATION_EMAIL_PARAGRAPH_2": "Merci infiniment d'utiliser nos services ! Si vous avez des questions ou des suggestions, n'hésitez pas à nous envoyer un courriel ici",
|
||||
"VERIFICATION_EMAIL_SUBJECT": "Activer votre nouveau compte TellForm !",
|
||||
"VERIFICATION_EMAIL_TEXT": "Merci de vérifier votre compte en cliquant sur le lien suivant, ou en le copiant dans votre navigateur web : ${URL}",
|
||||
"EMAIL_SIGNATURE": "- L'équipe TellForm",
|
||||
"WELCOME_EMAIL_PARAGRAPH_1": "Nous aimerions vous accueillir en tant que nouveau membre!",
|
||||
"WELCOME_EMAIL_PARAGRAPH_2": "Nous espérons que vous apprécierez l'utilisation de TellForm! Si vous avez des problèmes, n'hésitez pas à nous envoyer un e-mail ici",
|
||||
"WELCOME_EMAIL_PARAGRAPH_1": "Nous aimerions vous accueillir en tant que nouveau membre !",
|
||||
"WELCOME_EMAIL_PARAGRAPH_2": "Nous espérons que vous apprécierez l'utilisation de TellForm ! Si vous avez des problèmes, n'hésitez pas à nous envoyer un e-mail ici",
|
||||
"WELCOME_EMAIL_SUBJECT": "Bienvenue dans %s!",
|
||||
"WELCOME_EMAIL_TEXT": "Votre compte a été vérifié avec succès.",
|
||||
"RESET_PASSWORD_CONFIRMATION_EMAIL_PARAGRAPH_1": "Ceci est un message de courtoisie pour confirmer que votre mot de passe a été modifié.",
|
||||
"RESET_PASSWORD_REQUEST_EMAIL_PARAGRAPH_1": "Voici un lien spécial qui vous permettra de réinitialiser votre mot de passe Veuillez noter qu'il expirera dans une heure pour votre protection:",
|
||||
"RESET_PASSWORD_REQUEST_EMAIL_PARAGRAPH_1": "Voici un lien spécial qui vous permettra de réinitialiser votre mot de passe. Veuillez noter qu'il expirera dans une heure pour votre protection :",
|
||||
"RESET_PASSWORD_REQUEST_EMAIL_LINK_TEXT": "Réinitialiser votre mot de passe",
|
||||
"RESET_PASSWORD_REQUEST_EMAIL_PARAGRAPH_2": "Si vous ne l'avez pas demandé, veuillez ignorer cet e-mail et votre mot de passe restera inchangé."
|
||||
}
|
||||
}
|
||||
|
|
22
config/locales/sv.json
Normal file
22
config/locales/sv.json
Normal file
|
@ -0,0 +1,22 @@
|
|||
{
|
||||
"500_HEADER": "500 - Internt Serverfel",
|
||||
"404_HEADER": "404 - Sidan hittades inte",
|
||||
"404_BODY": "%s är inte en giltig sökväg",
|
||||
"500_BODY": "Ett oväntat fel verkar ha inträffat. Kan du prova med att uppdatera sidan? Eller kan du kontakta oss om problemet återuppstår igen?",
|
||||
"EMAIL_GREETING": "Hej där!",
|
||||
"VERIFICATION_EMAIL_PARAGRAPH_1": "Välkommen till TellForm! Här är en speciell länk till dig för att aktivera ditt nya konto:",
|
||||
"VERIFICATION_EMAIL_LINK_TEXT": "Aktivera mitt konto",
|
||||
"VERIFICATION_EMAIL_PARAGRAPH_2": "Tack så mycket för att du använder våra tjänster! Om du har några frågor eller förslag är du varmt välkommen att e-posta oss här på",
|
||||
"VERIFICATION_EMAIL_SUBJECT": "Aktivera ditt nya TellForm-konto!",
|
||||
"VERIFICATION_EMAIL_TEXT": "Vänligen verifiera ditt konto genom att klicka på den följande länken, eller genom att kopiera och klistra in den i din webbläsare: ${URL}",
|
||||
"EMAIL_SIGNATURE": "- TellForm-gruppen",
|
||||
"WELCOME_EMAIL_PARAGRAPH_1": "Vi skulle vilja välkomna dig som vår nyaste medlem!",
|
||||
"WELCOME_EMAIL_PARAGRAPH_2": "Vi hoppas att du gillar att använda TellForm! Om du stöter på några problem är du varmt välkommen att e-posta oss här på",
|
||||
"WELCOME_EMAIL_SUBJECT": "Välkommen till %s!",
|
||||
"WELCOME_EMAIL_TEXT": "Ditt konto har framgångsrikt blivit verifierat.",
|
||||
"RESET_PASSWORD_CONFIRMATION_EMAIL_PARAGRAPH_1": "Detta är ett artigt meddelande för att bekräfta att ditt lösenord just har ändrats.",
|
||||
"RESET_PASSWORD_REQUEST_EMAIL_PARAGRAPH_1": "Här är en speciell länk som kommer tillåta dig att återställa ditt lösenord. Vänligen notera att det kommer utgå om en timma för din säkerhet:",
|
||||
"RESET_PASSWORD_REQUEST_EMAIL_LINK_TEXT": "Återställ Ditt Lösenord",
|
||||
"RESET_PASSWORD_REQUEST_EMAIL_PARAGRAPH_2": "Om du inte begärde detta, vänligen ignorera detta meddelande och ditt lösenord kommer att förbli oförändrat.",
|
||||
"RESET_PASSWORD_CONFIRMATION_EMAIL_BODY_1": "RESET_PASSWORD_CONFIRMATION_EMAIL_BODY_1"
|
||||
}
|
|
@ -63,6 +63,7 @@ logger.setupFileLogger = function setupFileLogger() {
|
|||
|
||||
return false;
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
/**
|
||||
|
@ -75,7 +76,7 @@ logger.getLogOptions = function getLogOptions() {
|
|||
var _config = _.clone(config, true);
|
||||
var configFileLogger = _config.log.fileLogger;
|
||||
|
||||
if (process.env.NODE_ENV !== 'test' && !_.has(_config, 'log.fileLogger.directoryPath') || !_.has(_config, 'log.fileLogger.fileName')) {
|
||||
if (!_.has(_config, 'log.fileLogger.directoryPath') || !_.has(_config, 'log.fileLogger.fileName')) {
|
||||
console.log('unable to find logging file configuration');
|
||||
return false;
|
||||
}
|
||||
|
@ -96,6 +97,7 @@ logger.getLogOptions = function getLogOptions() {
|
|||
handleExceptions: true,
|
||||
humanReadableUnhandledException: true
|
||||
};
|
||||
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
|
@ -6,24 +6,14 @@ module.exports.isAuthenticatedOrApiKey = function isAuthenticated(req, res, next
|
|||
if (req.isAuthenticated()) {
|
||||
return next();
|
||||
}
|
||||
|
||||
// Try authenticate with API KEY
|
||||
if (req.headers.apikey || req.query.apikey || req.body.apikey) {
|
||||
if(!req.body.apikey && req.headers.apikey){
|
||||
req.body.apikey = req.headers.apikey;
|
||||
} else if(!req.query.apikey && req.headers.apikey){
|
||||
req.query.apikey = req.headers.apikey;
|
||||
}
|
||||
|
||||
passport.authenticate('localapikey', function (err, user, info) {
|
||||
if (err) {
|
||||
return res.status(500).send('Internal Server Error with API. Sorry about that!');
|
||||
}
|
||||
if (err)
|
||||
return res.sendStatus(500);
|
||||
|
||||
if (!user) {
|
||||
console.log('no user for apikey');
|
||||
if (!user)
|
||||
return res.status(401).send(info.message || '');
|
||||
}
|
||||
|
||||
req.login(user, function(loginErr) {
|
||||
if (loginErr) return res.sendStatus(500);
|
||||
|
@ -38,3 +28,23 @@ module.exports.isAuthenticatedOrApiKey = function isAuthenticated(req, res, next
|
|||
}
|
||||
};
|
||||
|
||||
|
||||
module.exports.hasRole = function hasRole(roleRequired) {
|
||||
if (!roleRequired) {
|
||||
throw new Error('Required role needs to be set');
|
||||
}
|
||||
|
||||
return function(req, res, next) {
|
||||
return module.exports.isAuthenticated(req, res, function() {
|
||||
if (req.user && req.user.roles && req.user.roles.indexOf(roleRequired) !== -1){
|
||||
return next();
|
||||
}
|
||||
return res.sendStatus(403);
|
||||
});
|
||||
};
|
||||
};
|
||||
|
||||
module.exports.hasAdminRole = function hasAdminRole() {
|
||||
return module.exports.hasRole('admin');
|
||||
};
|
||||
|
||||
|
|
|
@ -9,7 +9,14 @@ var config = require('./config'),
|
|||
// Define the Socket.io configuration method
|
||||
module.exports = function (app, db) {
|
||||
var server = http.createServer(app);
|
||||
var io = socketio(config.socketPort, { transports: ['websocket', 'polling'] });
|
||||
var io;
|
||||
|
||||
// make it possible to only expose one domain
|
||||
if (process.env.SOCKET_PORT != process.env.PORT) {
|
||||
io = socketio(config.socketPort, { transports: ['websocket', 'polling'] });
|
||||
} else {
|
||||
io = socketio(server, { transports: ['websocket', 'polling'] });
|
||||
}
|
||||
|
||||
if(config.enableClusterMode){
|
||||
var redis = require('socket.io-redis');
|
||||
|
|
|
@ -11,15 +11,13 @@ module.exports = function() {
|
|||
return User.findOne({
|
||||
'apiKey': apiKey
|
||||
}, function(err, user) {
|
||||
if (err) {
|
||||
if (err)
|
||||
return done(err);
|
||||
}
|
||||
|
||||
if (!user){
|
||||
if (!user)
|
||||
return done(null, false, {
|
||||
message: 'Unknown API Key'
|
||||
});
|
||||
}
|
||||
|
||||
return done(null, user);
|
||||
});
|
||||
|
|
55
docker-compose.yml
Normal file
55
docker-compose.yml
Normal file
|
@ -0,0 +1,55 @@
|
|||
version: "3"
|
||||
services:
|
||||
redis:
|
||||
restart: always
|
||||
image: redis
|
||||
networks:
|
||||
- back-tier
|
||||
mongo:
|
||||
restart: always
|
||||
image: mongo
|
||||
volumes:
|
||||
- ".data/mongo:/data"
|
||||
networks:
|
||||
- back-tier
|
||||
tellform:
|
||||
build:
|
||||
context: .
|
||||
environment:
|
||||
CREATE_ADMIN: "TRUE"
|
||||
MONGODB_URI: mongodb://mongo/tellform
|
||||
REDIS_URL: redis://redis
|
||||
# volumes:
|
||||
# - .:/opt/tellform
|
||||
links:
|
||||
- mongo
|
||||
- redis
|
||||
ports:
|
||||
- "5000:5000"
|
||||
depends_on:
|
||||
- mongo
|
||||
- redis
|
||||
networks:
|
||||
- back-tier
|
||||
web:
|
||||
# image: tellform/nginx:stable
|
||||
build:
|
||||
context: ./nginx
|
||||
# image: nginx:1.13
|
||||
restart: always
|
||||
ports:
|
||||
- "80:80"
|
||||
- "443:443"
|
||||
- "20523:20523"
|
||||
environment:
|
||||
NODE_ENV: development
|
||||
#volumes:
|
||||
# - "$ROOT/certs:/certs"
|
||||
# - ./nginx/conf.d:/etc/nginx/conf.d
|
||||
networks:
|
||||
- back-tier
|
||||
|
||||
networks:
|
||||
back-tier:
|
||||
driver: bridge
|
||||
|
BIN
docs/readme_logos/digitalOcean.png
Normal file
BIN
docs/readme_logos/digitalOcean.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 3.5 KiB |
BIN
docs/readme_logos/sentryIO.png
Normal file
BIN
docs/readme_logos/sentryIO.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 2.6 KiB |
BIN
docs/readme_logos/sparkPost.png
Normal file
BIN
docs/readme_logos/sparkPost.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 5.2 KiB |
BIN
docs/readme_logos/statusPageIO.png
Normal file
BIN
docs/readme_logos/statusPageIO.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 6.4 KiB |
BIN
docs/readme_logos/stickerMule.png
Normal file
BIN
docs/readme_logos/stickerMule.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 3.1 KiB |
BIN
docs/readme_logos/theRoostStand.png
Normal file
BIN
docs/readme_logos/theRoostStand.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 105 KiB |
73
gruntfile.js
73
gruntfile.js
|
@ -204,23 +204,63 @@ module.exports = function(grunt) {
|
|||
singleRun: true
|
||||
}
|
||||
},
|
||||
protractor: {
|
||||
options: {
|
||||
configFile: 'protractor.conf.js',
|
||||
keepAlive: true,
|
||||
noColor: false
|
||||
},
|
||||
e2e: {
|
||||
options: {
|
||||
args: {} // Target-specific arguments
|
||||
}
|
||||
}
|
||||
},
|
||||
mocha_istanbul: {
|
||||
coverage: {
|
||||
src: watchFiles.allTests, // a folder works nicely
|
||||
options: {
|
||||
mask: '*.test.js',
|
||||
require: ['server.js']
|
||||
}
|
||||
},
|
||||
coverageClient: {
|
||||
src: watchFiles.clientTests, // specifying file patterns works as well
|
||||
options: {
|
||||
coverageFolder: 'coverageClient',
|
||||
mask: '*.test.js',
|
||||
require: ['server.js']
|
||||
}
|
||||
},
|
||||
coverageServer: {
|
||||
src: watchFiles.serverTests,
|
||||
options: {
|
||||
coverageFolder: 'coverageServer',
|
||||
mask: '*.test.js',
|
||||
require: ['server.js'],
|
||||
reportFormats: ['html','lcovonly']
|
||||
require: ['server.js']
|
||||
}
|
||||
},
|
||||
coveralls: {
|
||||
src: watchFiles.allTests, // multiple folders also works
|
||||
options: {
|
||||
require: ['server.js'],
|
||||
coverage: true, // this will make the grunt.event.on('coverage') event listener to be triggered
|
||||
root: './lib', // define where the cover task should consider the root of libraries that are covered by tests
|
||||
reportFormats: ['cobertura','lcovonly']
|
||||
}
|
||||
}
|
||||
},
|
||||
lcovMerge: {
|
||||
options: {
|
||||
emitters: ['event'],
|
||||
},
|
||||
src: ['./coverageServer/*.info', './coverageClient/lcov-report/*.info']
|
||||
},
|
||||
istanbul_check_coverage: {
|
||||
default: {
|
||||
options: {
|
||||
coverageFolder: 'coverage*', // will check both coverage folders and merge the coverage results
|
||||
check: {
|
||||
lines: 80,
|
||||
statements: 80
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
html2js: {
|
||||
options: {
|
||||
base: 'public',
|
||||
|
@ -247,7 +287,7 @@ module.exports = function(grunt) {
|
|||
options: {
|
||||
module: 'TellForm.templates'
|
||||
},
|
||||
src: ['public/modules/**/views/**.html', 'public/modules/**/views/**/*.html', 'public/form_modules/forms/base/**/*.html'],
|
||||
src: ['public/modules/**/views/**.html', 'public/modules/**/views/**/*.html', 'public/form_modules/forms/base/**/*.html', '!public/modules/forms/base/**/*.html'],
|
||||
dest: 'public/dist/populate_template_cache.js'
|
||||
}
|
||||
},
|
||||
|
@ -283,7 +323,9 @@ module.exports = function(grunt) {
|
|||
});
|
||||
|
||||
// Code coverage tasks.
|
||||
grunt.registerTask('coveralls', ['test:client', 'karma:unit', 'mocha_istanbul:coverageServer', 'lcovMerge']);
|
||||
grunt.registerTask('coveralls', ['env:test','mocha_istanbul:coveralls']);
|
||||
grunt.registerTask('coverage', ['env:test', 'mocha_istanbul:coverage']);
|
||||
grunt.registerTask('coverage:client', ['env:test', 'mocha_istanbul:coverageClient']);
|
||||
grunt.registerTask('coverage:server', ['env:test', 'mocha_istanbul:coverageServer']);
|
||||
|
||||
// Default task(s).
|
||||
|
@ -292,12 +334,9 @@ module.exports = function(grunt) {
|
|||
|
||||
// Debug task.
|
||||
grunt.registerTask('debug', ['lint', 'html2js:main', 'html2js:forms', 'concurrent:debug']);
|
||||
|
||||
// Secure task(s).
|
||||
grunt.registerTask('secure', ['env:secure', 'lint', 'html2js:main', 'html2js:forms', 'concurrent:default']);
|
||||
|
||||
|
||||
// Lint task(s).
|
||||
grunt.registerTask('lint', ['jshint', 'csslint']);
|
||||
grunt.registerTask('lint', ['jshint', 'csslint', 'i18nlint:client', 'i18nlint:server']);
|
||||
grunt.registerTask('lint:tests', ['jshint:allTests']);
|
||||
|
||||
// Build task(s).
|
||||
|
@ -307,11 +346,9 @@ module.exports = function(grunt) {
|
|||
grunt.registerTask('setup', ['execute']);
|
||||
|
||||
// Test task(s).
|
||||
grunt.registerTask('test', ['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:client', ['lint:tests', 'html2js:main', 'html2js:forms', 'env:test', 'karma:unit']);
|
||||
grunt.registerTask('test:travis', ['coverage:server', 'test:client', 'lcovMerge']);
|
||||
|
||||
|
||||
grunt.registerTask('testdebug', ['env:test', 'karma:debug']);
|
||||
};
|
||||
|
|
|
@ -29,20 +29,11 @@ module.exports = function(config) {
|
|||
'public/modules/**/views/**/*.html': ['ng-html2js'],
|
||||
'public/modules/**/views/*.html': ['ng-html2js'],
|
||||
'public/form_modules/forms/base/views/**/*.html': ['ng-html2js'],
|
||||
'public/form_modules/forms/base/views/*.html': ['ng-html2js'],
|
||||
'public/modules/*/*.js': ['coverage'],
|
||||
'public/modules/*/*[!tests]*/*.js': ['coverage']
|
||||
'public/form_modules/forms/base/views/*.html': ['ng-html2js']
|
||||
//'public/modules/*/*.js': ['coverage'],
|
||||
//'public/modules/*/*[!tests]*/*.js': ['coverage'],
|
||||
},
|
||||
|
||||
// configure coverage reporter
|
||||
coverageReporter: {
|
||||
reporters: [
|
||||
{ type: 'html', subdir: 'report-html' },
|
||||
{ type: 'lcov', subdir: 'report-lcov' },
|
||||
],
|
||||
dir : 'coverageClient/'
|
||||
},
|
||||
|
||||
ngHtml2JsPreprocessor: {
|
||||
stripPrefix: 'public/',
|
||||
prependPrefix: 'static/',
|
||||
|
|
19
nginx/Dockerfile
Normal file
19
nginx/Dockerfile
Normal file
|
@ -0,0 +1,19 @@
|
|||
FROM alpine:edge
|
||||
RUN apk add --no-cache nginx certbot openssl python py-jinja2
|
||||
|
||||
COPY *.py /
|
||||
COPY conf /conf
|
||||
|
||||
RUN chmod +x /start.py
|
||||
RUN chmod +x /letsencrypt.py
|
||||
RUN chmod +x /config.py
|
||||
|
||||
ENV NODE_ENV=development
|
||||
ENV PORT=5000
|
||||
ENV SOCKET_PORT=20523
|
||||
ENV TLS_FLAVOR=notls
|
||||
ENV BASE_URL=localhost
|
||||
ENV SUBDOMAIN_URL=*.localhost
|
||||
ENV SOCKETS_URL=ws.localhost
|
||||
|
||||
CMD /start.py
|
116
nginx/conf/nginx.conf
Normal file
116
nginx/conf/nginx.conf
Normal file
|
@ -0,0 +1,116 @@
|
|||
# Basic configuration
|
||||
user nginx;
|
||||
worker_processes 1;
|
||||
error_log /dev/stderr info;
|
||||
pid /var/run/nginx.pid;
|
||||
|
||||
events {
|
||||
worker_connections 1024;
|
||||
}
|
||||
|
||||
http {
|
||||
# Standard HTTP configuration with slight hardening
|
||||
include /etc/nginx/mime.types;
|
||||
default_type application/octet-stream;
|
||||
access_log /dev/stdout;
|
||||
sendfile on;
|
||||
keepalive_timeout 65;
|
||||
server_tokens off;
|
||||
|
||||
#Websockets Server
|
||||
server {
|
||||
|
||||
{% if NODE_ENV == "development" %}
|
||||
listen {{SOCKET_PORT}};
|
||||
{% else %}
|
||||
listen 80;
|
||||
listen [::]:80;
|
||||
server_name {{ SOCKETS_URL }};
|
||||
|
||||
# Only enable HTTPS if TLS is enabled with no error
|
||||
{% if TLS and not TLS_ERROR %}
|
||||
listen 443 ssl;
|
||||
listen [::]:443 ssl;
|
||||
|
||||
include /etc/nginx/tls.conf;
|
||||
add_header Strict-Transport-Security max-age=15768000;
|
||||
|
||||
if ($scheme = http) {
|
||||
return 301 https://$host$request_uri;
|
||||
}
|
||||
{% endif %}
|
||||
|
||||
{% endif %}
|
||||
|
||||
location / {
|
||||
proxy_pass http://tellform:20523;
|
||||
proxy_read_timeout 90;
|
||||
|
||||
proxy_set_header Host $host;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
proxy_set_header X-Forwarded-Proto $scheme;
|
||||
|
||||
# WebSocket support
|
||||
proxy_http_version 1.1;
|
||||
proxy_set_header Upgrade $http_upgrade;
|
||||
proxy_set_header Connection "upgrade";
|
||||
|
||||
{% if TLS and not TLS_ERROR %}
|
||||
proxy_set_header X-Forwarded-Proto https;
|
||||
{% endif %}
|
||||
}
|
||||
|
||||
{% if TLS_FLAVOR == 'letsencrypt' %}
|
||||
location ^~ /.well-known/acme-challenge/ {
|
||||
proxy_pass http://127.0.0.1:8008;
|
||||
}
|
||||
{% endif %}
|
||||
}
|
||||
|
||||
server {
|
||||
#Add server_name for per-user subdomains
|
||||
{% if SUBDOMAINS_DISABLED == "FALSE" %}
|
||||
server_name {{BASE_URL}} {{SUBDOMAIN_URL}};
|
||||
{% else %}
|
||||
server_name {{BASE_URL}};
|
||||
{% endif %}
|
||||
|
||||
listen 80;
|
||||
listen [::]:80;
|
||||
|
||||
# Only enable HTTPS if TLS is enabled with no error
|
||||
{% if TLS and not TLS_ERROR %}
|
||||
listen 443 ssl;
|
||||
listen [::]:443 ssl;
|
||||
|
||||
include /etc/nginx/tls.conf;
|
||||
add_header Strict-Transport-Security max-age=15768000;
|
||||
|
||||
if ($scheme = http) {
|
||||
return 301 https://$host$request_uri;
|
||||
}
|
||||
{% endif %}
|
||||
|
||||
root /usr/share/nginx/html;
|
||||
index index.html index.htm;
|
||||
|
||||
location / {
|
||||
proxy_pass http://tellform:5000;
|
||||
proxy_redirect off;
|
||||
proxy_set_header Host $host;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for ;
|
||||
|
||||
{% if TLS and not TLS_ERROR %}
|
||||
proxy_set_header X-Forwarded-Proto https;
|
||||
{% endif %}
|
||||
}
|
||||
|
||||
{% if TLS_FLAVOR == 'letsencrypt' %}
|
||||
location ^~ /.well-known/acme-challenge/ {
|
||||
proxy_pass http://127.0.0.1:8008;
|
||||
}
|
||||
{% endif %}
|
||||
}
|
||||
}
|
7
nginx/conf/tls.conf
Normal file
7
nginx/conf/tls.conf
Normal file
|
@ -0,0 +1,7 @@
|
|||
ssl_protocols TLSv1.1 TLSv1.2;
|
||||
ssl_ciphers 'ECDHE-RSA-AES256-GCM-SHA512:DHE-RSA-AES256-GCM-SHA512:ECDHE-RSA-AES256-GCM-SHA384:DHE-RSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-SHA384';
|
||||
ssl_prefer_server_ciphers on;
|
||||
ssl_session_timeout 10m;
|
||||
ssl_certificate {{ TLS[0] }};
|
||||
ssl_certificate_key {{ TLS[1] }};
|
||||
ssl_dhparam /certs/dhparam.pem;
|
26
nginx/config.py
Normal file
26
nginx/config.py
Normal file
|
@ -0,0 +1,26 @@
|
|||
#!/usr/bin/python
|
||||
|
||||
import jinja2
|
||||
import os
|
||||
|
||||
convert = lambda src, dst, args: open(dst, "w").write(jinja2.Template(open(src).read()).render(**args))
|
||||
|
||||
args = os.environ.copy()
|
||||
|
||||
# TLS configuration
|
||||
args["TLS"] = {
|
||||
"cert": ("/certs/cert.pem", "/certs/key.pem"),
|
||||
"letsencrypt": ("/certs/letsencrypt/live/mailu/fullchain.pem",
|
||||
"/certs/letsencrypt/live/mailu/privkey.pem"),
|
||||
"notls": None
|
||||
}[args["TLS_FLAVOR"]]
|
||||
|
||||
if args["TLS"] and not all(os.path.exists(file_path) for file_path in args["TLS"]):
|
||||
print("Missing cert or key file, disabling TLS")
|
||||
args["TLS_ERROR"] = "yes"
|
||||
|
||||
|
||||
# Build final configuration paths
|
||||
convert("/conf/tls.conf", "/etc/nginx/tls.conf", args)
|
||||
convert("/conf/nginx.conf", "/etc/nginx/nginx.conf", args)
|
||||
os.system("nginx -s reload")
|
29
nginx/letsencrypt.py
Normal file
29
nginx/letsencrypt.py
Normal file
|
@ -0,0 +1,29 @@
|
|||
#!/usr/bin/python
|
||||
|
||||
import os
|
||||
import time
|
||||
import subprocess
|
||||
|
||||
|
||||
command = [
|
||||
"certbot",
|
||||
"-n", "--agree-tos", # non-interactive
|
||||
"-d", os.environ["HOSTNAMES"],
|
||||
"-m", "{}@{}".format(os.environ["POSTMASTER"], os.environ["DOMAIN"]),
|
||||
"certonly", "--standalone",
|
||||
"--server", "https://acme-v02.api.letsencrypt.org/directory",
|
||||
"--cert-name", "tellform",
|
||||
"--preferred-challenges", "http", "--http-01-port", "8008",
|
||||
"--keep-until-expiring",
|
||||
"--rsa-key-size", "4096",
|
||||
"--config-dir", "/certs/letsencrypt",
|
||||
"--post-hook", "./config.py"
|
||||
]
|
||||
|
||||
# Wait for nginx to start
|
||||
time.sleep(5)
|
||||
|
||||
# Run certbot every hour
|
||||
while True:
|
||||
subprocess.call(command)
|
||||
time.sleep(3600)
|
25
nginx/start.py
Normal file
25
nginx/start.py
Normal file
|
@ -0,0 +1,25 @@
|
|||
#!/usr/bin/python
|
||||
|
||||
import os
|
||||
import subprocess
|
||||
|
||||
#Set default port
|
||||
if not os.environ["PORT"]:
|
||||
os.environ["PORT"] = "5000"
|
||||
|
||||
#Set default sockets port
|
||||
if not os.environ["SOCKET_PORT"]:
|
||||
os.environ["SOCKET_PORT"] = "20523"
|
||||
|
||||
# Actual startup script
|
||||
if not os.path.exists("/certs/dhparam.pem") and os.environ["TLS_FLAVOR"] != "notls":
|
||||
os.system("openssl dhparam -out /certs/dhparam.pem 2048")
|
||||
|
||||
if os.environ["TLS_FLAVOR"] == "letsencrypt":
|
||||
subprocess.Popen(["/letsencrypt.py"])
|
||||
elif os.environ["TLS_FLAVOR"] == "cert":
|
||||
if not os.path.exists("/certs/cert.pem"):
|
||||
os.system("openssl req -newkey rsa:2048 -x509 -keyout /certs/key.pem -out /certs/cert.pem -days 365 -nodes -subj '/C=NA/ST=None/L=None/O=None/CN=" + os.environ["BASE_URL"] + "'")
|
||||
|
||||
subprocess.call(["/config.py"])
|
||||
os.execv("/usr/sbin/nginx", ["nginx", "-g", "daemon off;"])
|
12801
package-lock.json
generated
12801
package-lock.json
generated
File diff suppressed because it is too large
Load diff
36
package.json
36
package.json
|
@ -21,16 +21,15 @@
|
|||
"generate": "all-contributors generate",
|
||||
"start": "grunt",
|
||||
"test": "grunt test",
|
||||
"travis": "grunt test:travis",
|
||||
"postinstall": "bower install --config.interactive=false; grunt build;",
|
||||
"postinstall": "bower install --config.interactive=false",
|
||||
"init": "node scripts/setup.js"
|
||||
},
|
||||
"dependencies": {
|
||||
"async": "^1.4.2",
|
||||
"body-parser": "~1.14.1",
|
||||
"bower": "~1.6.5",
|
||||
"body-parser": "^1.19.0",
|
||||
"bower": "^1.8.8",
|
||||
"chalk": "^1.1.3",
|
||||
"compression": "~1.6.0",
|
||||
"compression": "^1.7.4",
|
||||
"connect": "^3.4.1",
|
||||
"connect-mongo": "^2.0.0",
|
||||
"consolidate": "~0.14.5",
|
||||
|
@ -39,27 +38,27 @@
|
|||
"dotenv": "^2.0.0",
|
||||
"email-verification": "github:tellform/node-email-verification",
|
||||
"envfile": "^2.1.1",
|
||||
"express": "~4.13.3",
|
||||
"express-session": "~1.12.1",
|
||||
"express": "^4.16.4",
|
||||
"express-session": "^1.16.1",
|
||||
"glob": "^7.0.3",
|
||||
"grunt": "^0.4.5",
|
||||
"grunt": "~0.4.1",
|
||||
"grunt-concurrent": "~2.3.0",
|
||||
"grunt-contrib-csslint": "~1.0.0",
|
||||
"grunt-contrib-cssmin": "~1.0.1",
|
||||
"grunt-contrib-jshint": "~1.0.0",
|
||||
"grunt-contrib-uglify": "~0.11.0",
|
||||
"grunt-env": "~0.4.1",
|
||||
"grunt-html2js": "~0.3.5",
|
||||
"grunt-html2js": "^0.6.0",
|
||||
"grunt-ng-annotate": "~1.0.1",
|
||||
"helmet": "3.5.0",
|
||||
"helmet": "^3.16.0",
|
||||
"i18n": "^0.8.3",
|
||||
"jit-grunt": "^0.9.1",
|
||||
"lodash": "^4.17.4",
|
||||
"main-bower-files": "~2.9.0",
|
||||
"lodash": "^4.17.11",
|
||||
"main-bower-files": "^2.13.1",
|
||||
"method-override": "~2.3.0",
|
||||
"mkdirp": "^0.5.1",
|
||||
"mongoose": "~4.4.19",
|
||||
"morgan": "~1.8.1",
|
||||
"morgan": "^1.9.1",
|
||||
"nodemailer": "~4.0.0",
|
||||
"passport": "~0.3.0",
|
||||
"passport-anonymous": "^1.0.1",
|
||||
|
@ -67,12 +66,13 @@
|
|||
"passport-localapikey-update": "^0.5.0",
|
||||
"path-exists": "^2.1.0",
|
||||
"prerender-node": "^2.2.1",
|
||||
"pug": "^2.0.0-rc.4",
|
||||
"pug": "^2.0.3",
|
||||
"random-js": "^1.0.8",
|
||||
"raven": "^0.9.0",
|
||||
"request": "^2.83.0",
|
||||
"request": "^2.88.0",
|
||||
"socket.io": "^1.4.6",
|
||||
"socket.io-redis": "^1.0.0",
|
||||
"swig": "~1.4.1",
|
||||
"uuid-token-generator": "^0.5.0",
|
||||
"winston": "^2.3.1"
|
||||
},
|
||||
|
@ -89,8 +89,8 @@
|
|||
"grunt-contrib-uglify": "^0.11.1",
|
||||
"grunt-contrib-watch": "~0.6.1",
|
||||
"grunt-execute": "^0.2.2",
|
||||
"grunt-i18nlint": "github:jwarby/grunt-i18nlint",
|
||||
"grunt-karma": "~0.12.1",
|
||||
"grunt-lcov-merge": "^1.2.3",
|
||||
"grunt-mocha-istanbul": "^3.0.1",
|
||||
"grunt-mocha-test": "~0.12.1",
|
||||
"grunt-newer": "~1.1.1",
|
||||
|
@ -98,7 +98,7 @@
|
|||
"grunt-usemin": "^3.1.1",
|
||||
"grunt-wiredep": "^3.0.1",
|
||||
"istanbul": "^0.4.0",
|
||||
"jasmine-core": "^2.6",
|
||||
"jasmine-core": "^2.4.1",
|
||||
"karma": "~0.13.14",
|
||||
"karma-chrome-launcher": "~0.2.1",
|
||||
"karma-coverage": "~0.5.3",
|
||||
|
@ -111,7 +111,7 @@
|
|||
"mocha": "^3.1.2",
|
||||
"mocha-lcov-reporter": "^1.0.0",
|
||||
"nightwatch": "^0.9.8",
|
||||
"phantomjs-prebuilt": "^2.1.15",
|
||||
"phantomjs": "^1.9.18",
|
||||
"selenium-server": "^3.0.1",
|
||||
"should": "~7.1.1",
|
||||
"supertest": "~1.2.0",
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
var ApplicationConfiguration = (function() {
|
||||
// Init module configuration options
|
||||
var applicationModuleName = 'TellForm';
|
||||
var applicationModuleVendorDependencies = ['duScroll', 'ui.select', 'ngSanitize', 'vButton', 'ngResource', 'TellForm.templates', 'ui.router', 'ui.bootstrap', 'ui.utils', 'pascalprecht.translate'];
|
||||
var applicationModuleVendorDependencies = ['duScroll', 'ui.select', 'ngSanitize', 'vButton', 'ngResource', 'TellForm.templates', 'ui.router', 'ui.bootstrap', 'ui.utils', 'pascalprecht.translate', 'view-form'];
|
||||
|
||||
// Add a new vertical module
|
||||
var registerModule = function(moduleName, dependencies) {
|
||||
|
|
|
@ -14,13 +14,13 @@ angular.module('view-form').config(['$translateProvider', function ($translatePr
|
|||
COMPLETING_NEEDED: '{{answers_not_completed}} réponse(s) doive(nt) être complétée(s)',
|
||||
OPTIONAL: 'facultatif',
|
||||
ERROR_EMAIL_INVALID: 'Merci de rentrer une adresse mail valide',
|
||||
ERROR_NOT_A_NUMBER: 'Merce de ne rentrer que des nombres',
|
||||
ERROR_NOT_A_NUMBER: 'Merci de ne rentrer que des nombres',
|
||||
ERROR_URL_INVALID: 'Merci de rentrer une url valide',
|
||||
OK: 'OK',
|
||||
ENTER: 'presser ENTRÉE',
|
||||
ENTER: 'Appuyer sur ENTRÉE',
|
||||
YES: 'Oui',
|
||||
NO: 'Non',
|
||||
NEWLINE: 'presser SHIFT+ENTER pour créer une nouvelle ligne',
|
||||
NEWLINE: 'Appuyer sur SHIFT+ENTER pour créer une nouvelle ligne',
|
||||
CONTINUE: 'Continuer',
|
||||
LEGAL_ACCEPT: 'J’accepte',
|
||||
LEGAL_NO_ACCEPT: 'Je n’accepte pas',
|
||||
|
@ -33,13 +33,13 @@ angular.module('view-form').config(['$translateProvider', function ($translatePr
|
|||
OPTION_PLACEHOLDER: 'Tapez ou sélectionnez une option',
|
||||
ADD_NEW_LINE_INSTR: 'Appuyez sur MAJ + ENTRÉE pour ajouter une nouvelle ligne',
|
||||
ERROR: 'Erreur',
|
||||
|
||||
|
||||
FORM_404_HEADER: '404 - Le formulaire n\'existe pas',
|
||||
FORM_404_BODY: 'Le formulaire auquel vous essayez d\'accéder n\'existe pas. Désolé pour ça!',
|
||||
|
||||
FORM_404_BODY: 'Le formulaire auquel vous essayez d\'accéder n\'existe pas. Désolé pour ça !',
|
||||
|
||||
FORM_UNAUTHORIZED_HEADER: 'Non autorisé à accéder au formulaire',
|
||||
FORM_UNAUTHORIZED_BODY1: 'Le formulaire auquel vous essayez d\'accéder est actuellement privé et inaccessible publiquement.',
|
||||
FORM_UNAUTHORIZED_BODY2: 'Si vous êtes le propriétaire du formulaire, vous pouvez le définir sur "Public" dans le panneau "Configuration" du formulaire admin.',
|
||||
FORM_UNAUTHORIZED_BODY2: 'Si vous êtes le propriétaire du formulaire, vous pouvez le définir en "Public" dans le panneau "Configuration" du formulaire admin.',
|
||||
});
|
||||
|
||||
}]);
|
||||
|
|
45
public/form_modules/forms/base/config/i18n/swedish.js
Normal file
45
public/form_modules/forms/base/config/i18n/swedish.js
Normal file
|
@ -0,0 +1,45 @@
|
|||
'use strict';
|
||||
|
||||
angular.module('view-form').config(['$translateProvider', function ($translateProvider) {
|
||||
|
||||
$translateProvider.translations('se', {
|
||||
FORM_SUCCESS: 'Formulärsvaret skickades framgångsrikt in!',
|
||||
REVIEW: 'Granska',
|
||||
BACK_TO_FORM: 'Gå tillbaka till Formuläret',
|
||||
EDIT_FORM: 'Ändra denna TellForm',
|
||||
CREATE_FORM: 'Skapa denna TellForm',
|
||||
ADVANCEMENT: '{{done}} utav {{total}} svar',
|
||||
CONTINUE_FORM: 'Fortsätt till Form',
|
||||
REQUIRED: 'krävs',
|
||||
COMPLETING_NEEDED: '{{answers_not_completed}} svar behöver färdigställas',
|
||||
OPTIONAL: 'valfri',
|
||||
ERROR_EMAIL_INVALID: 'Vänligen ange en giltig e-postadress',
|
||||
ERROR_NOT_A_NUMBER: 'Vänligen ange endast giltiga nummer',
|
||||
ERROR_URL_INVALID: 'Vänligen en giltig url',
|
||||
OK: 'OK',
|
||||
ENTER: 'tryck ENTER',
|
||||
YES: 'Ja',
|
||||
NO: 'Nej',
|
||||
NEWLINE: 'tryck SHIFT+ENTER för att skapa ny rad',
|
||||
CONTINUE: 'Fortsätt',
|
||||
LEGAL_ACCEPT: 'Jag accepterar',
|
||||
LEGAL_NO_ACCEPT: 'Jag accepterar inte',
|
||||
DELETE: 'Radera',
|
||||
CANCEL: 'Avbryt',
|
||||
SUBMIT: 'Skicka',
|
||||
UPLOAD_FILE: 'Ladda upp din Fil',
|
||||
Y: 'J',
|
||||
N: 'N',
|
||||
OPTION_PLACEHOLDER: 'Skriv eller välj ett alternativ',
|
||||
ADD_NEW_LINE_INSTR: 'Tryck SHIFT+ENTER för att lägga till ny rad',
|
||||
ERROR: 'Fel',
|
||||
|
||||
FORM_404_HEADER: '404 - Formulär Existerar Inte',
|
||||
FORM_404_BODY: 'Formuläret du försöker besöka till existerar inte. Ursäkta för det!',
|
||||
|
||||
FORM_UNAUTHORIZED_HEADER: 'Inte Auktoriserad att Tillgå Formulär',
|
||||
FORM_UNAUTHORIZED_BODY1: 'Formuläret du försöker att besöka är för närvarande privat och inte tillgänglig offentligt.',
|
||||
FORM_UNAUTHORIZED_BODY2: 'Om du är ägaren till formuläret kan du ställa in den till "Offentlig" i panelen "Konfiguration" i formulärets administration.',
|
||||
});
|
||||
|
||||
}]);
|
|
@ -120,6 +120,7 @@ div.form-fields {
|
|||
vertical-align: top;
|
||||
zoom: 1;
|
||||
width: 16px;
|
||||
margin-top: 1px;
|
||||
padding: 0;
|
||||
height: 17px;
|
||||
font-size: 12px;
|
||||
|
@ -372,6 +373,7 @@ div.config-form .row.field {
|
|||
background-color:#efefef;
|
||||
}
|
||||
|
||||
|
||||
/*Styles for add fields tab*/
|
||||
.admin-form .add-field {
|
||||
background-color: #ddd;
|
||||
|
@ -388,6 +390,10 @@ div.config-form .row.field {
|
|||
border-radius: 4px;
|
||||
}
|
||||
|
||||
.admin-form .oscar-field-select {
|
||||
margin: 10px 0 10px;
|
||||
}
|
||||
|
||||
.view-form-btn.span {
|
||||
padding-right:0.6em;
|
||||
}
|
||||
|
|
|
@ -285,6 +285,8 @@ angular.module('view-form').directive('submitFormDirective', ['$http', 'TimeCoun
|
|||
};
|
||||
|
||||
$rootScope.prevField = $scope.prevField = function(){
|
||||
console.log('prevField');
|
||||
console.log($scope.selected);
|
||||
var selected_index = $scope.selected.index - 1;
|
||||
if($scope.selected.index > 0){
|
||||
$scope.setActiveField(null, selected_index, true);
|
||||
|
@ -378,6 +380,17 @@ angular.module('view-form').directive('submitFormDirective', ['$http', 'TimeCoun
|
|||
if($scope.myform.form_fields[i].fieldType === 'dropdown' && !$scope.myform.form_fields[i].deletePreserved){
|
||||
$scope.myform.form_fields[i].fieldValue = $scope.myform.form_fields[i].fieldValue.option_value;
|
||||
}
|
||||
|
||||
//Get rid of unnessecary attributes for each form field
|
||||
delete form.form_fields[i].submissionId;
|
||||
delete form.form_fields[i].disabled;
|
||||
delete form.form_fields[i].ratingOptions;
|
||||
delete form.form_fields[i].fieldOptions;
|
||||
delete form.form_fields[i].logicJump;
|
||||
delete form.form_fields[i].description;
|
||||
delete form.form_fields[i].validFieldTypes;
|
||||
delete form.form_fields[i].fieldType;
|
||||
|
||||
}
|
||||
|
||||
setTimeout(function () {
|
||||
|
|
|
@ -15,10 +15,11 @@
|
|||
</div>
|
||||
<div class="col-xs-12 field-input">
|
||||
<ui-select ng-model="field.fieldValue"
|
||||
class="dropdown"
|
||||
ng-focus="setActiveField(field._id, null, false)"
|
||||
theme="selectize"
|
||||
search-enabled="true"
|
||||
search-by="option_value"
|
||||
set-search-to-answer="true"
|
||||
ng-required="field.required"
|
||||
on-tab-and-shift-key="prevField()"
|
||||
on-tab-key="nextField()"
|
||||
|
|
|
@ -20,7 +20,7 @@ angular.module(ApplicationConfiguration.applicationModuleName).run(['$rootScope'
|
|||
state: fromState,
|
||||
params: fromParams
|
||||
}
|
||||
|
||||
|
||||
var statesToIgnore = ['', 'home', 'signin', 'resendVerifyEmail', 'verify', 'signup', 'signup-success', 'forgot', 'reset-invalid', 'reset', 'reset-success'];
|
||||
|
||||
//Redirect to listForms if user is authenticated
|
||||
|
@ -48,7 +48,7 @@ angular.module(ApplicationConfiguration.applicationModuleName).run(['$rootScope'
|
|||
var authenticator, permissions, user;
|
||||
permissions = next && next.data && next.data.permissions ? next.data.permissions : null;
|
||||
|
||||
Auth.ensureHasCurrentUser(User);
|
||||
Auth.ensureHasCurrentUser();
|
||||
user = Auth.currentUser;
|
||||
|
||||
if(user){
|
||||
|
|
|
@ -4,12 +4,12 @@ angular.module('core').config(['$translateProvider', function ($translateProvide
|
|||
|
||||
$translateProvider.translations('fr', {
|
||||
MENU: 'MENU',
|
||||
SIGNUP_TAB: 'Créer un Compte',
|
||||
SIGNUP_TAB: 'Créer un compte',
|
||||
SIGNIN_TAB: 'Connexion',
|
||||
SIGNOUT_TAB: 'Créer un compte',
|
||||
EDIT_PROFILE: 'Modifier Mon Profil',
|
||||
MY_SETTINGS: 'Mes Paramètres',
|
||||
CHANGE_PASSWORD: 'Changer mon Mot de Pass',
|
||||
EDIT_PROFILE: 'Modifier mon profil',
|
||||
MY_SETTINGS: 'Mes paramètres',
|
||||
CHANGE_PASSWORD: 'Changer mon mot de passe',
|
||||
TOGGLE_NAVIGATION: 'Basculer la navigation',
|
||||
});
|
||||
}]);
|
||||
|
|
16
public/modules/core/config/i18n/swedish.js
Normal file
16
public/modules/core/config/i18n/swedish.js
Normal file
|
@ -0,0 +1,16 @@
|
|||
'use strict';
|
||||
|
||||
angular.module('core').config(['$translateProvider', function ($translateProvider) {
|
||||
|
||||
$translateProvider.translations('se', {
|
||||
MENU: 'MENY',
|
||||
SIGNUP_TAB: 'Registrera konto',
|
||||
SIGNIN_TAB: 'Logga In',
|
||||
SIGNOUT_TAB: 'Logga Ut',
|
||||
EDIT_PROFILE: 'Redigera Profil',
|
||||
MY_SETTINGS: 'Mina Inställningar',
|
||||
CHANGE_PASSWORD: 'Byt Lösenord',
|
||||
TOGGLE_NAVIGATION: 'Växla navigation'
|
||||
});
|
||||
|
||||
}]);
|
|
@ -5,7 +5,7 @@ angular.module('core').controller('HeaderController', ['$rootScope', '$scope', '
|
|||
|
||||
$rootScope.signupDisabled = $window.signupDisabled;
|
||||
|
||||
$scope.user = $rootScope.user = Auth.ensureHasCurrentUser(User);
|
||||
$scope.user = $rootScope.user = Auth.ensureHasCurrentUser();
|
||||
|
||||
$scope.authentication = $rootScope.authentication = Auth;
|
||||
|
||||
|
@ -23,7 +23,7 @@ angular.module('core').controller('HeaderController', ['$rootScope', '$scope', '
|
|||
var promise = User.logout();
|
||||
promise.then(function() {
|
||||
Auth.logout();
|
||||
Auth.ensureHasCurrentUser(User);
|
||||
Auth.ensureHasCurrentUser();
|
||||
$scope.user = $rootScope.user = null;
|
||||
$state.go('listForms');
|
||||
|
||||
|
|
|
@ -6,30 +6,16 @@ angular.module('forms').config(['$translateProvider', function ($translateProvid
|
|||
|
||||
//Configure Form Tab View
|
||||
ADVANCED_SETTINGS: 'Advanced Settings',
|
||||
FORM_NAME: 'Your tellform is called',
|
||||
FORM_STATUS: 'Status',
|
||||
FORM_NAME: 'Form Name',
|
||||
FORM_STATUS: 'Form Status',
|
||||
PUBLIC: 'Public',
|
||||
PRIVATE: 'Private',
|
||||
GA_TRACKING_CODE: 'Google Analytics Tracking Code',
|
||||
DISPLAY_FOOTER: 'Form Footer',
|
||||
DISPLAY_FOOTER: 'Display Form Footer?',
|
||||
SAVE_CHANGES: 'Save Changes',
|
||||
CANCEL: 'Cancel',
|
||||
DISPLAY_START_PAGE: 'Start Page',
|
||||
DISPLAY_END_PAGE: 'Custom End Page',
|
||||
GENERAL_TAB: 'General',
|
||||
SELF_NOTIFICATIONS_TAB: 'Self notifications',
|
||||
RESPONDENT_NOTIFICATIONS_TAB: 'Respondent notifications',
|
||||
|
||||
SEND_NOTIFICATION_TO: 'Send to',
|
||||
NO_EMAIL_FIELD_WARNING: 'Error: You need an email field in your form to send the email to your form respondent',
|
||||
REPLY_TO: 'Reply to',
|
||||
EMAIL_SUBJECT: 'Subject',
|
||||
EMAIL_MESSAGE: 'Message',
|
||||
ENABLE_RESPONDENT_NOTIFICATIONS: 'Respondent Notifications are currently',
|
||||
ENABLE_SELF_NOTIFICATIONS: 'Self Notifications are currently',
|
||||
TOGGLE_ENABLED: 'Enabled',
|
||||
TOGGLE_DISABLED: 'Disabled',
|
||||
ADD_VARIABLE_BUTTON: 'Add variable',
|
||||
DISPLAY_START_PAGE: 'Display Start Page?',
|
||||
DISPLAY_END_PAGE: 'Display Custom End Page?',
|
||||
|
||||
//List Forms View
|
||||
CREATE_A_NEW_FORM: 'Create a new form',
|
||||
|
@ -49,7 +35,6 @@ angular.module('forms').config(['$translateProvider', function ($translateProvid
|
|||
LOGIC_JUMP: 'Logic Jump',
|
||||
SHOW_BUTTONS: 'Additional Buttons',
|
||||
SAVE_START_PAGE: 'Save',
|
||||
ADD_OPTIONS_PLACEHOLDER: 'Add one choice per line. Minumum of one choice is required',
|
||||
|
||||
//Admin Form View
|
||||
ARE_YOU_SURE: 'Are you ABSOLUTELY sure?',
|
||||
|
@ -62,7 +47,7 @@ angular.module('forms').config(['$translateProvider', function ($translateProvid
|
|||
DELETE_FORM_MD: 'Delete Form',
|
||||
DELETE: 'Delete',
|
||||
FORM: 'Form',
|
||||
VIEW_MY_TELLFORM: 'View my tellform',
|
||||
VIEW: 'View',
|
||||
LIVE: 'Live',
|
||||
PREVIEW: 'Preview',
|
||||
COPY: 'Copy',
|
||||
|
@ -168,7 +153,7 @@ angular.module('forms').config(['$translateProvider', function ($translateProvid
|
|||
MULTIPLE_CHOICE: 'Multiple Choice',
|
||||
DROPDOWN: 'Dropdown',
|
||||
DATE: 'Date',
|
||||
PARAGRAPH_FIELD: 'Paragraph',
|
||||
PARAGRAPH_T: 'Paragraph',
|
||||
YES_NO: 'Yes/No',
|
||||
LEGAL: 'Legal',
|
||||
RATING: 'Rating',
|
||||
|
|
|
@ -5,37 +5,22 @@ angular.module('forms').config(['$translateProvider', function ($translateProvid
|
|||
$translateProvider.translations('fr', {
|
||||
// Configurer la vue de l'onglet Formulaire
|
||||
ADVANCED_SETTINGS: 'Paramètres avancés',
|
||||
FORM_NAME: "Votre tellform est appelé",
|
||||
FORM_STATUS: 'Statut',
|
||||
FORM_NAME: "Nom du formulaire",
|
||||
FORM_STATUS: 'Statut du formulaire',
|
||||
PUBLIC: 'Public',
|
||||
PRIVATE: "Privé",
|
||||
GA_TRACKING_CODE: "Code de suivi Google Analytics",
|
||||
DISPLAY_FOOTER: "Pied de formulaire",
|
||||
DISPLAY_FOOTER: "Afficher le pied de formulaire ?",
|
||||
SAVE_CHANGES: 'Enregistrer les modifications',
|
||||
CANCEL: 'Annuler',
|
||||
DISPLAY_START_PAGE: "Page de démarrage",
|
||||
DISPLAY_END_PAGE: "Page de fin personnalisée",
|
||||
|
||||
GENERAL_TAB: 'General',
|
||||
SELF_NOTIFICATIONS_TAB: 'Self notifications',
|
||||
RESPONDANT_NOTIFICATIONS_TAB: 'Respondent notifications',
|
||||
|
||||
SEND_NOTIFICATION_TO: 'Envoyer à',
|
||||
NO_EMAIL_FIELD_WARNING: 'Erreur: Vous avez besoin d\'un champ e-mail dans votre formulaire pour envoyer l\'e-mail au répondant de votre formulaire',
|
||||
REPLY_TO: "Répondre à",
|
||||
EMAIL_SUBJECT: 'Sujet',
|
||||
EMAIL_MESSAGE: "Message",
|
||||
ENABLE_RESPONDENT_NOTIFICATIONS: 'Les notifications des répondants sont actuellement',
|
||||
ENABLE_SELF_NOTIFICATIONS: 'Les notifications automatiques sont actuellement',
|
||||
TOGGLE_ENABLED: 'Activé',
|
||||
TOGGLE_DISABLED: 'Désactivé',
|
||||
ADD_VARIABLE_BUTTON: "Ajouter une variable",
|
||||
DISPLAY_START_PAGE: "Afficher la page de démarrage ?",
|
||||
DISPLAY_END_PAGE: "Afficher la page de fin personnalisée ?",
|
||||
|
||||
// Afficher les formulaires
|
||||
CREATE_A_NEW_FORM: "Créer un nouveau formulaire",
|
||||
CREATE_FORM: "Créer un formulaire",
|
||||
CREATED_ON: 'Créé le',
|
||||
MY_FORMS: 'Mes formes',
|
||||
MY_FORMS: 'Mes formulaires',
|
||||
NAME: "Nom",
|
||||
LANGUE: 'Langue',
|
||||
FORM_PAUSED: 'Formulaire en pause',
|
||||
|
@ -49,7 +34,6 @@ angular.module('forms').config(['$translateProvider', function ($translateProvid
|
|||
LOGIC_JUMP: 'Saut logique',
|
||||
SHOW_BUTTONS: 'Boutons supplémentaires',
|
||||
SAVE_START_PAGE: "Enregistrer",
|
||||
ADD_OPTIONS_PLACEHOLDER: "Ajouter un choix par ligne. Un minimum d'un choix est requis",
|
||||
|
||||
// Affichage du formulaire d'administration
|
||||
ARE_YOU_SURE: 'Es-tu ABSOLUMENT sûr?',
|
||||
|
@ -62,14 +46,14 @@ angular.module('forms').config(['$translateProvider', function ($translateProvid
|
|||
DELETE_FORM_MD: "Supprimer le formulaire",
|
||||
DELETE: "Supprimer",
|
||||
FORM: 'Formulaire',
|
||||
VIEW_MY_TELLFORM: "Afficher ma forme",
|
||||
VIEW: "Afficher",
|
||||
LIVE: "Live",
|
||||
PREVIEW: 'Aperçu',
|
||||
COPY: "Copier",
|
||||
COPY_AND_PASTE: "Copiez et collez ceci pour ajouter votre TellForm à votre site Web",
|
||||
CHANGE_WIDTH_AND_HEIGHT: "Changez les valeurs de largeur et de hauteur pour mieux vous convenir",
|
||||
POWERED_BY: "Alimenté par",
|
||||
TELLFORM_URL: "Votre TellForm est en permanence sur cette URL",
|
||||
TELLFORM_URL: "Votre TellForm est disponible à cette URL",
|
||||
|
||||
// Modifier la vue de formulaire
|
||||
DISABLED: "Désactivé",
|
||||
|
@ -145,7 +129,7 @@ angular.module('forms').config(['$translateProvider', function ($translateProvid
|
|||
|
||||
// Vue de conception
|
||||
BACKGROUND_COLOR: "Couleur d'arrière-plan",
|
||||
DESIGN_HEADER: "Changez l'apparence de votre formulaire",
|
||||
DESIGN_HEADER: "Changer l'apparence de votre formulaire",
|
||||
QUESTION_TEXT_COLOR: "Couleur du texte de la question",
|
||||
ANSWER_TEXT_COLOR: "Couleur du texte de la réponse",
|
||||
BTN_BACKGROUND_COLOR: "Couleur d'arrière-plan du bouton",
|
||||
|
@ -168,7 +152,7 @@ angular.module('forms').config(['$translateProvider', function ($translateProvid
|
|||
MULTIPLE_CHOICE: 'Choix multiple',
|
||||
DROPDOWN: 'Menu Déroulant',
|
||||
DATE: 'Date',
|
||||
PARAGRAPH_FIELD: "Paragraphe",
|
||||
PARAGRAPH_T: "Paragraphe",
|
||||
OUI_NON: 'Oui / Non',
|
||||
LEGAL: 'Légal',
|
||||
RATING: "Évaluation",
|
||||
|
|
|
@ -5,31 +5,16 @@ angular.module('forms').config(['$translateProvider', function ($translateProvid
|
|||
$translateProvider.translations('de', {
|
||||
// Konfigurieren der Formularregisterkarte
|
||||
ADVANCED_SETTINGS: 'Erweiterte Einstellungen',
|
||||
FORM_NAME: 'Ihr tellform heißt',
|
||||
FORM_STATUS: 'Status',
|
||||
FORM_NAME: 'Formularname',
|
||||
FORM_STATUS: 'Formularstatus',
|
||||
PUBLIC: 'Öffentlich',
|
||||
PRIVATE: 'Privat',
|
||||
GA_TRACKING_CODE: 'Google Analytics Tracking-Code',
|
||||
DISPLAY_FOOTER: 'Fußzeile',
|
||||
DISPLAY_FOOTER: 'Formularfußzeile anzeigen?',
|
||||
SAVE_CHANGES: 'Änderungen speichern',
|
||||
CANCEL: 'Abbrechen',
|
||||
DISPLAY_START_PAGE: 'Startseite',
|
||||
DISPLAY_END_PAGE: 'Benutzerdefinierte Endseite',
|
||||
|
||||
GENERAL_TAB: 'Allgemein',
|
||||
SELF_NOTIFICATIONS_TAB: 'Selbstbenachrichtigungen',
|
||||
RESPONDANT_NOTIFICATIONS_TAB: 'Beantwortungsbenachrichtigungen',
|
||||
|
||||
SEND_NOTIFICATION_TO: 'Senden an',
|
||||
NO_EMAIL_FIELD_WARNING: 'Fehler: Sie benötigen ein E-Mail-Feld in Ihrem Formular, um die E-Mail an Ihr Formular zu senden.',
|
||||
REPLY_TO: 'Antworten auf',
|
||||
EMAIL_SUBJECT: "Betreff",
|
||||
EMAIL_MESSAGE: 'Nachricht',
|
||||
ENABLE_RESPONDENT_NOTIFICATIONS: 'Antwortbenachrichtigungen sind derzeit',
|
||||
ENABLE_SELF_NOTIFICATIONS: 'Selbstbenachrichtigungen sind derzeit',
|
||||
TOGGLE_ENABLED: 'Aktiviert',
|
||||
TOGGLE_DISABLED: 'Deaktiviert',
|
||||
ADD_VARIABLE_BUTTON: 'Variable hinzufügen',
|
||||
DISPLAY_START_PAGE: 'Startseite anzeigen?',
|
||||
DISPLAY_END_PAGE: 'Benutzerdefinierte Endseite anzeigen?',
|
||||
|
||||
// Listenformularansicht
|
||||
CREATE_A_NEW_FORM: 'Erstelle ein neues Formular',
|
||||
|
@ -49,7 +34,6 @@ angular.module('forms').config(['$translateProvider', function ($translateProvid
|
|||
LOGIC_JUMP: 'Logischer Sprung',
|
||||
SHOW_BUTTONS: 'Zusätzliche Schaltflächen',
|
||||
SAVE_START_PAGE: 'Speichern',
|
||||
ADD_OPTIONS_PLACEHOLDER: 'Fügen Sie eine Auswahl pro Zeile hinzu. Mindestens eine Wahl ist erforderlich.',
|
||||
|
||||
// Admin-Formularansicht
|
||||
ARE_YOU_SURE: "Bist du ABSOLUT sicher?",
|
||||
|
@ -62,7 +46,7 @@ angular.module('forms').config(['$translateProvider', function ($translateProvid
|
|||
DELETE_FORM_MD: 'Formular löschen',
|
||||
DELETE: 'Löschen',
|
||||
FORM: 'Formular',
|
||||
VIEW_MY_TELLFORM: 'Mein tellform anzeigen',
|
||||
VIEW: 'Ansicht',
|
||||
LIVE: 'Leben',
|
||||
PREVIEW: 'Vorschau',
|
||||
COPY: 'Kopieren',
|
||||
|
@ -167,7 +151,7 @@ angular.module('forms').config(['$translateProvider', function ($translateProvid
|
|||
MULTIPLE_CHOICE: 'Mehrfachauswahl',
|
||||
DROPDOWN: 'Dropdown-Liste',
|
||||
DATE: 'Datum',
|
||||
PARAGRAPH_FIELD: "Absatz",
|
||||
PARAGRAPH_T: "Absatz",
|
||||
YES_NO: 'Ja / Nein',
|
||||
LEGAL: "Rechtliche",
|
||||
RATING: 'Bewertung',
|
||||
|
|
|
@ -5,31 +5,16 @@ angular.module('forms').config(['$translateProvider', function ($translateProvid
|
|||
$translateProvider.translations('it', {
|
||||
// Configura la visualizzazione scheda modulo
|
||||
ADVANCED_SETTINGS: 'Impostazioni avanzate',
|
||||
FORM_NAME: 'Il tuo tellform è chiamato',
|
||||
FORM_STATUS: 'Stato',
|
||||
FORM_NAME: 'Nome modulo',
|
||||
FORM_STATUS: 'Stato modulo',
|
||||
PUBLIC: 'pubblico',
|
||||
PRIVATE: 'Privato',
|
||||
GA_TRACKING_CODE: 'Codice di monitoraggio di Google Analytics',
|
||||
DISPLAY_FOOTER: 'Piè di pagina',
|
||||
DISPLAY_FOOTER: 'Visualizza piè di pagina?',
|
||||
SAVE_CHANGES: 'Salva modifiche',
|
||||
CANCEL: 'Annulla',
|
||||
DISPLAY_START_PAGE: 'Pagina iniziale',
|
||||
DISPLAY_END_PAGE: 'Pagina finale personalizzata',
|
||||
|
||||
GENERAL_TAB: 'Generale',
|
||||
SELF_NOTIFICATIONS_TAB: 'Autodiagnosi',
|
||||
RESPONDANT_NOTIFICATIONS_TAB: 'Notifiche rispondenti',
|
||||
|
||||
SEND_NOTIFICATION_TO: 'Invia a',
|
||||
NO_EMAIL_FIELD_WARNING: 'Errore: Hai bisogno di un campo e-mail nel tuo modulo per inviare l\'email al tuo interlocutore',
|
||||
REPLY_TO: 'Rispondi a',
|
||||
EMAIL_SUBJECT: 'Oggetto',
|
||||
EMAIL_MESSAGE: 'Messaggio',
|
||||
ENABLE_RESPONDENT_NOTIFICATIONS: 'Notifiche rispondenti sono attualmente',
|
||||
ENABLE_SELF_NOTIFICATIONS: 'Le notifiche auto sono attualmente',
|
||||
TOGGLE_ENABLED: 'Abilitato',
|
||||
TOGGLE_DISABLED: 'disabilitato',
|
||||
ADD_VARIABLE_BUTTON: 'Aggiungi variabile',
|
||||
DISPLAY_START_PAGE: 'Visualizza pagina iniziale?',
|
||||
DISPLAY_END_PAGE: 'Mostra pagina finale personalizzata?',
|
||||
|
||||
// Visualizzazione dei moduli di elenco
|
||||
CREATE_A_NEW_FORM: 'Crea un nuovo modulo',
|
||||
|
@ -49,7 +34,6 @@ angular.module('forms').config(['$translateProvider', function ($translateProvid
|
|||
LOGIC_JUMP: 'Jump Logic',
|
||||
SHOW_BUTTONS: 'Pulsanti aggiuntivi',
|
||||
SAVE_START_PAGE: 'Salva',
|
||||
ADD_OPTIONS_PLACEHOLDER: "Aggiungi una scelta per riga. È necessario un minimo di una scelta.",
|
||||
|
||||
// Visualizzazione modulo di amministrazione
|
||||
ARE_YOU_SURE: 'Sei ASSOLUTAMENTE sicuro?',
|
||||
|
@ -62,7 +46,7 @@ angular.module('forms').config(['$translateProvider', function ($translateProvid
|
|||
DELETE_FORM_MD: 'Elimina modulo',
|
||||
DELETE: 'Elimina',
|
||||
FORM: 'Forma',
|
||||
VIEW_MY_TELLFORM: 'Visualizza la mia informazione',
|
||||
VIEW: 'Visualizza',
|
||||
LIVE: 'Live',
|
||||
PREVIEW: 'Anteprima',
|
||||
COPY: 'Copia',
|
||||
|
@ -168,7 +152,7 @@ angular.module('forms').config(['$translateProvider', function ($translateProvid
|
|||
MULTIPLE_CHOICE: 'Scelta multipla',
|
||||
DROPDOWN: 'Dropdown',
|
||||
DATE: 'Data',
|
||||
PARAGRAPH_FIELD: 'Paragrafo',
|
||||
PARAGRAPH_T: 'Paragrafo',
|
||||
YES_NO: 'Sì / no',
|
||||
LEGAL: 'Legale',
|
||||
RATING: 'Valutazione',
|
||||
|
|
|
@ -3,33 +3,19 @@
|
|||
angular.module('forms').config(['$translateProvider', function ($translateProvider) {
|
||||
|
||||
$translateProvider.translations('es', {
|
||||
|
||||
//Configure Form Tab View
|
||||
ADVANCED_SETTINGS: 'Configuraciones avanzadas',
|
||||
FORM_NAME: 'Tu tellform se llama',
|
||||
FORM_STATUS: 'Estado',
|
||||
FORM_NAME: 'Nombre del formulario',
|
||||
FORM_STATUS: 'Estado del formulario',
|
||||
PUBLIC: 'Público',
|
||||
PRIVATE: 'Privado',
|
||||
GA_TRACKING_CODE: 'Código de Google Analytics',
|
||||
DISPLAY_FOOTER: 'Pie de página',
|
||||
DISPLAY_FOOTER: '¿Mostrar pie de página?',
|
||||
SAVE_CHANGES: 'Grabar',
|
||||
CANCEL: 'Cancelar',
|
||||
DISPLAY_START_PAGE: 'Página de inicio',
|
||||
DISPLAY_END_PAGE: 'Página final personalizada',
|
||||
|
||||
SELF_NOTIFICATIONS_TAB: 'Auto notificaciones',
|
||||
RESPONDANT_NOTIFICATIONS_TAB: 'Notificaciones de los demandados',
|
||||
GENERAL_TAB: 'Général',
|
||||
|
||||
SEND_NOTIFICATION_TO: 'Enviar a',
|
||||
NO_EMAIL_FIELD_WARNING: 'Error: necesita un campo de correo electrónico en su formulario para enviar el correo electrónico a su encuestado',
|
||||
REPLY_TO: 'Responder a',
|
||||
EMAIL_SUBJECT: 'Asunto',
|
||||
EMAIL_MESSAGE: 'Mensaje',
|
||||
ENABLE_RESPONDENT_NOTIFICATIONS: 'Las notificaciones de los demandados son actualmente',
|
||||
ENABLE_SELF_NOTIFICATIONS: 'Las notificaciones automáticas están actualmente',
|
||||
TOGGLE_ENABLED: 'Habilitado',
|
||||
TOGGLE_DISABLED: 'Desactivado',
|
||||
ADD_VARIABLE_BUTTON: 'Agregar variable',
|
||||
DISPLAY_START_PAGE: '¿Mostrar página de inicio?',
|
||||
DISPLAY_END_PAGE: '¿Mostrar paǵina de fin?',
|
||||
|
||||
//List Forms View
|
||||
CREATE_A_NEW_FORM: 'Crear formulario',
|
||||
|
@ -49,7 +35,6 @@ angular.module('forms').config(['$translateProvider', function ($translateProvid
|
|||
LOGIC_JUMP: 'Salto lógico',
|
||||
SHOW_BUTTONS: 'Botones adicionales',
|
||||
SAVE_START_PAGE: 'Grabar',
|
||||
ADD_OPTIONS_PLACEHOLDER: 'Agregue una opción por línea. Se requiere un mínimo de una opción',
|
||||
|
||||
//Admin Form View
|
||||
ARE_YOU_SURE: '¿Estás absolutamente seguro?',
|
||||
|
@ -62,7 +47,7 @@ angular.module('forms').config(['$translateProvider', function ($translateProvid
|
|||
DELETE_FORM_MD: 'Borrar formulario',
|
||||
DELETE: 'Borrar',
|
||||
FORM: 'Formulario',
|
||||
VIEW_MY_TELLFORM: 'Ver mi tellform',
|
||||
VIEW: 'Vista',
|
||||
LIVE: 'Online',
|
||||
PREVIEW: 'Vista previa',
|
||||
COPY: 'Copiar',
|
||||
|
@ -168,7 +153,7 @@ angular.module('forms').config(['$translateProvider', function ($translateProvid
|
|||
MULTIPLE_CHOICE: 'Opciones múltiples',
|
||||
DROPDOWN: 'Desplegable',
|
||||
DATE: 'Fecha',
|
||||
PARAGRAPH_FIELD: 'Párrafo',
|
||||
PARAGRAPH_T: 'Párrafo',
|
||||
YES_NO: 'Si/No',
|
||||
LEGAL: 'Legal',
|
||||
RATING: 'Puntaje',
|
||||
|
|
189
public/modules/forms/admin/config/i18n/swedish.js
Normal file
189
public/modules/forms/admin/config/i18n/swedish.js
Normal file
|
@ -0,0 +1,189 @@
|
|||
'use strict';
|
||||
|
||||
angular.module('forms').config(['$translateProvider', function ($translateProvider) {
|
||||
|
||||
$translateProvider.translations('sv', {
|
||||
// Konfigurera Formulär Tab Vy
|
||||
ADVANCED_SETTINGS: 'Avancerade Inställningar',
|
||||
FORM_NAME: 'Namn På Formulär',
|
||||
FORM_STATUS: 'Status På Formulär',
|
||||
PUBLIC: 'Offentlig',
|
||||
PRIVATE: 'Privat',
|
||||
GA_TRACKING_CODE: 'Google Analytics Spårningskod',
|
||||
DISPLAY_FOOTER: 'Visa Formulär Footer?',
|
||||
SAVE_CHANGES: 'Spara Ändringar',
|
||||
CANCEL: 'Avbryt',
|
||||
DISPLAY_START_PAGE: 'Visa Startsida?',
|
||||
DISPLAY_END_PAGE: 'Visa Anpassad Avslutningssida?',
|
||||
|
||||
// Lista Formulär-vy
|
||||
CREATE_A_NEW_FORM: 'Skapa ett nytt formulär',
|
||||
CREATE_FORM: 'Skapa formulär',
|
||||
CREATED_ON: 'Skapad den',
|
||||
MY_FORMS: 'Mina Formulär',
|
||||
NAME: 'Namn',
|
||||
SPRACHE: 'Språk',
|
||||
FORM_PAUSED: 'Formulär pausat',
|
||||
|
||||
// Redigera Fält Modal
|
||||
EDIT_FIELD: 'Redigera detta fält',
|
||||
SAVE_FIELD: 'Spara',
|
||||
ON: 'PÅ',
|
||||
AUS: 'AV',
|
||||
REQUIRED_FIELD: 'Obligatoriskt',
|
||||
LOGIC_JUMP: 'Logiskt Hopp',
|
||||
SHOW_BUTTONS: 'Ytterligare Knappar',
|
||||
SAVE_START_PAGE: 'Spara',
|
||||
|
||||
// Admin-vy
|
||||
ARE_YOU_SURE: "Är du ABSOLUT säker?",
|
||||
READ_WARNING: 'Oförväntade dåliga saker kommer hända om du inte läser detta!',
|
||||
DELETE_WARNING1: 'Denna handling kan INTE göras ogjord. Den kommer att permanent radera "',
|
||||
DELETE_WARNING2: '"Formuläret och alla associerade inskick.',
|
||||
DELETE_CONFIRM: 'Vänligen skriv in namnet av formuläret för att bekräfta',
|
||||
I_UNDERSTAND: "Jag förstår konsekvenserna, radera detta formulär.",
|
||||
DELETE_FORM_SM: 'Radera',
|
||||
DELETE_FORM_MD: 'Radera Formulär',
|
||||
DELETE: 'Radera',
|
||||
FORM: 'Formulär',
|
||||
VIEW: 'Vy',
|
||||
LIVE: 'Live',
|
||||
PREVIEW: 'Förhandsvy',
|
||||
COPY: 'Kopiera',
|
||||
COPY_AND_PASTE: 'Kopiera och Klistra in detta för att lägga till din TellForm till din hemsida.',
|
||||
CHANGE_WIDTH_AND_HEIGHT: 'Ändra bredd- och höjdvärden för att det ska passa dig bäst',
|
||||
POWERED_BY: 'Genererad av',
|
||||
TELLFORM_URL: "Din TellForm är permanent på denna URL",
|
||||
|
||||
// Redigera Form-vy
|
||||
DISABLED: 'Avaktiverat',
|
||||
JA: 'JA',
|
||||
NO: 'NEJ',
|
||||
ADD_LOGIC_JUMP: 'Lägg till Logic Jump',
|
||||
ADD_FIELD_LG: 'Klicka för att Lägga Till Nytt Fält',
|
||||
ADD_FIELD_MD: 'Lägg Till Nytt Fält',
|
||||
ADD_FIELD_SM: 'Lägg Till Fält',
|
||||
EDIT_START_PAGE: 'Redigera Startsida',
|
||||
EDIT_END_PAGE: 'Redigera Slutsida',
|
||||
WELCOME_SCREEN: 'Startsida',
|
||||
END_SCREEN: 'Slutsida',
|
||||
INTRO_TITLE: 'Titel',
|
||||
INTRO_PARAGRAPH: "Stycke",
|
||||
INTRO_BTN: 'Startknapp',
|
||||
TITLE: "Titel",
|
||||
PARAGRAPH: "Stycke",
|
||||
BTN_TEXT: 'Gå Tillbaka Knapp',
|
||||
BUTTONS: 'Knappar',
|
||||
BUTTON_TEXT: 'Text',
|
||||
BUTTON_LINK: 'Länk',
|
||||
ADD_BUTTON: 'Lägg Till Knapp',
|
||||
PREVIEW_FIELD: 'Förhandsgranska Fråga',
|
||||
QUESTION_TITLE: 'Titel',
|
||||
QUESTION_DESCRIPTION: 'Beskrivning',
|
||||
OPTIONS: 'Alternativ',
|
||||
ADD_OPTION: 'Lägg Till Alternativ',
|
||||
NUM_OF_STEPS: 'Antal Steg',
|
||||
CLICK_FIELDS_FOOTER: 'Klicka på fälten för att lägga till dem här',
|
||||
IF_THIS_FIELD: 'Om detta fält',
|
||||
IS_EQUAL_TO: 'är lika med',
|
||||
IS_NOT_EQUAL_TO: 'inte lika med',
|
||||
IS_GREATER_THAN: 'är större än',
|
||||
IS_GREATER_OR_EQUAL_THAN: 'är större eller lika med än',
|
||||
IS_SMALLER_THAN: 'är mindre än',
|
||||
IS_SMALLER_OR_EQUAL_THAN: 'är mindre eller lika med än',
|
||||
CONTAINS: 'innehåller',
|
||||
DOES_NOT_CONTAINS: 'inte innehåller',
|
||||
ENDS_WITH: 'slutar med',
|
||||
DOES_NOT_END_WITH: 'inte slutar med',
|
||||
STARTS_WITH: 'börjar med',
|
||||
DOES_NOT_START_WITH: 'inte börjar med',
|
||||
THEN_JUMP_TO: 'hoppa då till',
|
||||
|
||||
// Redigera Inskicks-vy
|
||||
TOTAL_VIEWS: 'totalt antal unika besök',
|
||||
RESPONSES: 'svar',
|
||||
COMPLETION_RATE: 'grad av fullföljande',
|
||||
AVERAGE_TIME_TO_COMPLETE: 'snitt på tid för fullföljande',
|
||||
|
||||
DESKTOP_AND_LAPTOP: 'Datorer',
|
||||
TABLETS: "Plattor",
|
||||
PHONES: 'Telefoner',
|
||||
OTHER: 'Andra',
|
||||
UNIQUE_VISITS: 'Unika Besök',
|
||||
|
||||
FIELD_TITLE: 'Titel på fält',
|
||||
FIELD_VIEWS: 'Vyer på fält',
|
||||
FIELD_DROPOFF: 'Fullföljande på fält',
|
||||
FIELD_RESPONSES: 'Svar på fält',
|
||||
DELETE_SELECTED: 'Ausgewählte löschen',
|
||||
EXPORT_TO_EXCEL: 'Exportera till Excel',
|
||||
EXPORT_TO_CSV: 'Exportera till CSV',
|
||||
EXPORT_TO_JSON: 'Exportera till JSON',
|
||||
PERCENTAGE_COMPLETE: 'Procent fullföljt',
|
||||
TIME_ELAPSED: 'Tid som gått',
|
||||
DEVICE: 'Utrustning',
|
||||
LOCATION: 'Ort',
|
||||
IP_ADDRESS: 'IP-Adress',
|
||||
DATE_SUBMITTED: 'Datum för inskick',
|
||||
|
||||
// Designvy
|
||||
BACKGROUND_COLOR: 'Bakgrundsfärg',
|
||||
DESIGN_HEADER: 'Ändra hur ditt Formulär ser ut',
|
||||
QUESTION_TEXT_COLOR: 'Frågetextens färg',
|
||||
ANSWER_TEXT_COLOR: 'Svarstextens färg',
|
||||
BTN_BACKGROUND_COLOR: 'Knappens bakgrundsfärg',
|
||||
BTN_TEXT_COLOR: 'Knappens textfärg',
|
||||
|
||||
// Delningsvy
|
||||
EMBED_YOUR_FORM: 'Bädda in ditt Formulär',
|
||||
SHARE_YOUR_FORM: 'Dela ditt Formulär',
|
||||
|
||||
// Admin-tab
|
||||
CREATE_TAB: 'Skapa',
|
||||
DESIGN_TAB: 'Designa',
|
||||
CONFIGURE_TAB: 'Konfigurera',
|
||||
ANALYZE_TAB: 'Analysera',
|
||||
SHARE_TAB: 'Dela',
|
||||
|
||||
// Fälttyper
|
||||
SHORT_TEXT: 'Korttext',
|
||||
EMAIL: 'E-post',
|
||||
MULTIPLE_CHOICE: 'Flervalsfråga',
|
||||
DROPDOWN: 'Rullgardinslista',
|
||||
DATE: 'Datum',
|
||||
PARAGRAPH_T: "Stycke",
|
||||
YES_NO: 'Ja / Nej',
|
||||
LEGAL: "Juridiskt",
|
||||
RATING: 'Betygssättning',
|
||||
NUMBERS: 'Nummer',
|
||||
SIGNATURE: "Signatur",
|
||||
FILE_UPLOAD: 'Filuppladdning',
|
||||
OPTION_SCALE: 'Alternativskala',
|
||||
PAYMENT: "Betalning",
|
||||
STATEMENT: 'Uttalande',
|
||||
LINK: 'Länk',
|
||||
|
||||
// Förhandsgranskning Formulär
|
||||
FORM_SUCCESS: 'Formulär framgångsrikt inskickat!',
|
||||
REVIEW: 'Granska',
|
||||
BACK_TO_FORM: 'Gå Tillbaka till Formulär',
|
||||
EDIT_FORM: 'Redigera denna TellForm',
|
||||
ADVANCEMENT: '{{done}} av {{total}} svarade',
|
||||
CONTINUE_FORM: 'Fortsätt till Formulär',
|
||||
REQUIRED: 'obligatorisk',
|
||||
COMPLETING_NEEDED: '{{answers_not_completed}} svar kräver komplettering',
|
||||
OPTIONAL: 'valfri',
|
||||
ERROR_EMAIL_INVALID: 'Vänligen ange en giltig e-postadress',
|
||||
ERROR_NOT_A_NUMBER: 'Vänligen ange endast giltiga nummer',
|
||||
ERROR_URL_INVALID: 'Vänligen en giltig URL',
|
||||
OK: 'OK',
|
||||
ENTER: 'tryck ENTER',
|
||||
NEWLINE: 'tryck SHIFT+ENTER för att skapa ny rad',
|
||||
CONTINUE: 'Fortsätt',
|
||||
LEGAL_ACCEPT: "Jag accepterar",
|
||||
LEGAL_NO_ACCEPT: "Jag accepterar inte",
|
||||
SUBMIT: 'Skicka',
|
||||
UPLOAD_FILE: 'Ladda upp din Fil'
|
||||
});
|
||||
|
||||
}]);
|
|
@ -4,12 +4,19 @@
|
|||
angular.module('forms').controller('AdminFormController', ['$rootScope', '$window', '$scope', '$stateParams', '$state', 'Forms', 'CurrentForm', '$http', '$uibModal', 'myForm', '$filter', '$translate',
|
||||
function($rootScope, $window, $scope, $stateParams, $state, Forms, CurrentForm, $http, $uibModal, myForm, $filter, $translate) {
|
||||
|
||||
//Set active tab to Create
|
||||
$scope.activePill = 0;
|
||||
|
||||
$scope.copied = false;
|
||||
$scope.onCopySuccess = function (e) {
|
||||
$scope.copied = true;
|
||||
};
|
||||
|
||||
$scope = $rootScope;
|
||||
$scope.animationsEnabled = true;
|
||||
$scope.myform = myForm;
|
||||
$rootScope.saveInProgress = false;
|
||||
$scope.oldForm = _.cloneDeep($scope.myform);
|
||||
$scope.designTabActive = false
|
||||
|
||||
CurrentForm.setForm($scope.myform);
|
||||
|
||||
|
@ -29,6 +36,7 @@ angular.module('forms').controller('AdminFormController', ['$rootScope', '$windo
|
|||
$scope.actualFormURL = window.location.protocol + '//' + window.location.host + $scope.formURL;
|
||||
}
|
||||
|
||||
|
||||
var refreshFrame = $scope.refreshFrame = function(){
|
||||
if(document.getElementById('iframe')) {
|
||||
document.getElementById('iframe').contentWindow.location.reload();
|
||||
|
@ -36,59 +44,13 @@ angular.module('forms').controller('AdminFormController', ['$rootScope', '$windo
|
|||
};
|
||||
|
||||
$scope.tabData = [
|
||||
{
|
||||
heading: $filter('translate')('CREATE_TAB'),
|
||||
route: 'viewForm.create',
|
||||
active: false
|
||||
},
|
||||
{
|
||||
heading: $filter('translate')('CONFIGURE_TAB'),
|
||||
route: 'viewForm.configure.general',
|
||||
active: false
|
||||
},
|
||||
{
|
||||
heading: $filter('translate')('ANALYZE_TAB'),
|
||||
route: 'viewForm.analyze',
|
||||
active: false
|
||||
},
|
||||
{
|
||||
heading: $filter('translate')('SHARE_TAB'),
|
||||
route: 'viewForm.share',
|
||||
active: false
|
||||
},
|
||||
{
|
||||
heading: $filter('translate')('DESIGN_TAB'),
|
||||
route: 'viewForm.design',
|
||||
active: false
|
||||
templateName: 'configure'
|
||||
}
|
||||
];
|
||||
|
||||
$scope.go = function(tab){
|
||||
var currParentState = $state.current.name.split('.').slice(0,2).join('.');
|
||||
var tabParentState = tab.route.split('.').slice(0,2).join('.');
|
||||
|
||||
if(currParentState !== tabParentState && tabParentState !== 'viewForm.configure.general'){
|
||||
$state.go(tab.route);
|
||||
}
|
||||
};
|
||||
|
||||
function setActiveTab() {
|
||||
$scope.tabData.forEach(function(tab) {
|
||||
var currentTabState = $state.current.name.split('.').slice(0,2).join('.');
|
||||
var tabRouteState = tab.route.split('.').slice(0,2).join('.');
|
||||
tab.active = (currentTabState === tabRouteState);
|
||||
|
||||
if(tab.active && tab.route === 'viewForm.design'){
|
||||
$scope.designTabActive = true;
|
||||
} else {
|
||||
$scope.designTabActive = false;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
setActiveTab();
|
||||
|
||||
$scope.$on("$stateChangeSuccess", setActiveTab());
|
||||
$scope.designTabActive = false
|
||||
|
||||
$scope.deactivateDesignTab = function(){
|
||||
$scope.designTabActive = false
|
||||
|
|
|
@ -1,43 +0,0 @@
|
|||
.tag {
|
||||
background-color: #999;
|
||||
border-radius: 3px 3px 3px 3px;
|
||||
border: 0;
|
||||
color: #FFFFFF;
|
||||
font-style: inherit;
|
||||
font-size: 11px;
|
||||
padding: 4px 5px;
|
||||
margin: 0 2px 2px 2px;
|
||||
font-family: inherit;
|
||||
white-space: nowrap;
|
||||
vertical-align: middle;
|
||||
cursor: pointer !important;
|
||||
pointer-events: none;
|
||||
}
|
||||
|
||||
.email-subject.ta-root .ta-editor.ta-html, .email-subject .ta-scroll-window.form-control {
|
||||
min-height: 0;
|
||||
overflow: hidden;
|
||||
height: auto;
|
||||
border-radius: 4px;
|
||||
box-shadow: none;
|
||||
font-size: 18px;
|
||||
padding-top: 10px;
|
||||
}
|
||||
|
||||
.email-subject.ta-root .ta-scroll-window > .ta-bind {
|
||||
min-height: 0;
|
||||
outline: 0;
|
||||
}
|
||||
|
||||
.ui-select input.form-control {
|
||||
height: 34px;
|
||||
padding: 6px;
|
||||
}
|
||||
|
||||
.config-form .btn-secondary {
|
||||
border-color: #DDDDDD;
|
||||
}
|
||||
|
||||
.notification-toggle.toggle-switch {
|
||||
margin: 5px 0;
|
||||
}
|
|
@ -247,25 +247,9 @@ div.config-form .row.field {
|
|||
margin: 10px 0 10px;
|
||||
}
|
||||
|
||||
.view-form-btn {
|
||||
border: none;
|
||||
}
|
||||
.view-form-btn.span {
|
||||
padding-right:0.6em;
|
||||
}
|
||||
|
||||
.notification-row {
|
||||
display: inline-block;
|
||||
padding: 0 5px;
|
||||
}
|
||||
|
||||
.status-light {
|
||||
font-size: 10px;
|
||||
}
|
||||
|
||||
.notification-row .status-light {
|
||||
padding-top: 15px;
|
||||
}
|
||||
.status-light.status-light-off {
|
||||
color: #BE0000;
|
||||
}
|
||||
|
|
|
@ -1,79 +1,23 @@
|
|||
'use strict';
|
||||
|
||||
angular.module('forms').directive('configureFormDirective', ['$rootScope', '$filter', '$state',
|
||||
function ($rootScope, $filter, $state) {
|
||||
angular.module('forms').directive('configureFormDirective', ['$rootScope', '$http', 'Upload', 'CurrentForm',
|
||||
function ($rootScope, $http, Upload, CurrentForm) {
|
||||
return {
|
||||
templateUrl: 'modules/forms/admin/views/directiveViews/form/configure-form.client.view.html',
|
||||
restrict: 'E',
|
||||
scope: {
|
||||
myform:'='
|
||||
myform:'=',
|
||||
user:'=',
|
||||
pdfFields:'@',
|
||||
formFields:'@'
|
||||
},
|
||||
controller: function($scope){
|
||||
$rootScope.myform = $scope.myform;
|
||||
$scope.log = '';
|
||||
$scope.languages = $rootScope.languages;
|
||||
|
||||
$scope.resetForm = $rootScope.resetForm;
|
||||
$scope.update = $rootScope.update;
|
||||
|
||||
$scope.$evalAsync(function() {
|
||||
angular.element('.tag')
|
||||
});
|
||||
|
||||
$scope.languages = ['en', 'fr', 'es', 'it', 'de'];
|
||||
|
||||
$scope.langCodeToWord = {
|
||||
'en': 'English',
|
||||
'fr': 'Français',
|
||||
'es': 'Español',
|
||||
'it': 'Italiàno',
|
||||
'de': 'Deutsch'
|
||||
};
|
||||
|
||||
$scope.wordToLangCode = {
|
||||
'English': 'en',
|
||||
'Français': 'fr',
|
||||
'Español': 'es',
|
||||
'Italiàno': 'it',
|
||||
'Deutsch': 'de'
|
||||
};
|
||||
|
||||
$scope.configureTabs = [
|
||||
{
|
||||
heading: $filter('translate')('GENERAL_TAB'),
|
||||
route: 'viewForm.configure.general',
|
||||
active: false
|
||||
},
|
||||
{
|
||||
heading: $filter('translate')('SELF_NOTIFICATIONS_TAB'),
|
||||
route: 'viewForm.configure.self_notifications',
|
||||
active: false
|
||||
},
|
||||
{
|
||||
heading: $filter('translate')('RESPONDENT_NOTIFICATIONS_TAB'),
|
||||
route: 'viewForm.configure.respondent_notifications',
|
||||
active: false
|
||||
}
|
||||
];
|
||||
|
||||
$scope.emailFields = $scope.myform.form_fields.filter(function(field){
|
||||
return field.fieldType === 'email';
|
||||
});
|
||||
|
||||
$scope.formHasEmailField = ($scope.emailFields.length > 0);
|
||||
|
||||
$scope.go = function(tab){
|
||||
tab.active = true;
|
||||
$state.go(tab.route);
|
||||
};
|
||||
|
||||
function setActiveTab() {
|
||||
$scope.configureTabs.forEach(function(tab) {
|
||||
tab.active = ($state.current.name === tab.route);
|
||||
});
|
||||
}
|
||||
|
||||
setActiveTab();
|
||||
|
||||
$scope.$on("$stateChangeSuccess", setActiveTab());
|
||||
}
|
||||
};
|
||||
}
|
||||
|
|
|
@ -1,14 +0,0 @@
|
|||
'use strict';
|
||||
|
||||
angular.module('forms').directive('designFormDirective', [
|
||||
function () {
|
||||
return {
|
||||
templateUrl: 'modules/forms/admin/views/directiveViews/form/design-form.client.view.html',
|
||||
restrict: 'E',
|
||||
scope: {
|
||||
myform:'=',
|
||||
formurl: '='
|
||||
}
|
||||
}
|
||||
}
|
||||
]);
|
|
@ -1,3 +1,4 @@
|
|||
|
||||
'use strict';
|
||||
|
||||
angular.module('forms').directive('editFormDirective', ['$rootScope', 'FormFields', '$uibModal',
|
||||
|
@ -36,60 +37,22 @@ angular.module('forms').directive('editFormDirective', ['$rootScope', 'FormField
|
|||
animation: true,
|
||||
templateUrl: 'editFieldModal.html',
|
||||
windowClass: 'edit-modal-window',
|
||||
scope: $scope,
|
||||
controller: function($uibModalInstance, $scope) {
|
||||
var fieldOptionsToString = function(){
|
||||
if(!$scope.field.fieldOptions){
|
||||
return '';
|
||||
}
|
||||
|
||||
return $scope.field.fieldOptions.map(function(fieldOption){
|
||||
return fieldOption.option_value;
|
||||
}).join('\n');
|
||||
}
|
||||
|
||||
$scope.field = curr_field;
|
||||
$scope.showLogicJump = false;
|
||||
|
||||
$scope.isEdit = isEdit;
|
||||
$scope.options = {
|
||||
isEdit: isEdit,
|
||||
fieldOptionsString: fieldOptionsToString()
|
||||
}
|
||||
|
||||
var stringToFieldOptions = function(fieldOptionsString){
|
||||
var values = fieldOptionsString.split('\n');
|
||||
var fieldOptions = [];
|
||||
for(var i=0; i < values.length; i++){
|
||||
fieldOptions.push({
|
||||
option_value: values[i]
|
||||
});
|
||||
}
|
||||
|
||||
return fieldOptions;
|
||||
}
|
||||
|
||||
$scope.$watch('options.fieldOptionsString', function(newVal, oldVal){
|
||||
if(newVal !== oldVal){
|
||||
$scope.field.fieldOptions = stringToFieldOptions(newVal);
|
||||
}
|
||||
});
|
||||
|
||||
// decides whether field options block will be shown (true for dropdown and radio fields)
|
||||
$scope.showListOptions = function () {
|
||||
if($scope.field.fieldType === 'dropdown' || $scope.field.fieldType === 'radio'){
|
||||
$scope.showAddOptions = function (field){
|
||||
if($scope.field.fieldType === 'dropdown' || $scope.field.fieldType === 'checkbox' || $scope.field.fieldType === 'radio'){
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
return false;
|
||||
};
|
||||
|
||||
// decides whether field options block will be shown (true for rating fields)
|
||||
$scope.showRatingOptions = function (){
|
||||
if($scope.field.fieldType === 'rating'){
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
};
|
||||
|
||||
$scope.validShapes = [
|
||||
$scope.validShapes = [
|
||||
'Heart',
|
||||
'Star',
|
||||
'thumbs-up',
|
||||
|
@ -105,7 +68,42 @@ angular.module('forms').directive('editFormDirective', ['$rootScope', 'FormField
|
|||
'Trash'
|
||||
];
|
||||
|
||||
//Name to Font-Awesome Conversion Map
|
||||
// add new option to the field
|
||||
$scope.addOption = function(){
|
||||
if($scope.field.fieldType === 'checkbox' || $scope.field.fieldType === 'dropdown' || $scope.field.fieldType === 'radio'){
|
||||
if(!$scope.field.fieldOptions){
|
||||
$scope.field.fieldOptions = [];
|
||||
}
|
||||
|
||||
var lastOptionID = $scope.field.fieldOptions.length+1;
|
||||
|
||||
// new option's id
|
||||
|
||||
var newOption = {
|
||||
'option_id' : Math.floor(100000*Math.random()),
|
||||
'option_title' : 'Option '+lastOptionID,
|
||||
'option_value' : 'Option ' +lastOptionID
|
||||
};
|
||||
|
||||
// put new option into fieldOptions array
|
||||
$scope.field.fieldOptions.push(newOption);
|
||||
}
|
||||
};
|
||||
|
||||
// delete particular option
|
||||
$scope.deleteOption = function (option){
|
||||
if($scope.field.fieldType === 'checkbox' || $scope.field.fieldType === 'dropdown' || $scope.field.fieldType === 'radio'){
|
||||
for(var i = 0; i < $scope.field.fieldOptions.length; i++){
|
||||
if($scope.field.fieldOptions[i].option_id === option.option_id){
|
||||
|
||||
$scope.field.fieldOptions.splice(i, 1);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
//Populate Name to Font-awesomeName Conversion Map
|
||||
$scope.select2FA = {
|
||||
'Heart': 'Heart',
|
||||
'Star': 'Star',
|
||||
|
@ -122,12 +120,17 @@ angular.module('forms').directive('editFormDirective', ['$rootScope', 'FormField
|
|||
'Trash': 'Trash Can'
|
||||
};
|
||||
|
||||
if($scope.field.fieldType === 'dropdown' || $scope.field.fieldType === 'radio'){
|
||||
|
||||
}
|
||||
// decides whether field options block will be shown (true for dropdown and radio fields)
|
||||
$scope.showRatingOptions = function (){
|
||||
if($scope.field.fieldType === 'rating'){
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
};
|
||||
|
||||
$scope.saveField = function(){
|
||||
if($scope.options.isEdit){
|
||||
if($scope.isEdit){
|
||||
$scope.myform.form_fields[field_index] = $scope.field;
|
||||
} else {
|
||||
$scope.myform.form_fields.push(curr_field);
|
||||
|
@ -291,7 +294,7 @@ angular.module('forms').directive('editFormDirective', ['$rootScope', 'FormField
|
|||
required: true,
|
||||
disabled: false,
|
||||
deletePreserved: false,
|
||||
logicJump: {},
|
||||
logicJump: {}
|
||||
};
|
||||
|
||||
if(fieldType === 'rating'){
|
||||
|
@ -302,15 +305,36 @@ angular.module('forms').directive('editFormDirective', ['$rootScope', 'FormField
|
|||
newField.fieldValue = 0;
|
||||
}
|
||||
|
||||
if(fieldType === 'dropdown' || fieldType === 'radio'){
|
||||
newField.fieldOptions = [{
|
||||
option_value: 'Option1'
|
||||
}];
|
||||
if($scope.showAddOptions(newField)){
|
||||
newField.fieldOptions = [];
|
||||
newField.fieldOptions.push({
|
||||
'option_id' : Math.floor(100000*Math.random()), //Generate pseudo-random option id
|
||||
'option_title' : 'Option 0',
|
||||
'option_value' : 'Option 0'
|
||||
});
|
||||
}
|
||||
|
||||
$scope.openEditModal(newField, false, $scope.myform.form_fields.length);
|
||||
$scope.openEditModal(newField, false, $scope.myform.form_fields.length);
|
||||
};
|
||||
|
||||
// decides whether field options block will be shown (true for dropdown and radio fields)
|
||||
$scope.showAddOptions = function (field){
|
||||
if(field.fieldType === 'dropdown' || field.fieldType === 'checkbox' || field.fieldType === 'radio'){
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
};
|
||||
|
||||
// decides whether field options block will be shown (true for dropdown and radio fields)
|
||||
$scope.showRatingOptions = function (field){
|
||||
if(field.fieldType === 'rating'){
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
};
|
||||
|
||||
// Delete particular field on button click
|
||||
$scope.deleteField = function (field_index) {
|
||||
$scope.myform.form_fields.splice(field_index, 1);
|
||||
|
|
|
@ -1,16 +0,0 @@
|
|||
'use strict';
|
||||
|
||||
angular.module('forms').directive('shareFormDirective', ['$rootScope',
|
||||
function ($rootScope) {
|
||||
return {
|
||||
templateUrl: 'modules/forms/admin/views/directiveViews/form/share-form.client.view.html',
|
||||
restrict: 'E',
|
||||
scope: {
|
||||
actualformurl:'='
|
||||
},
|
||||
controller: function($scope){
|
||||
$scope.actualFormURL = $scope.actualformurl;
|
||||
}
|
||||
};
|
||||
}
|
||||
]);
|
|
@ -30,7 +30,7 @@ angular.module('forms').service('FormFields', [ '$rootScope', '$translate', 'Aut
|
|||
},
|
||||
{
|
||||
name : 'textarea',
|
||||
value : $translate.instant('PARAGRAPH_FIELD'),
|
||||
value : $translate.instant('PARAGRAPH'),
|
||||
},
|
||||
{
|
||||
name : 'yes_no',
|
||||
|
|
|
@ -42,26 +42,158 @@
|
|||
<div class="col-xs-1 col-sm-2">
|
||||
<small class="pull-right">
|
||||
<a class="btn btn-secondary view-form-btn" href="{{actualFormURL}}">
|
||||
<i class="fa fa-external-link"></i>
|
||||
<span>
|
||||
{{ 'VIEW_MY_TELLFORM' | translate }}
|
||||
<span class="hidden-xs hidden-sm">
|
||||
{{ 'VIEW' | translate }}
|
||||
<span ng-show="myform.isLive">
|
||||
{{ 'LIVE' | translate }}
|
||||
</span>
|
||||
<span ng-hide="myform.isLive">{{ 'PREVIEW' | translate }}</span>
|
||||
</span>
|
||||
<i class="status-light status-light-on fa fa-circle" ng-if="myform.isLive"></i>
|
||||
<i class="status-light status-light-off fa fa-circle" ng-if="!myform.isLive"></i>
|
||||
<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>
|
||||
</small>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div >
|
||||
<uib-tabset vertical="true" type="pills">
|
||||
<uib-tab ng-repeat="tab in tabData" active="tab.active" select="go(tab)" heading="{{tab.heading}}">
|
||||
<div class="col-xs-12">
|
||||
<uib-tabset active="activePill" vertical="true" type="pills">
|
||||
<uib-tab index="0" heading="{{ 'CREATE_TAB' | translate }}" select="deactivateDesignTab()">
|
||||
<edit-form-directive myform="myform"></edit-form-directive>
|
||||
</uib-tab>
|
||||
<uib-tab ng-repeat="tab in tabData" index="{{$index+1}}" heading="{{tab.heading}}" select="deactivateDesignTab()">
|
||||
<div class='row' data-ng-include="'/static/modules/forms/admin/views/adminTabs/'+tab.templateName+'.html'"></div>
|
||||
</uib-tab>
|
||||
<uib-tab index="2" heading="{{ 'ANALYZE_TAB' | translate }}" select="deactivateDesignTab()">
|
||||
<edit-submissions-form-directive myform="myform" user="myform.admin"></edit-submissions-form-directive>
|
||||
</uib-tab>
|
||||
<uib-tab ng-if="tabData" heading="{{ 'SHARE_TAB' | translate }}" index="{{tabData.length}}" select="deactivateDesignTab()">
|
||||
<div class="config-form">
|
||||
<div class="row">
|
||||
<div class="col-sm-12">
|
||||
<uib-tabset active="activePill" vertical="true" type="pills">
|
||||
<uib-tab index="0" heading="{{ 'SHARE_YOUR_FORM' | translate }}">
|
||||
<div class="row">
|
||||
<div class="col-sm-12">
|
||||
{{ 'TELLFORM_URL' | translate }}
|
||||
</div>
|
||||
<div class="col-sm-8 form-input">
|
||||
<span ngclipboard data-clipboard-target="#copyURL"> <input id="copyURL" ng-value="actualFormURL" class="form-control ng-pristine ng-untouched ng-valid"> </span>
|
||||
</div>
|
||||
<div class="col-sm-4">
|
||||
<button class="btn btn btn-secondary view-form-btn" ngclipboard data-clipboard-target="#copyURL">
|
||||
{{ 'COPY' | translate }} <i class="fa fa-clipboard" aria-hidden="true"></i>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</uib-tab>
|
||||
<uib-tab index="1" heading="{{ 'EMBED_YOUR_FORM' | translate }}">
|
||||
<div class="row">
|
||||
<div class="col-sm-12">
|
||||
{{ 'COPY_AND_PASTE' | translate }}
|
||||
</div>
|
||||
<div class="col-sm-8 form-input">
|
||||
<span ngclipboard data-clipboard-target="#copyEmbedded">
|
||||
<textarea id="copyEmbedded" class="form-control ng-pristine ng-untouched ng-valid" style="min-height:200px; width:100%; background-color: #FFFFCC; color: #30313F;">
|
||||
<!-- {{ 'CHANGE_WIDTH_AND_HEIGHT' | translate }} -->
|
||||
<iframe id="iframe" src="{{actualFormURL}}" style="width:100%;height:500px;"></iframe>
|
||||
<div style="font-family: Sans-Serif;font-size: 12px;color: #999;opacity: 0.5; padding-top: 5px;">{{ 'POWERED_BY' | translate }} <a href="https://www.tellform.com" style="color: #999" target="_blank">TellForm</a></div>
|
||||
</textarea>
|
||||
</span>
|
||||
</div>
|
||||
<div class="col-sm-4">
|
||||
<button class="btn btn btn-secondary view-form-btn" ngclipboard data-clipboard-target="#copyEmbedded">
|
||||
{{ 'COPY' | translate }} <i class="fa fa-clipboard" aria-hidden="true"></i>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</uib-tab>
|
||||
</uib-tabset>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</uib-tab>
|
||||
<uib-tab class="design-tab" ng-if="tabData && myform.form_fields.length" heading="{{ 'DESIGN_TAB' | translate }}" index="{{tabData.length}}+1"
|
||||
select="activateDesignTab()">
|
||||
<div class="config-form design container">
|
||||
<div class="row">
|
||||
<div class="col-sm-4 col-xs-12">
|
||||
<div class="row field">
|
||||
<div class="field-title col-sm-5">
|
||||
<h5>{{ 'BACKGROUND_COLOR' | translate }}</h5>
|
||||
</div>
|
||||
<div class="field-input col-sm-6">
|
||||
<input class="form-control" colorpicker="hex" type="text"
|
||||
ng-model="myform.design.colors.backgroundColor"
|
||||
ng-pattern="/^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$/"
|
||||
ng-style="{ 'background-color': myform.design.colors.backgroundColor }"/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row field">
|
||||
<div class="field-title col-sm-5">
|
||||
<h5>{{ 'QUESTION_TEXT_COLOR' | translate }}</h5>
|
||||
</div>
|
||||
|
||||
<div class="field-input col-sm-6">
|
||||
<input class="form-control" colorpicker="hex" type="text" ng-model="myform.design.colors.questionColor" ng-pattern="/^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$/"ng-style="{ 'background-color': myform.design.colors.questionColor }"/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row field">
|
||||
<div class="field-title col-sm-5">
|
||||
<h5>{{ 'ANSWER_TEXT_COLOR' | translate }}</h5>
|
||||
</div>
|
||||
|
||||
<div class="field-input col-sm-6">
|
||||
<input class="form-control" colorpicker="hex" type="text" ng-model="myform.design.colors.answerColor" ng-pattern="/^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$/" ng-style="{ 'background-color': myform.design.colors.answerColor }"/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row field">
|
||||
<div class="field-title col-sm-5">
|
||||
<h5>{{ 'BTN_BACKGROUND_COLOR' | translate }}</h5>
|
||||
</div>
|
||||
|
||||
<div class="field-input col-sm-6">
|
||||
<input class="form-control" colorpicker="hex" type="text"
|
||||
ng-model="myform.design.colors.buttonColor"
|
||||
ng-pattern="/^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$/"
|
||||
ng-style="{ 'background-color': myform.design.colors.buttonColor }"/>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row field">
|
||||
<div class="field-title col-sm-5">
|
||||
<h5>{{ 'BTN_TEXT_COLOR' | translate }}</h5>
|
||||
</div>
|
||||
|
||||
<div class="field-input col-sm-6">
|
||||
<input class="form-control" colorpicker="hex" type="text"
|
||||
ng-model="myform.design.colors.buttonTextColor"
|
||||
ng-pattern="/^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$/"
|
||||
ng-style="{ 'background-color': myform.design.colors.buttonTextColor }"/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-sm-8 hidden-xs" ng-if="designTabActive">
|
||||
<div class="public-form" ng-style="{ 'background-color': myform.design.colors.backgroundColor }">
|
||||
<iframe id="iframe" ng-if="!!formURL" ng-src="{{formURL | trustSrc}}" style="border: none; box-shadow: 0px 0px 10px 0px grey; overflow: hidden; height: 400px; width: 90%; position: absolute;"></iframe>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-sm-offset-4 col-sm-2">
|
||||
<button class="btn btn-signup btn-rounded" type="button" ng-click="updateDesign(false, myform, false, false)"><i class="icon-arrow-left icon-white"></i>{{ 'SAVE_CHANGES' | translate }}</button>
|
||||
</div>
|
||||
<div class="col-sm-1">
|
||||
<button class="btn btn-secondary btn-rounded" type="button" ng-click="resetForm()"><i class="icon-eye-open icon-white"></i>{{ 'CANCEL' | translate }}</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</uib-tab>
|
||||
</uib-tabset>
|
||||
</div>
|
||||
<div class="col-xs-10">
|
||||
<div ui-view></div>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
|
|
|
@ -1,4 +1,2 @@
|
|||
<link rel='stylesheet' href='https://cdnjs.cloudflare.com/ajax/libs/selectize.js/0.8.5/css/selectize.default.css'>
|
||||
|
||||
<configure-form-directive myform="myform" user="user">
|
||||
</configure-form-directive>
|
|
@ -1,106 +0,0 @@
|
|||
<!-- Settings -->
|
||||
<div class="row">
|
||||
<div class="col-sm-offset-2 col-sm-10">
|
||||
<div class="row field">
|
||||
<div class="field-title col-sm-12">
|
||||
<h4>{{ 'FORM_NAME' | translate }}</h4>
|
||||
</div>
|
||||
|
||||
<div class="col-sm-12">
|
||||
<input class=""
|
||||
type="text"
|
||||
ng-model="myform.title"
|
||||
value="{{myform.title}}"
|
||||
style="width: 100%;"
|
||||
ng-minlength="4"
|
||||
ng-pattern="/^[a-zA-Z0-9 \-.]*$/">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row field">
|
||||
<div class="col-sm-4 field-title"><h4>{{ 'LANGUAGE' | translate }}</h4></div>
|
||||
<div class="col-sm-8 field-input">
|
||||
<ui-select ng-model="myform.language" search-enabled="false" theme="selectize">
|
||||
<ui-select-match>
|
||||
{{ langCodeToWord[$select.selected] }}
|
||||
</ui-select-match>
|
||||
<ui-select-choices repeat="language in languages">
|
||||
<span ng-bind-html="langCodeToWord[language] | highlight: $select.search">
|
||||
</span>
|
||||
</ui-select-choices>
|
||||
</select>
|
||||
<span class="required-error" ng-show="field.required && !field.fieldValue">* {{ 'REQUIRED_FIELD' | translate }}</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row field">
|
||||
<div class="field-title col-sm-8">
|
||||
<h4>{{ 'FORM_STATUS' | translate }}</h4>
|
||||
</div>
|
||||
|
||||
<div class="field-input col-sm-4 text-right">
|
||||
<input class="toggle-switch" type="checkbox" name="my-checkbox"
|
||||
bs-switch ng-model="myform.isLive"
|
||||
switch-on-text="{{ 'PUBLIC' | translate }}"
|
||||
switch-off-text="{{ 'PRIVATE' | translate }}"
|
||||
switch-on-color="success"
|
||||
switch-off-color="danger">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row field">
|
||||
<div class="field-title col-sm-12">
|
||||
<h4>{{ 'GA_TRACKING_CODE' | translate }}</h4>
|
||||
</div>
|
||||
|
||||
<div class="col-sm-12">
|
||||
<input class=""
|
||||
type="text"
|
||||
ng-model="myform.analytics.gaCode"
|
||||
value="{{myform.analytics.gaCode}}"
|
||||
style="width: 100%;"
|
||||
ng-minlength="4"
|
||||
placeholder="UA-XXXXX-Y"
|
||||
ng-pattern="/\bUA-\d{4,10}-\d{1,4}\b/">
|
||||
</div>
|
||||
</div>
|
||||
<div class="row field">
|
||||
<div class="field-title col-sm-8">
|
||||
<h4>{{ 'DISPLAY_FOOTER' | translate }}</h4>
|
||||
</div>
|
||||
|
||||
<div class="field-input col-sm-4 text-right">
|
||||
<input class="toggle-switch" type="checkbox"
|
||||
bs-switch ng-model="myform.hideFooter"
|
||||
switch-on-text="{{ 'ON' | translate }}"
|
||||
switch-off-text="{{ 'OFF' | translate }}">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row field">
|
||||
<div class="field-title col-sm-8">
|
||||
<h4>{{ 'DISPLAY_START_PAGE' | translate }}</h4>
|
||||
</div>
|
||||
|
||||
<div class="field-input col-sm-4 text-right">
|
||||
<input class="toggle-switch" type="checkbox"
|
||||
bs-switch ng-model="myform.startPage.showStart"
|
||||
switch-on-text="{{ 'ON' | translate }}"
|
||||
switch-off-text="{{ 'OFF' | translate }}">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row field">
|
||||
<div class="field-title col-sm-8">
|
||||
<h4>{{ 'DISPLAY_END_PAGE' | translate }}</h4>
|
||||
</div>
|
||||
|
||||
<div class="field-input col-sm-4 text-right">
|
||||
<input class="toggle-switch" type="checkbox"
|
||||
bs-switch ng-model="myform.endPage.showEnd"
|
||||
switch-on-text="{{ 'ON' | translate }}"
|
||||
switch-off-text="{{ 'OFF' | translate }}">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
|
@ -1,81 +0,0 @@
|
|||
<div class="row">
|
||||
<div class="col-sm-offset-2 col-sm-10">
|
||||
<div class="row field">
|
||||
<div class="notification-row">
|
||||
<i class="status-light status-light-on fa fa-circle" ng-if="myform.respondentNotifications.enabled"></i>
|
||||
<i class="status-light status-light-off fa fa-circle" ng-if="!myform.respondentNotifications.enabled"></i>
|
||||
</div>
|
||||
<div class="notification-row">
|
||||
<h5>{{ 'ENABLE_RESPONDENT_NOTIFICATIONS' | translate }}</h5>
|
||||
</div>
|
||||
|
||||
<div class="notification-row">
|
||||
<input class="toggle-switch notification-toggle" type="checkbox" switch-size="small"
|
||||
bs-switch ng-model="myform.respondentNotifications.enabled"
|
||||
switch-on-text="{{ 'ON' | translate }}"
|
||||
switch-off-text="{{ 'OFF' | translate }}">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row field" ng-if="formHasEmailField">
|
||||
<div class="field-title col-sm-12">
|
||||
<h5>{{ 'SEND_NOTIFICATION_TO' | translate }}:</h5>
|
||||
</div>
|
||||
|
||||
<div class="col-sm-12 field-input">
|
||||
<ui-select ng-model="myform.respondentNotifications.toField" theme="selectize">
|
||||
<ui-select-match placeholder="{{ 'OPTION_PLACEHOLDER' | translate }}">
|
||||
{{$select.selected.title}}
|
||||
</ui-select-match>
|
||||
<ui-select-choices repeat="field.globalId as field in emailFields | filter: { title: $select.search }">
|
||||
<span ng-bind-html="field.title | highlight: $select.search">
|
||||
</span>
|
||||
</ui-select-choices>
|
||||
</ui-select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row field" ng-if="!formHasEmailField">
|
||||
<strong>
|
||||
{{ 'NO_EMAIL_FIELD_WARNING' | translate }}
|
||||
</strong>
|
||||
</div>
|
||||
|
||||
<div class="row field">
|
||||
<div class="field-title col-sm-12">
|
||||
<h5>{{ 'REPLY_TO' | translate }}:</h5>
|
||||
</div>
|
||||
|
||||
<div class="col-sm-12 field-input">
|
||||
<input class="form-control"
|
||||
type="text"
|
||||
ng-model="myform.respondentNotifications.replyEmail"
|
||||
placeholder="noreply@tellform.com">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row field">
|
||||
<div class="field-title col-sm-12">
|
||||
<h5>{{ 'EMAIL_SUBJECT' | translate }}:</h5>
|
||||
</div>
|
||||
<div class="col-sm-12 field-input">
|
||||
<text-angular class="email-subject" ng-model="myform.respondentNotifications.subject" ta-toolbar="[['insertField']]" ta-default-wrap="n" ta-unsafe-sanitizer="true">
|
||||
</text-angular>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row field">
|
||||
<div class="field-title col-sm-12">
|
||||
<h5>{{ 'EMAIL_MESSAGE' | translate }}</h5>
|
||||
</div>
|
||||
|
||||
<div class="col-sm-12 field-input">
|
||||
<text-angular class="email-subject" ng-model="myform.respondentNotifications.htmlTemplate"
|
||||
ta-toolbar="[['bold','italics', 'insertField']]"
|
||||
ta-unsafe-sanitizer="true">
|
||||
</text-angular>
|
||||
<div ng-bind="myform.respondentNotifications.htmlTemplate"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
|
@ -1,74 +0,0 @@
|
|||
<div class="row">
|
||||
<div class="col-sm-offset-2 col-sm-10">
|
||||
|
||||
<div class="row field">
|
||||
<div class='notification-row'>
|
||||
<i class="status-light status-light-on fa fa-circle" ng-if="myform.selfNotifications.enabled"></i>
|
||||
<i class="status-light status-light-off fa fa-circle" ng-if="!myform.selfNotifications.enabled"></i>
|
||||
</div>
|
||||
|
||||
<div class='notification-row'>
|
||||
<h5>{{ 'ENABLE_SELF_NOTIFICATIONS' | translate }}</h5>
|
||||
</div>
|
||||
|
||||
<div class='notification-row'>
|
||||
<input class="toggle-switch notification-toggle" type="checkbox" switch-size="small"
|
||||
bs-switch ng-model="myform.selfNotifications.enabled"
|
||||
switch-on-text="{{ 'ON' | translate }}"
|
||||
switch-off-text="{{ 'OFF' | translate }}">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row field">
|
||||
<div class="field-title col-sm-12">
|
||||
<h5>{{ 'SEND_NOTIFICATION_TO' | translate }}</h5>
|
||||
</div>
|
||||
|
||||
<div class="col-sm-12 field-input">
|
||||
<input class="form-control"
|
||||
type="text"
|
||||
ng-model="myform.selfNotifications.toEmails"
|
||||
placeholder="email@domain.com,email2@domain2.com,etc">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row field" ng-if="formHasEmailField">
|
||||
<div class="field-title col-sm-12">
|
||||
<h5>{{ 'REPLY_TO' | translate }}</h5>
|
||||
</div>
|
||||
|
||||
<div class="col-sm-12 ui-select field-input">
|
||||
<ui-select ng-model="myform.selfNotifications.fromField" theme="selectize">
|
||||
<ui-select-match placeholder="{{ 'OPTION_PLACEHOLDER' | translate }}">
|
||||
{{$select.selected.title}}
|
||||
</ui-select-match>
|
||||
<ui-select-choices repeat="field.globalId as field in emailFields | filter: { title: $select.search }">
|
||||
<span ng-bind-html="field.title | highlight: $select.search">
|
||||
</span>
|
||||
</ui-select-choices>
|
||||
</ui-select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row field">
|
||||
<div class="field-title col-sm-12">
|
||||
<h5>{{ 'EMAIL_SUBJECT' | translate }}</h5>
|
||||
</div>
|
||||
|
||||
<div class="col-sm-12 field-input">
|
||||
<text-angular class="email-subject" ng-model="myform.selfNotifications.subject" ta-toolbar="[['insertField']]"
|
||||
ta-unsafe-sanitizer="true" ta-default-wrap="n"></text-angular>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row field">
|
||||
<div class="field-title col-sm-12">
|
||||
<h5>{{ 'EMAIL_MESSAGE' | translate }}</h5>
|
||||
</div>
|
||||
|
||||
<div class="col-sm-12 field-input">
|
||||
<text-angular ng-model="myform.selfNotifications.htmlTemplate" ta-toolbar="[['bold','italics', 'insertField']]" ta-unsafe-sanitizer="true"></text-angular>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
|
@ -1 +0,0 @@
|
|||
<design-form-directive myform="myform" formurl="formURL"></design-form-directive>
|
|
@ -1 +0,0 @@
|
|||
<share-form-directive actualformurl="actualFormURL"></share-form-directive>
|
|
@ -1,13 +1,133 @@
|
|||
<div class="config-form container">
|
||||
|
||||
<!-- Settings -->
|
||||
<div class="row">
|
||||
<uib-tabset active="activePill" type="pills">
|
||||
<uib-tab ng-repeat="tab in configureTabs" active="tab.active" select="go(tab)" heading="{{tab.heading}}">
|
||||
<div ui-view></div>
|
||||
</uib-tab>
|
||||
</uib-tabset>
|
||||
</div>
|
||||
<div class="col-sm-offset-2 col-sm-4">
|
||||
<div class="row field">
|
||||
<div class="field-title col-sm-12">
|
||||
<h5>{{ 'FORM_NAME' | translate }}</h5>
|
||||
</div>
|
||||
|
||||
<div class="col-sm-12">
|
||||
<input class="form-control"
|
||||
type="text"
|
||||
ng-model="myform.title"
|
||||
value="{{myform.title}}"
|
||||
style="width: 100%;"
|
||||
ng-minlength="4"
|
||||
ng-pattern="/^[a-zA-Z0-9 \-.]*$/">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row field">
|
||||
<div class="field-title col-sm-12">
|
||||
<h5>{{ 'FORM_STATUS' | translate }}</h5>
|
||||
</div>
|
||||
|
||||
<div class="field-input col-sm-12">
|
||||
|
||||
<label style="display: inline-block;">
|
||||
<input type="radio" data-ng-value="true" ng-model="myform.isLive" ng-required="true" style="background-color:#33CC00;"/>
|
||||
<span>{{ 'PUBLIC' | translate }}</span>
|
||||
</label>
|
||||
|
||||
<label style="display: inline-block;">
|
||||
<input type="radio" data-ng-value="false" ng-model="myform.isLive" ng-required="true" />
|
||||
<span>{{ 'PRIVATE' | translate }}</span>
|
||||
</label>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row field">
|
||||
<div class="col-sm-12 field-title">{{ 'LANGUAGE' | translate }}</div>
|
||||
<div class="col-sm-12 field-input">
|
||||
<select ng-model="myform.language">
|
||||
<option ng-repeat="language in languages"
|
||||
ng-selected="language == myform.language"
|
||||
value="{{language}}">
|
||||
{{language}}
|
||||
</option>
|
||||
</select>
|
||||
<span class="required-error" ng-show="field.required && !field.fieldValue">* {{ 'REQUIRED_FIELD' | translate }}</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-sm-4">
|
||||
<div class="row field">
|
||||
<div class="field-title col-sm-12">
|
||||
<h5>{{ 'GA_TRACKING_CODE' | translate }}</h5>
|
||||
</div>
|
||||
|
||||
<div class="col-sm-12">
|
||||
<input class="form-control"
|
||||
type="text"
|
||||
ng-model="myform.analytics.gaCode"
|
||||
value="{{myform.analytics.gaCode}}"
|
||||
style="width: 100%;"
|
||||
ng-minlength="4"
|
||||
placeholder="UA-XXXXX-Y"
|
||||
ng-pattern="/\bUA-\d{4,10}-\d{1,4}\b/">
|
||||
</div>
|
||||
</div>
|
||||
<div class="row field">
|
||||
<div class="field-title col-sm-12">
|
||||
<h5>{{ 'DISPLAY_FOOTER' | translate }}</h5>
|
||||
</div>
|
||||
|
||||
<div class="field-input col-sm-12">
|
||||
<label style="display: inline-block;">
|
||||
<input type="radio" data-ng-value="false" ng-model="myform.hideFooter" ng-required="true" />
|
||||
<span>{{ 'YES' | translate }}</span>
|
||||
</label>
|
||||
|
||||
<label style="display: inline-block;">
|
||||
<input type="radio" data-ng-value="true" ng-model="myform.hideFooter" ng-required="true" />
|
||||
<span>{{ 'NO' | translate }}</span>
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row field">
|
||||
<div class="field-title col-sm-12">
|
||||
<h5>{{ 'DISPLAY_START_PAGE' | translate }}</h5>
|
||||
</div>
|
||||
|
||||
<div class="field-input col-sm-12">
|
||||
|
||||
<label style="display: inline-block;">
|
||||
<input type="radio" data-ng-value="true" ng-model="myform.startPage.showStart" ng-required="true" style="background-color:#33CC00;"/>
|
||||
<span>{{ 'YES' | translate }}</span>
|
||||
</label>
|
||||
|
||||
<label style="display: inline-block;">
|
||||
<input type="radio" data-ng-value="false" ng-model="myform.startPage.showStart" ng-required="true" />
|
||||
<span>{{ 'NO' | translate }}</span>
|
||||
</label>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row field">
|
||||
<div class="field-title col-sm-12">
|
||||
<h5>{{ 'DISPLAY_END_PAGE' | translate }}</h5>
|
||||
</div>
|
||||
|
||||
<div class="field-input col-sm-12">
|
||||
|
||||
<label style="display: inline-block;">
|
||||
<input type="radio" data-ng-value="true" ng-model="myform.endPage.showEnd" ng-required="true" style="background-color:#33CC00;"/>
|
||||
<span>{{ 'YES' | translate }}</span>
|
||||
</label>
|
||||
|
||||
<label style="display: inline-block;">
|
||||
<input type="radio" data-ng-value="false" ng-model="myform.endPage.showEnd" ng-required="true" />
|
||||
<span>{{ 'NO' | translate }}</span>
|
||||
</label>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-sm-offset-4 col-sm-2">
|
||||
<button class="btn btn-signup btn-rounded" type="button" ng-click="update(false, myform, false, false, null)"><i class="icon-arrow-left icon-white"></i>{{ 'SAVE_CHANGES' | translate }}</button>
|
||||
|
|
|
@ -1,76 +0,0 @@
|
|||
<div class="config-form design container">
|
||||
<div class="row">
|
||||
<div class="col-sm-4 col-xs-12">
|
||||
<div class="row field">
|
||||
<div class="field-title col-sm-5">
|
||||
<h5>{{ 'BACKGROUND_COLOR' | translate }}</h5>
|
||||
</div>
|
||||
<div class="field-input col-sm-6">
|
||||
<input class="form-control" colorpicker="hex" type="text"
|
||||
ng-model="myform.design.colors.backgroundColor"
|
||||
ng-pattern="/^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$/"
|
||||
ng-style="{ 'background-color': myform.design.colors.backgroundColor }"/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row field">
|
||||
<div class="field-title col-sm-5">
|
||||
<h5>{{ 'QUESTION_TEXT_COLOR' | translate }}</h5>
|
||||
</div>
|
||||
|
||||
<div class="field-input col-sm-6">
|
||||
<input class="form-control" colorpicker="hex" type="text" ng-model="myform.design.colors.questionColor" ng-pattern="/^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$/"ng-style="{ 'background-color': myform.design.colors.questionColor }"/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row field">
|
||||
<div class="field-title col-sm-5">
|
||||
<h5>{{ 'ANSWER_TEXT_COLOR' | translate }}</h5>
|
||||
</div>
|
||||
|
||||
<div class="field-input col-sm-6">
|
||||
<input class="form-control" colorpicker="hex" type="text" ng-model="myform.design.colors.answerColor" ng-pattern="/^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$/" ng-style="{ 'background-color': myform.design.colors.answerColor }"/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row field">
|
||||
<div class="field-title col-sm-5">
|
||||
<h5>{{ 'BTN_BACKGROUND_COLOR' | translate }}</h5>
|
||||
</div>
|
||||
|
||||
<div class="field-input col-sm-6">
|
||||
<input class="form-control" colorpicker="hex" type="text"
|
||||
ng-model="myform.design.colors.buttonColor"
|
||||
ng-pattern="/^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$/"
|
||||
ng-style="{ 'background-color': myform.design.colors.buttonColor }"/>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row field">
|
||||
<div class="field-title col-sm-5">
|
||||
<h5>{{ 'BTN_TEXT_COLOR' | translate }}</h5>
|
||||
</div>
|
||||
|
||||
<div class="field-input col-sm-6">
|
||||
<input class="form-control" colorpicker="hex" type="text"
|
||||
ng-model="myform.design.colors.buttonTextColor"
|
||||
ng-pattern="/^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$/"
|
||||
ng-style="{ 'background-color': myform.design.colors.buttonTextColor }"/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-sm-8 hidden-xs">
|
||||
<div class="public-form" ng-style="{ 'background-color': myform.design.colors.backgroundColor }">
|
||||
<iframe id="iframe" ng-if="!!formurl" ng-src="{{formurl | trustSrc}}" style="border: none; box-shadow: 0px 0px 10px 0px grey; overflow: hidden; height: 400px; width: 90%; position: absolute;"></iframe>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-sm-offset-4 col-sm-2">
|
||||
<button class="btn btn-signup btn-rounded" type="button" ng-click="updateDesign(false, myform, false, false)"><i class="icon-arrow-left icon-white"></i>{{ 'SAVE_CHANGES' | translate }}</button>
|
||||
</div>
|
||||
<div class="col-sm-1">
|
||||
<button class="btn btn-secondary btn-rounded" type="button" ng-click="resetForm()"><i class="icon-eye-open icon-white"></i>{{ 'CANCEL' | translate }}</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
|
@ -1,5 +1,296 @@
|
|||
<form class="row" name="editForm" >
|
||||
|
||||
<!-- Edit EndPage Modal Dialog Template -->
|
||||
<script type="text/ng-template" id="editEndPageModal.html" class="edit-endpage-modal">
|
||||
<div class="modal-body">
|
||||
<div class="row">
|
||||
<div class="edit-panel col-md-6 col-xs-12 col-sm-12">
|
||||
<div class="row modal-header">
|
||||
<h2 class="modal-title hidden-md hidden-lg">{{ 'EDIT_END_PAGE' | translate }}</h2>
|
||||
<h3 class="modal-title hidden-xs hidden-sm">{{ 'EDIT_END_PAGE' | translate }}</h3>
|
||||
</div>
|
||||
|
||||
<div class="row question">
|
||||
<div class="col-md-4 col-sm-12">{{ 'TITLE' | translate }}:</div>
|
||||
<div class="col-md-8 col-sm-12">
|
||||
<input class="form-control" type="text"
|
||||
ng-model="myform.endPage.title" required>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row"><br></div>
|
||||
|
||||
<div class="row question">
|
||||
<div class="col-md-4 col-sm-12">{{ 'PARAGRAPH' | translate }}:</div>
|
||||
<div class="col-md-8 col-sm-12">
|
||||
<textarea class="form-control" type="text"
|
||||
ng-model="myform.endPage.paragraph"></textarea>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row"><br></div>
|
||||
|
||||
<div class="row question">
|
||||
<div class="col-md-4 col-sm-12">{{ 'BTN_TEXT' | translate }}:</div>
|
||||
<div class="col-md-8 col-sm-12">
|
||||
<input class="form-control" type="text"
|
||||
ng-model="myform.endPage.buttonText" required>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row"><br></div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-4 col-xs-12 field-input">{{ 'SHOW_BUTTONS' | translate }}</div>
|
||||
<div class="col-md-8 col-xs-12 field-input">
|
||||
<label class="switch-light switch-holo" onclick="">
|
||||
<input type="checkbox" ng-model="showButtons">
|
||||
<span>
|
||||
<span> {{ 'OFF' | translate }}</span>
|
||||
<span> {{ 'ON' | translate }}</span>
|
||||
<a></a>
|
||||
</span>
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row options buttons" ng-if="showButtons">
|
||||
<div class="col-md-3 col-xs-12">{{ 'BUTTONS' | translate }}:</div>
|
||||
<div class="col-md-9 col-xs-12">
|
||||
<div ng-repeat="button in myform.endPage.buttons track by button._id" class="row" style="padding-bottom:1em;">
|
||||
|
||||
<div class="col-xs-5">
|
||||
<span>{{ 'BUTTON_TEXT' | translate }}</span>
|
||||
<input type="text"
|
||||
name="{{button.text}}_buttonText_startPage"
|
||||
ng-model="button.text"
|
||||
value="{{button.text}}"
|
||||
placeholder="{{ 'BUTTON_TEXT' | translate }}">
|
||||
</div>
|
||||
|
||||
|
||||
<div class="col-xs-5">
|
||||
<span>{{ 'BUTTON_LINK' | translate }}</span>
|
||||
<input type="text"
|
||||
name="{{button.url}}_url_startPage"
|
||||
ng-model="button.url"
|
||||
value="{{button.url}}"
|
||||
placeholder="http://aeouaou.com/aoeuoa">
|
||||
</div>
|
||||
|
||||
<div class="col-xs-2">
|
||||
<a class="btn btn-danger btn-mini right" type="button" ng-click="deleteButton(button)">
|
||||
<i class="fa fa-trash-o"></i>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row"><br></div>
|
||||
<div class="row">
|
||||
<button class="btn btn-primary btn-small col-md-offset-6 col-md-6 col-sm-4 col-sm-offset-8 col-xs-4 col-xs-offset-8" type="button" ng-click="addButton()">
|
||||
<i class="icon-plus icon-white"></i> {{ 'ADD_BUTTON' | translate }}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="modal-footer row">
|
||||
<button type="submit" ng-click="saveEndPage()" class="btn btn-signup btn-rounded">
|
||||
{{ 'SAVE_START_PAGE' | translate }}
|
||||
</button>
|
||||
|
||||
<button ng-click="cancel()" class="btn btn-secondary btn-rounded">
|
||||
{{ 'CANCEL' | translate }}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="preview-field-panel col-md-6 hidden-sm hidden-xs">
|
||||
<form class="public-form">
|
||||
|
||||
<div class="row">
|
||||
<div class="col-xs-12 text-center" style="overflow-wrap: break-word;">
|
||||
<h1 style="font-weight: 400; font-size: 25px;">
|
||||
{{myform.endPage.title}}
|
||||
</h1>
|
||||
</div>
|
||||
<div class="col-xs-10 col-xs-offset-1 text-center" style="overflow-wrap: break-word;">
|
||||
<p style="color: grey; font-weight: 100; font-size: 16px;">
|
||||
{{myform.endPage.paragraph}}
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row form-actions text-center" style="padding: 5px 25px 5px 25px;">
|
||||
<button ng-click="reloadForm()" class="btn" type="button"
|
||||
ng-style="{'background-color':myform.design.colors.buttonColor, 'color':myform.design.colors.buttonTextColor}">
|
||||
<span style="font-size: 1.6em;">
|
||||
{{myform.endPage.buttonText}}
|
||||
</span>
|
||||
</button>
|
||||
</div>
|
||||
<div class="row form-actions" style="padding-bottom:3em; padding-left: 1em; padding-right: 1em;">
|
||||
<p ng-repeat="button in myform.endPage.buttons" class="text-center" style="display:inline;">
|
||||
<button class="btn" style="background-color:rgb(156, 226, 235)" type="button" ng-style="{'background-color':button.bgColor, 'color':button.color}">
|
||||
<a href="{{button.url}}"
|
||||
style="font-size: 1.6em; text-decoration: none;"
|
||||
ng-style="{'color':button.color}">
|
||||
{{button.text}}
|
||||
</a>
|
||||
</button>
|
||||
</p>
|
||||
</div>
|
||||
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</script>
|
||||
|
||||
<!-- Edit StartPage Modal Dialog Template -->
|
||||
<script type="text/ng-template" id="editStartPageModal.html" class="edit-startpage-modal">
|
||||
<div class="modal-body">
|
||||
<div class="row">
|
||||
<div class="edit-panel col-md-6 col-xs-12 col-sm-12">
|
||||
<div class="row modal-header">
|
||||
<h2 class="modal-title hidden-md hidden-lg">{{ 'EDIT_START_PAGE' | translate }}</h2>
|
||||
<h3 class="modal-title hidden-xs hidden-sm">{{ 'EDIT_START_PAGE' | translate }}</h3>
|
||||
</div>
|
||||
|
||||
<div class="row question">
|
||||
<div class="col-md-4 col-sm-12">{{ 'INTRO_TITLE' | translate }}:</div>
|
||||
<div class="col-md-8 col-sm-12">
|
||||
<input class="form-control" type="text"
|
||||
ng-model="myform.startPage.introTitle"
|
||||
name="introTitleStartPage" required>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row"><br></div>
|
||||
|
||||
<div class="row question">
|
||||
<div class="col-md-4 col-sm-12">{{ 'INTRO_PARAGRAPH' | translate }}:</div>
|
||||
<div class="col-md-8 col-sm-12">
|
||||
<textarea class="form-control" type="text"
|
||||
ng-model="myform.startPage.introParagraph"
|
||||
name="introParagraphStartPage"></textarea>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row"><br></div>
|
||||
|
||||
<div class="row question">
|
||||
<div class="col-md-4 col-sm-12">{{ 'INTRO_BTN' | translate }}:</div>
|
||||
<div class="col-md-8 col-sm-12">
|
||||
<input class="form-control" type="text"
|
||||
ng-model="myform.startPage.introButtonText"
|
||||
name="introButtonText" required>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row"><br></div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-4 col-xs-12 field-input">{{ 'SHOW_BUTTONS' | translate }}</div>
|
||||
<div class="col-md-8 col-xs-12 field-input">
|
||||
<label class="switch-light switch-holo" onclick="">
|
||||
<input type="checkbox" ng-model="showButtons">
|
||||
<span>
|
||||
<span> {{ 'OFF' | translate }}</span>
|
||||
<span> {{ 'ON' | translate }}</span>
|
||||
<a></a>
|
||||
</span>
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row options buttons" ng-if="showButtons">
|
||||
<div class="col-md-3 col-xs-12">{{ 'BUTTONS' | translate }}:</div>
|
||||
<div class="col-md-9 col-xs-12">
|
||||
<div ng-repeat="button in myform.startPage.buttons track by button._id" class="row" style="padding-bottom:1em;">
|
||||
|
||||
<div class="col-xs-5">
|
||||
<span>{{ 'BUTTON_TEXT' | translate }}</span>
|
||||
<input type="text"
|
||||
name="{{button.text}}_buttonText_startPage"
|
||||
ng-model="button.text"
|
||||
value="{{button.text}}"
|
||||
placeholder="{{ 'BUTTON_TEXT' | translate }}">
|
||||
</div>
|
||||
|
||||
|
||||
<div class="col-xs-5">
|
||||
<span>{{ 'BUTTON_LINK' | translate }}</span>
|
||||
<input type="text"
|
||||
name="{{button.url}}_url_startPage"
|
||||
ng-model="button.url"
|
||||
value="{{button.url}}"
|
||||
placeholder="http://aeouaou.com/aoeuoa">
|
||||
</div>
|
||||
|
||||
<div class="col-xs-2">
|
||||
<a class="btn btn-danger btn-mini right" type="button" ng-click="deleteButton(button)">
|
||||
<i class="fa fa-trash-o"></i>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row"><br></div>
|
||||
<div class="row">
|
||||
<button class="btn btn-primary btn-small col-md-offset-6 col-md-6 col-sm-4 col-sm-offset-8 col-xs-4 col-xs-offset-8" type="button" ng-click="addButton()">
|
||||
<i class="icon-plus icon-white"></i> {{ 'ADD_BUTTON' | translate }}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="modal-footer row">
|
||||
<button type="submit" ng-click="saveStartPage()" class="btn btn-signup btn-rounded">
|
||||
{{ 'SAVE_START_PAGE' | translate }}
|
||||
</button>
|
||||
|
||||
<button ng-click="cancel()" class="btn btn-secondary btn-rounded">
|
||||
{{ 'CANCEL' | translate }}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="preview-field-panel col-md-6 hidden-sm hidden-xs">
|
||||
<form class="public-form">
|
||||
|
||||
<div class="field row">
|
||||
<div class="col-xs-12 text-center" style="overflow-wrap: break-word;">
|
||||
<h1>{{myform.startPage.introTitle}}</h1>
|
||||
</div>
|
||||
<div class="col-xs-10 col-xs-offset-1 text-left" style="overflow-wrap: break-word;">
|
||||
<p style="color:#ddd;">{{myform.startPage.introParagraph}}</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row form-actions" style="padding-bottom:3em; padding-left: 1em; padding-right: 1em;">
|
||||
<p ng-repeat="button in myform.startPage.buttons" class="text-center" style="display:inline;">
|
||||
<button class="btn btn-info" type="button" ng-style="{'background-color':button.bgColor, 'color':button.color}">
|
||||
<a href="{{button.url}}" style="font-size: 1.6em; text-decoration: none; color: inherit;" >
|
||||
{{button.text}}
|
||||
</a>
|
||||
</button>
|
||||
</p>
|
||||
</div>
|
||||
<div class="row form-actions">
|
||||
<button class="btn btn-info btn btn-info col-md-6 col-md-offset-3 col-lg-6 col-lg-offset-3" type="button">
|
||||
<span style="color:white; font-size: 1.6em; text-decoration: none;">
|
||||
{{myform.startPage.introButtonText}}
|
||||
</span>
|
||||
</button>
|
||||
</div>
|
||||
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</script>
|
||||
|
||||
<!-- Edit Field Modal Dialog Template -->
|
||||
<script type="text/ng-template" id="editFieldModal.html" class="edit-field-modal">
|
||||
<div class="modal-body">
|
||||
|
@ -17,22 +308,33 @@
|
|||
|
||||
<div class="row"><br></div>
|
||||
|
||||
<div class="row description question" ng-hide="showRatingOptions(field)">
|
||||
<div class="row description" ng-hide="showRatingOptions()">
|
||||
<div class="col-md-12 bold">{{ 'QUESTION_DESCRIPTION' | translate }}</div>
|
||||
<div class="col-md-12">
|
||||
<textarea type="text" class="form-control" ng-model="field.description" name="description{{field._id}}"value="{{field.description}}"></textarea>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row" ng-if="showListOptions()"><br></div>
|
||||
<div class="row options question" ng-if="showListOptions()">
|
||||
<div class="row" ng-show="showAddOptions()"><br></div>
|
||||
<div class="row options" ng-if="showAddOptions()">
|
||||
<div class="col-md-4 col-xs-12">{{ 'OPTIONS' | translate }}</div>
|
||||
<div class="col-md-8 col-xs-12">
|
||||
<textarea type="text" class="form-control" ng-model="options.fieldOptionsString" ng-value="fieldOptionsString" name="options{{field._id}}" placeholder="{{ 'ADD_OPTIONS_PLACEHOLDER' | translate }}" required="true"></textarea>
|
||||
<div ng-repeat="option in field.fieldOptions track by option.option_id" class="row">
|
||||
<input type="text" name="{{option.option_value}}{{field._id}}" ng-model="option.option_value" class="col-xs-5">
|
||||
|
||||
<a class="btn btn-danger btn-mini right" type="button" ng-click="deleteOption(option)" class="col-xs-3">
|
||||
<i class="fa fa-trash-o"></i>
|
||||
</a>
|
||||
</div>
|
||||
<div class="row">
|
||||
<button class="btn btn-primary btn-small col-md-offset-0 col-md-6 col-sm-4 col-sm-offset-4 col-xs-6 col-xs-offset-6" type="button" ng-click="addOption()">
|
||||
<i class="icon-plus icon-white"></i> {{ 'ADD_OPTION' | translate }}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row" ng-if="showRatingOptions()"><br></div>
|
||||
<div class="row" ng-show="showRatingOptions()"><br></div>
|
||||
<div class="row" ng-if="showRatingOptions()">
|
||||
<div class="col-md-9 col-sm-9">{{ 'NUM_OF_STEPS' | translate }}</div>
|
||||
<div class="col-md-3 col-sm-3">
|
||||
|
@ -40,17 +342,17 @@
|
|||
min="1" max="10"
|
||||
ng-model="field.ratingOptions.steps"
|
||||
name="ratingOptions_steps{{field._id}}"
|
||||
ng-value="field.ratingOptions.steps"
|
||||
ng-value="{{field.ratingOptions.steps}}"
|
||||
required>
|
||||
</div>
|
||||
<br>
|
||||
<div class="col-md-5 col-sm-9">{{ 'SHAPE' | translate }}:</div>
|
||||
<div class="col-md-7 col-sm-3">
|
||||
<select style="width:100%" ng-model="field.ratingOptions.shape"
|
||||
ng-value="field.ratingOptions.steps"
|
||||
value="{{field.ratingOptions.steps}}"
|
||||
name="ratingOptions_shape{{field._id}}" required>
|
||||
<option ng-repeat="shapeType in validShapes"
|
||||
ng-value="shapeType">
|
||||
value="{{shapeType}}">
|
||||
{{select2FA[shapeType]}}
|
||||
</option>
|
||||
</select>
|
||||
|
@ -187,298 +489,6 @@
|
|||
</div>
|
||||
</script>
|
||||
|
||||
|
||||
<!-- Edit EndPage Modal Dialog Template -->
|
||||
<script type="text/ng-template" id="editEndPageModal.html" class="edit-endpage-modal">
|
||||
<div class="modal-body">
|
||||
<div class="row">
|
||||
<div class="edit-panel col-md-6 col-xs-12 col-sm-12">
|
||||
<div class="row modal-header">
|
||||
<h2 class="modal-title hidden-md hidden-lg">{{ 'EDIT_END_PAGE' | translate }}</h2>
|
||||
<h3 class="modal-title hidden-xs hidden-sm">{{ 'EDIT_END_PAGE' | translate }}</h3>
|
||||
</div>
|
||||
|
||||
<div class="row question">
|
||||
<div class="col-md-4 col-sm-12">{{ 'TITLE' | translate }}:</div>
|
||||
<div class="col-md-8 col-sm-12">
|
||||
<input class="form-control" type="text"
|
||||
ng-model="myform.endPage.title" required>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row"><br></div>
|
||||
|
||||
<div class="row question">
|
||||
<div class="col-md-4 col-sm-12">{{ 'PARAGRAPH' | translate }}:</div>
|
||||
<div class="col-md-8 col-sm-12">
|
||||
<textarea class="form-control" type="text"
|
||||
ng-model="myform.endPage.paragraph"></textarea>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row"><br></div>
|
||||
|
||||
<div class="row question">
|
||||
<div class="col-md-4 col-sm-12">{{ 'BTN_TEXT' | translate }}:</div>
|
||||
<div class="col-md-8 col-sm-12">
|
||||
<input class="form-control" type="text"
|
||||
ng-model="myform.endPage.buttonText" required>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row"><br></div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-4 col-xs-12 field-input">{{ 'SHOW_BUTTONS' | translate }}</div>
|
||||
<div class="col-md-8 col-xs-12 field-input">
|
||||
<label class="switch-light switch-holo" onclick="">
|
||||
<input type="checkbox" ng-model="showButtons">
|
||||
<span>
|
||||
<span> {{ 'OFF' | translate }}</span>
|
||||
<span> {{ 'ON' | translate }}</span>
|
||||
<a></a>
|
||||
</span>
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row options buttons" ng-if="showButtons">
|
||||
<div class="col-md-3 col-xs-12">{{ 'BUTTONS' | translate }}:</div>
|
||||
<div class="col-md-9 col-xs-12">
|
||||
<div ng-repeat="button in myform.endPage.buttons track by button._id" class="row" style="padding-bottom:1em;">
|
||||
|
||||
<div class="col-xs-5">
|
||||
<span>{{ 'BUTTON_TEXT' | translate }}</span>
|
||||
<input type="text"
|
||||
name="{{button.text}}_buttonText_startPage"
|
||||
ng-model="button.text"
|
||||
value="{{button.text}}"
|
||||
placeholder="{{ 'BUTTON_TEXT' | translate }}">
|
||||
</div>
|
||||
|
||||
|
||||
<div class="col-xs-5">
|
||||
<span>{{ 'BUTTON_LINK' | translate }}</span>
|
||||
<input type="text"
|
||||
name="{{button.url}}_url_startPage"
|
||||
ng-model="button.url"
|
||||
value="{{button.url}}"
|
||||
placeholder="http://aeouaou.com/aoeuoa">
|
||||
</div>
|
||||
|
||||
<div class="col-xs-2">
|
||||
<a class="btn btn-danger btn-mini right" type="button" ng-click="deleteButton(button)">
|
||||
<i class="fa fa-trash-o"></i>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row"><br></div>
|
||||
<div class="row">
|
||||
<button class="btn btn-primary btn-small col-md-offset-6 col-md-6 col-sm-4 col-sm-offset-8 col-xs-4 col-xs-offset-8" type="button" ng-click="addButton()">
|
||||
<i class="icon-plus icon-white"></i> {{ 'ADD_BUTTON' | translate }}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="modal-footer row">
|
||||
<button type="submit" ng-click="saveEndPage()" class="btn btn-signup btn-rounded">
|
||||
{{ 'SAVE_START_PAGE' | translate }}
|
||||
</button>
|
||||
|
||||
<button ng-click="cancel()" class="btn btn-secondary btn-rounded">
|
||||
{{ 'CANCEL' | translate }}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="preview-field-panel col-md-6 hidden-sm hidden-xs">
|
||||
<form class="public-form">
|
||||
|
||||
<div class="row">
|
||||
<div class="col-xs-12 text-center" style="overflow-wrap: break-word;">
|
||||
<h1 style="font-weight: 400; font-size: 25px;">
|
||||
{{myform.endPage.title}}
|
||||
</h1>
|
||||
</div>
|
||||
<div class="col-xs-10 col-xs-offset-1 text-center" style="overflow-wrap: break-word;">
|
||||
<p style="color: grey; font-weight: 100; font-size: 16px;">
|
||||
{{myform.endPage.paragraph}}
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row form-actions text-center" style="padding: 5px 25px 5px 25px;">
|
||||
<button ng-click="reloadForm()" class="btn" type="button"
|
||||
ng-style="{'background-color':myform.design.colors.buttonColor, 'color':myform.design.colors.buttonTextColor}">
|
||||
<span style="font-size: 1.6em;">
|
||||
{{myform.endPage.buttonText}}
|
||||
</span>
|
||||
</button>
|
||||
</div>
|
||||
<div class="row form-actions" style="padding-bottom:3em; padding-left: 1em; padding-right: 1em;">
|
||||
<p ng-repeat="button in myform.endPage.buttons" class="text-center" style="display:inline;">
|
||||
<button class="btn" style="background-color:rgb(156, 226, 235)" type="button" ng-style="{'background-color':button.bgColor, 'color':button.color}">
|
||||
<a href="{{button.url}}"
|
||||
style="font-size: 1.6em; text-decoration: none;"
|
||||
ng-style="{'color':button.color}">
|
||||
{{button.text}}
|
||||
</a>
|
||||
</button>
|
||||
</p>
|
||||
</div>
|
||||
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</script>
|
||||
|
||||
<!-- Edit StartPage Modal Dialog Template -->
|
||||
<script type="text/ng-template" id="editStartPageModal.html" class="edit-startpage-modal">
|
||||
<div class="modal-body">
|
||||
<div class="row">
|
||||
<div class="edit-panel col-md-6 col-xs-12 col-sm-12">
|
||||
<div class="row modal-header">
|
||||
<h2 class="modal-title hidden-md hidden-lg">{{ 'EDIT_START_PAGE' | translate }}</h2>
|
||||
<h3 class="modal-title hidden-xs hidden-sm">{{ 'EDIT_START_PAGE' | translate }}</h3>
|
||||
</div>
|
||||
|
||||
<div class="row question">
|
||||
<div class="col-md-4 col-sm-12">{{ 'INTRO_TITLE' | translate }}:</div>
|
||||
<div class="col-md-8 col-sm-12">
|
||||
<input class="form-control" type="text"
|
||||
ng-model="myform.startPage.introTitle"
|
||||
name="introTitleStartPage" required>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row"><br></div>
|
||||
|
||||
<div class="row question">
|
||||
<div class="col-md-4 col-sm-12">{{ 'INTRO_PARAGRAPH' | translate }}:</div>
|
||||
<div class="col-md-8 col-sm-12">
|
||||
<textarea class="form-control" type="text"
|
||||
ng-model="myform.startPage.introParagraph"
|
||||
name="introParagraphStartPage"></textarea>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row"><br></div>
|
||||
|
||||
<div class="row question">
|
||||
<div class="col-md-4 col-sm-12">{{ 'INTRO_BTN' | translate }}:</div>
|
||||
<div class="col-md-8 col-sm-12">
|
||||
<input class="form-control" type="text"
|
||||
ng-model="myform.startPage.introButtonText"
|
||||
name="introButtonText" required>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row"><br></div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-4 col-xs-12 field-input">{{ 'SHOW_BUTTONS' | translate }}</div>
|
||||
<div class="col-md-8 col-xs-12 field-input">
|
||||
<label class="switch-light switch-holo" onclick="">
|
||||
<input type="checkbox" ng-model="showButtons">
|
||||
<span>
|
||||
<span> {{ 'OFF' | translate }}</span>
|
||||
<span> {{ 'ON' | translate }}</span>
|
||||
<a></a>
|
||||
</span>
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row options buttons" ng-if="showButtons">
|
||||
<div class="col-md-3 col-xs-12">{{ 'BUTTONS' | translate }}:</div>
|
||||
<div class="col-md-9 col-xs-12">
|
||||
<div ng-repeat="button in myform.startPage.buttons track by button._id" class="row" style="padding-bottom:1em;">
|
||||
|
||||
<div class="col-xs-5">
|
||||
<span>{{ 'BUTTON_TEXT' | translate }}</span>
|
||||
<input type="text"
|
||||
name="{{button.text}}_buttonText_startPage"
|
||||
ng-model="button.text"
|
||||
value="{{button.text}}"
|
||||
placeholder="{{ 'BUTTON_TEXT' | translate }}">
|
||||
</div>
|
||||
|
||||
|
||||
<div class="col-xs-5">
|
||||
<span>{{ 'BUTTON_LINK' | translate }}</span>
|
||||
<input type="text"
|
||||
name="{{button.url}}_url_startPage"
|
||||
ng-model="button.url"
|
||||
value="{{button.url}}"
|
||||
placeholder="http://aeouaou.com/aoeuoa">
|
||||
</div>
|
||||
|
||||
<div class="col-xs-2">
|
||||
<a class="btn btn-danger btn-mini right" type="button" ng-click="deleteButton(button)">
|
||||
<i class="fa fa-trash-o"></i>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row"><br></div>
|
||||
<div class="row">
|
||||
<button class="btn btn-primary btn-small col-md-offset-6 col-md-6 col-sm-4 col-sm-offset-8 col-xs-4 col-xs-offset-8" type="button" ng-click="addButton()">
|
||||
<i class="icon-plus icon-white"></i> {{ 'ADD_BUTTON' | translate }}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="modal-footer row">
|
||||
<button type="submit" ng-click="saveStartPage()" class="btn btn-signup btn-rounded">
|
||||
{{ 'SAVE_START_PAGE' | translate }}
|
||||
</button>
|
||||
|
||||
<button ng-click="cancel()" class="btn btn-secondary btn-rounded">
|
||||
{{ 'CANCEL' | translate }}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="preview-field-panel col-md-6 hidden-sm hidden-xs">
|
||||
<form class="public-form">
|
||||
|
||||
<div class="field row">
|
||||
<div class="col-xs-12 text-center" style="overflow-wrap: break-word;">
|
||||
<h1>{{myform.startPage.introTitle}}</h1>
|
||||
</div>
|
||||
<div class="col-xs-10 col-xs-offset-1 text-left" style="overflow-wrap: break-word;">
|
||||
<p style="color:#ddd;">{{myform.startPage.introParagraph}}</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row form-actions" style="padding-bottom:3em; padding-left: 1em; padding-right: 1em;">
|
||||
<p ng-repeat="button in myform.startPage.buttons" class="text-center" style="display:inline;">
|
||||
<button class="btn btn-info" type="button" ng-style="{'background-color':button.bgColor, 'color':button.color}">
|
||||
<a href="{{button.url}}" style="font-size: 1.6em; text-decoration: none; color: inherit;" >
|
||||
{{button.text}}
|
||||
</a>
|
||||
</button>
|
||||
</p>
|
||||
</div>
|
||||
<div class="row form-actions">
|
||||
<button class="btn btn-info btn btn-info col-md-6 col-md-offset-3 col-lg-6 col-lg-offset-3" type="button">
|
||||
<span style="color:white; font-size: 1.6em; text-decoration: none;">
|
||||
{{myform.startPage.introButtonText}}
|
||||
</span>
|
||||
</button>
|
||||
</div>
|
||||
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</script>
|
||||
|
||||
<!-- Add Fields Element -->
|
||||
<div class="col-xs-2 col-sm-4 add-field">
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
<div class="submissions-table row">
|
||||
<div class="submissions-table container">
|
||||
<div class="row text-center analytics">
|
||||
<div class="col-xs-12 header-title">
|
||||
<div class="col-xs-3">
|
||||
|
|
|
@ -1,44 +0,0 @@
|
|||
<div class="config-form row">
|
||||
<div class="row">
|
||||
<div class="col-sm-12">
|
||||
<uib-tabset active="activePill" vertical="true" type="pills">
|
||||
<uib-tab index="0" heading="{{ 'SHARE_YOUR_FORM' | translate }}">
|
||||
<div class="row">
|
||||
<div class="col-sm-12">
|
||||
{{ 'TELLFORM_URL' | translate }}
|
||||
</div>
|
||||
<div class="col-sm-8 form-input">
|
||||
<span ngclipboard data-clipboard-target="#copyURL"> <input id="copyURL" ng-value="actualFormURL" class="form-control ng-pristine ng-untouched ng-valid"> </span>
|
||||
</div>
|
||||
<div class="col-sm-4">
|
||||
<button class="btn btn btn-secondary view-form-btn" ngclipboard data-clipboard-target="#copyURL">
|
||||
{{ 'COPY' | translate }} <i class="fa fa-clipboard" aria-hidden="true"></i>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</uib-tab>
|
||||
<uib-tab index="1" heading="{{ 'EMBED_YOUR_FORM' | translate }}">
|
||||
<div class="row">
|
||||
<div class="col-sm-12">
|
||||
{{ 'COPY_AND_PASTE' | translate }}
|
||||
</div>
|
||||
<div class="col-sm-8 form-input">
|
||||
<span ngclipboard data-clipboard-target="#copyEmbedded">
|
||||
<textarea id="copyEmbedded" class="form-control ng-pristine ng-untouched ng-valid" style="min-height:200px; width:100%; background-color: #FFFFCC; color: #30313F;">
|
||||
<!-- {{ 'CHANGE_WIDTH_AND_HEIGHT' | translate }} -->
|
||||
<iframe id="iframe" src="{{actualFormURL}}" style="width:100%;height:500px;"></iframe>
|
||||
<div style="font-family: Sans-Serif;font-size: 12px;color: #999;opacity: 0.5; padding-top: 5px;">{{ 'POWERED_BY' | translate }} <a href="https://www.tellform.com" style="color: #999" target="_blank">TellForm</a></div>
|
||||
</textarea>
|
||||
</span>
|
||||
</div>
|
||||
<div class="col-sm-4">
|
||||
<button class="btn btn btn-secondary view-form-btn" ngclipboard data-clipboard-target="#copyEmbedded">
|
||||
{{ 'COPY' | translate }} <i class="fa fa-clipboard" aria-hidden="true"></i>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</uib-tab>
|
||||
</uib-tabset>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
|
@ -126,6 +126,7 @@ div.form-fields {
|
|||
border: 1px solid #000;
|
||||
border: 1px solid rgba(0,0,0,.2);
|
||||
margin-right: 7px;
|
||||
margin-top: 1px;
|
||||
-webkit-border-radius: 3px;
|
||||
-moz-border-radius: 3px;
|
||||
border-radius: 3px;
|
||||
|
@ -224,13 +225,13 @@ form .row.field {
|
|||
font-size:0.8em;
|
||||
}
|
||||
|
||||
form .dropdown > .field-input input {
|
||||
form .row.field.dropdown > .field-input input {
|
||||
min-height: 34px;
|
||||
border-width: 0 0 2px 0;
|
||||
border-radius: 5px;
|
||||
}
|
||||
|
||||
form .dropdown > .field-input input:focus {
|
||||
form .row.field.dropdown > .field-input input:focus {
|
||||
border: none;
|
||||
}
|
||||
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue