Merge branch 'master' into update-readme-missing-bower-cmd
This commit is contained in:
commit
1eebdc81d1
|
@ -2,7 +2,6 @@ language: node_js
|
||||||
dist: trusty
|
dist: trusty
|
||||||
sudo: false
|
sudo: false
|
||||||
node_js:
|
node_js:
|
||||||
- "5.0.0"
|
|
||||||
- "6.11.1"
|
- "6.11.1"
|
||||||
env:
|
env:
|
||||||
- NODE_ENV=travis TRAVIS=travis CXX=g++-4.8
|
- NODE_ENV=travis TRAVIS=travis CXX=g++-4.8
|
||||||
|
|
|
@ -23,7 +23,11 @@ var getUniqueErrorMessage = function(err) {
|
||||||
exports.getErrorMessage = function(err) {
|
exports.getErrorMessage = function(err) {
|
||||||
var message = '';
|
var message = '';
|
||||||
|
|
||||||
if (err.code) {
|
if(!err) {
|
||||||
|
return '';
|
||||||
|
} else if(typeof err === 'string'){
|
||||||
|
message = err;
|
||||||
|
} else if (err.code) {
|
||||||
switch (err.code) {
|
switch (err.code) {
|
||||||
case 11000:
|
case 11000:
|
||||||
case 11001:
|
case 11001:
|
||||||
|
|
|
@ -198,6 +198,10 @@ var readForRender = exports.readForRender = function(req, res) {
|
||||||
*/
|
*/
|
||||||
exports.update = function(req, res) {
|
exports.update = function(req, res) {
|
||||||
var form = req.form;
|
var form = req.form;
|
||||||
|
var updatedForm = req.body.form;
|
||||||
|
|
||||||
|
delete updatedForm.__v;
|
||||||
|
delete updatedForm.created;
|
||||||
|
|
||||||
if (req.body.changes) {
|
if (req.body.changes) {
|
||||||
var formChanges = req.body.changes;
|
var formChanges = req.body.changes;
|
||||||
|
@ -207,8 +211,8 @@ exports.update = function(req, res) {
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
//Unless we have 'admin' privileges, updating form admin is disabled
|
//Unless we have 'admin' privileges, updating form admin is disabled
|
||||||
if(req.body.form && req.user.roles.indexOf('admin') === -1) {
|
if(updatedForm && req.user.roles.indexOf('admin') === -1) {
|
||||||
delete req.body.form.admin;
|
delete updatedForm.admin;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(form.analytics === null){
|
if(form.analytics === null){
|
||||||
|
@ -224,11 +228,12 @@ exports.update = function(req, res) {
|
||||||
delete field._id;
|
delete field._id;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
form = _.extend(form, req.body.form);
|
form = _.extend(form, updatedForm);
|
||||||
}
|
}
|
||||||
|
|
||||||
form.save(function(err, savedForm) {
|
form.save(function(err, savedForm) {
|
||||||
if (err) {
|
if (err) {
|
||||||
|
console.log(err);
|
||||||
res.status(405).send({
|
res.status(405).send({
|
||||||
message: errorHandler.getErrorMessage(err)
|
message: errorHandler.getErrorMessage(err)
|
||||||
});
|
});
|
||||||
|
|
|
@ -19,6 +19,7 @@ var config_nev = function () {
|
||||||
nev.configure({
|
nev.configure({
|
||||||
persistentUserModel: User,
|
persistentUserModel: User,
|
||||||
tempUserCollection: config.tempUserCollection,
|
tempUserCollection: config.tempUserCollection,
|
||||||
|
emailAndUsernameUnique: true,
|
||||||
expirationTime: 86400, // 24 hours
|
expirationTime: 86400, // 24 hours
|
||||||
|
|
||||||
verificationURL: config.baseUrl+'/#!/verify/${URL}',
|
verificationURL: config.baseUrl+'/#!/verify/${URL}',
|
||||||
|
@ -103,9 +104,9 @@ exports.signup = function(req, res) {
|
||||||
|
|
||||||
// Add missing user fields
|
// Add missing user fields
|
||||||
user.provider = 'local';
|
user.provider = 'local';
|
||||||
|
|
||||||
// Then save the temporary user
|
// Then save the temporary user
|
||||||
nev.createTempUser(user, function (err, existingPersistentUser, newTempUser) {
|
nev.createTempUser(user, function (err, existingPersistentUser, newTempUser) {
|
||||||
|
debugger;
|
||||||
if (err) {
|
if (err) {
|
||||||
return res.status(400).send({
|
return res.status(400).send({
|
||||||
message: errorHandler.getErrorMessage(err)
|
message: errorHandler.getErrorMessage(err)
|
||||||
|
@ -125,6 +126,7 @@ exports.signup = function(req, res) {
|
||||||
return res.status(200).send('An email has been sent to you. Please check it to verify your account.');
|
return res.status(200).send('An email has been sent to you. Please check it to verify your account.');
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
|
console.log(err);
|
||||||
return res.status(400).send({message: 'Error: User already exists!'});
|
return res.status(400).send({message: 'Error: User already exists!'});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
@ -256,8 +256,13 @@ FormSchema.virtual('analytics.fields').get(function () {
|
||||||
}
|
}
|
||||||
|
|
||||||
var totalViews = dropoffViews+continueViews;
|
var totalViews = dropoffViews+continueViews;
|
||||||
var continueRate = (continueViews/totalViews*100).toFixed(0);
|
var continueRate = 0;
|
||||||
var dropoffRate = (dropoffViews/totalViews*100).toFixed(0);
|
var dropoffRate = 0;
|
||||||
|
|
||||||
|
if(totalViews > 0){
|
||||||
|
continueRate = (continueViews/totalViews*100).toFixed(0);
|
||||||
|
dropoffRate = (dropoffViews/totalViews*100).toFixed(0);
|
||||||
|
}
|
||||||
|
|
||||||
fieldDropoffs[i] = {
|
fieldDropoffs[i] = {
|
||||||
dropoffViews: dropoffViews,
|
dropoffViews: dropoffViews,
|
||||||
|
@ -349,9 +354,6 @@ FormSchema.pre('save', function (next) {
|
||||||
old_ids = _.map(_.map(old_form_fields, 'globalId'), function(id){ return ''+id;}),
|
old_ids = _.map(_.map(old_form_fields, 'globalId'), function(id){ return ''+id;}),
|
||||||
deletedIds = getDeletedIndexes(old_ids, new_ids);
|
deletedIds = getDeletedIndexes(old_ids, new_ids);
|
||||||
|
|
||||||
console.log(deletedIds);
|
|
||||||
console.log(new_ids);
|
|
||||||
console.log(old_ids);
|
|
||||||
//Check if any form_fileds were deleted
|
//Check if any form_fileds were deleted
|
||||||
if( deletedIds.length > 0 ){
|
if( deletedIds.length > 0 ){
|
||||||
|
|
||||||
|
@ -415,9 +417,7 @@ FormSchema.pre('save', function (next) {
|
||||||
submission.form_fields = submission_form_fields;
|
submission.form_fields = submission_form_fields;
|
||||||
that.form_fields = currentform_form_fields;
|
that.form_fields = currentform_form_fields;
|
||||||
|
|
||||||
submission.save(function (saveErr) {
|
return callback(null);
|
||||||
return callback(saveErr);
|
|
||||||
});
|
|
||||||
}, function (err) {
|
}, function (err) {
|
||||||
return cb(err);
|
return cb(err);
|
||||||
});
|
});
|
||||||
|
|
|
@ -98,7 +98,10 @@
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
var user = {{ user | json | safe }};
|
var user = {{ user | json | safe }};
|
||||||
var signupDisabled = {{signupDisabled | safe}};
|
var signupDisabled = {{signupDisabled | safe}};
|
||||||
var socketPort = {{socketPort | safe}};
|
var socketPort = false;
|
||||||
|
{% if socketPort %}
|
||||||
|
socketPort = {{socketPort | safe }};
|
||||||
|
{% endif %}
|
||||||
var socketUrl = "{{socketUrl | safe}}";
|
var socketUrl = "{{socketUrl | safe}}";
|
||||||
var subdomainsDisabled = {{subdomainsDisabled | safe}};
|
var subdomainsDisabled = {{subdomainsDisabled | safe}};
|
||||||
</script>
|
</script>
|
||||||
|
@ -106,9 +109,10 @@
|
||||||
<!--Socket.io Client Dependency-->
|
<!--Socket.io Client Dependency-->
|
||||||
<script src="/static/lib/socket.io-client/dist/socket.io.min.js" async></script>
|
<script src="/static/lib/socket.io-client/dist/socket.io.min.js" async></script>
|
||||||
<script src="/static/lib/jquery/dist/jquery.min.js" type="text/javascript"></script>
|
<script src="/static/lib/jquery/dist/jquery.min.js" type="text/javascript"></script>
|
||||||
|
<script src="/static/lib/jquery-ui/jquery-ui.js" type="text/javascript"></script>
|
||||||
|
|
||||||
<script src="/static/dist/vendor.min.js"></script>
|
<script src="/static/dist/vendor.min.js"></script>
|
||||||
|
<script src="/static/lib/angular-ui-date/src/date.js" type="text/javascript"></script>
|
||||||
<!--Application JavaScript Files-->
|
<!--Application JavaScript Files-->
|
||||||
{% for jsFile in formJSFiles %}
|
{% for jsFile in formJSFiles %}
|
||||||
<script type="text/javascript" src="{{jsFile}}"></script>
|
<script type="text/javascript" src="{{jsFile}}"></script>
|
||||||
|
|
|
@ -72,8 +72,8 @@
|
||||||
<!--Embedding The signupDisabled Boolean-->
|
<!--Embedding The signupDisabled Boolean-->
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
var signupDisabled = {{signupDisabled | safe}};
|
var signupDisabled = {{signupDisabled | safe}};
|
||||||
var socketPort = {{socketPort | safe}};
|
var socketPort = {{socketPort | safe}} || false;
|
||||||
var socketUrl = "{{socketUrl | safe}}";
|
var socketUrl = "{{socketUrl | safe}}" || false;
|
||||||
var subdomainsDisabled = {{subdomainsDisabled | safe}};
|
var subdomainsDisabled = {{subdomainsDisabled | safe}};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
|
@ -49,7 +49,10 @@
|
||||||
"angular": "1.4.14",
|
"angular": "1.4.14",
|
||||||
"angular-ui-select": "compiled",
|
"angular-ui-select": "compiled",
|
||||||
"jspdf": "~1.0.178",
|
"jspdf": "~1.0.178",
|
||||||
"angular-sanitize": "1.4.14"
|
"angular-sanitize": "1.4.14",
|
||||||
|
"angular-ui-sortable": "^0.17.1",
|
||||||
|
"angular-ui-date": "~0.0.11",
|
||||||
|
"angular-input-stars-directive": "master"
|
||||||
},
|
},
|
||||||
"overrides": {
|
"overrides": {
|
||||||
"BOWER-PACKAGE": {
|
"BOWER-PACKAGE": {
|
||||||
|
|
|
@ -56,8 +56,10 @@ module.exports = function(db) {
|
||||||
|
|
||||||
app.locals.subdomainsDisabled = config.subdomainsDisabled;
|
app.locals.subdomainsDisabled = config.subdomainsDisabled;
|
||||||
|
|
||||||
if(config.socketPort){
|
if(config.socketPort && process.env.NODE_ENV !== 'production'){
|
||||||
app.locals.socketPort = config.socketPort;
|
app.locals.socketPort = config.socketPort;
|
||||||
|
} else {
|
||||||
|
app.locals.socketPort = "";
|
||||||
}
|
}
|
||||||
|
|
||||||
if(config.socketUrl){
|
if(config.socketUrl){
|
||||||
|
|
|
@ -13,8 +13,8 @@
|
||||||
"url": "https://github.com/whitef0x0/tellform.git"
|
"url": "https://github.com/whitef0x0/tellform.git"
|
||||||
},
|
},
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=5.0.0",
|
"node": "6.11.1",
|
||||||
"npm": ">=3.3.6"
|
"npm": "3.3.6"
|
||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"addcontrib": "all-contributors add",
|
"addcontrib": "all-contributors add",
|
||||||
|
|
195
public/dist/application.js
vendored
195
public/dist/application.js
vendored
File diff suppressed because one or more lines are too long
10
public/dist/application.min.js
vendored
10
public/dist/application.min.js
vendored
File diff suppressed because one or more lines are too long
35
public/dist/form-application.js
vendored
35
public/dist/form-application.js
vendored
File diff suppressed because one or more lines are too long
4
public/dist/form-application.min.js
vendored
4
public/dist/form-application.min.js
vendored
File diff suppressed because one or more lines are too long
18
public/dist/form_populate_template_cache.js
vendored
18
public/dist/form_populate_template_cache.js
vendored
File diff suppressed because one or more lines are too long
2228
public/dist/vendor.min.js
vendored
2228
public/dist/vendor.min.js
vendored
File diff suppressed because one or more lines are too long
2713
public/dist/vendor_forms_uglified.js
vendored
2713
public/dist/vendor_forms_uglified.js
vendored
File diff suppressed because one or more lines are too long
|
@ -64,7 +64,7 @@ angular.module('view-form').directive('fieldDirective', ['$http', '$compile', '$
|
||||||
$rootScope.nextField();
|
$rootScope.nextField();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
scope.nextField = $rootScope.nextField;
|
||||||
scope.setActiveField = $rootScope.setActiveField;
|
scope.setActiveField = $rootScope.setActiveField;
|
||||||
|
|
||||||
//Set format only if field is a date
|
//Set format only if field is a date
|
||||||
|
|
|
@ -24,7 +24,6 @@
|
||||||
ng-required="field.required"
|
ng-required="field.required"
|
||||||
ng-disabled="field.disabled"
|
ng-disabled="field.disabled"
|
||||||
placeholder="MM/DD/YYYY"
|
placeholder="MM/DD/YYYY"
|
||||||
ng-focus="setActiveField(field._id, index, true)"
|
|
||||||
on-tab-key="nextField()"
|
on-tab-key="nextField()"
|
||||||
on-tab-and-shift-key="prevField()"
|
on-tab-and-shift-key="prevField()"
|
||||||
ng-change="$root.nextField()">
|
ng-change="$root.nextField()">
|
||||||
|
|
|
@ -1,38 +0,0 @@
|
||||||
<div class="field row" ng-if="form.autofillPDFs" ng-click="setActiveField(field._id, index, true)">
|
|
||||||
<div class="col-xs-12 field-title" ng-style="{'color': design.colors.questionColor}">
|
|
||||||
<h3>
|
|
||||||
<small class="field-number">
|
|
||||||
{{index+1}}
|
|
||||||
<i class="fa fa-angle-double-right" aria-hidden="true"></i>
|
|
||||||
</small>
|
|
||||||
{{field.title}}
|
|
||||||
<span class="required-error" ng-show="!field.required">{{ 'OPTIONAL' | translate }}</span>
|
|
||||||
</h3>
|
|
||||||
</div>
|
|
||||||
<div class="col-sm-8 field-input">
|
|
||||||
<div class="input-group ">
|
|
||||||
<div tabindex="-1" class="form-control file-caption">
|
|
||||||
<span class="file-caption-ellipsis" ng-if="!form.pdf">…</span>
|
|
||||||
<div class="file-caption-name" ng-if="form.pdf">
|
|
||||||
{{field.file.originalname}}
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="input-group-btn">
|
|
||||||
<button type="button" ng-if="field.file" ng-click="removeFile(field);" title="Clear selected files" class="btn btn-danger fileinput-remove fileinput-remove-button">
|
|
||||||
<i class="glyphicon glyphicon-trash" ></i>
|
|
||||||
{{ 'DELETE' | translate }}
|
|
||||||
</button>
|
|
||||||
|
|
||||||
<button type="button" ng-if="field.fileLoading" title="Abort ongoing upload" class="btn btn-default" ng-click="cancelFileUpload(field)">
|
|
||||||
<i class="glyphicon glyphicon-ban-circle"></i>
|
|
||||||
{{ 'CANCEL' | translate }}
|
|
||||||
</button>
|
|
||||||
|
|
||||||
<div class="btn btn-success btn-file" ngf-select ngf-change="uploadPDF($files)" ng-if="!field.file">
|
|
||||||
<i class="glyphicon glyphicon-upload"></i>
|
|
||||||
{{ UPLOAD_FILE | translate }}
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
|
@ -1,6 +1,7 @@
|
||||||
<div class="field row radio legal"
|
<div class="field row radio legal"
|
||||||
on-enter-or-tab-key="nextField()"
|
on-enter-or-tab-key="nextField()"
|
||||||
key-to-truthy key-char-truthy="y" key-char-falsey="n" field="field">
|
on-tab-and-shift-key="prevField()"
|
||||||
|
key-to-truthy key-char-truthy="y" key-char-falsey="n" field="field" on-valid-key="nextField()">
|
||||||
<div class="col-xs-12 field-title" ng-style="{'color': design.colors.questionColor}">
|
<div class="col-xs-12 field-title" ng-style="{'color': design.colors.questionColor}">
|
||||||
<h3>
|
<h3>
|
||||||
<small class="field-number">
|
<small class="field-number">
|
||||||
|
@ -14,20 +15,17 @@
|
||||||
<p class="col-xs-12">{{field.description}}</p>
|
<p class="col-xs-12">{{field.description}}</p>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-xs-12 field-input container">
|
<div class="col-xs-12 field-input container">
|
||||||
<div class="row-fluid"
|
<div class="row-fluid">
|
||||||
on-enter-or-tab-key="nextField()"
|
|
||||||
on-tab-and-shift-key="prevField()">
|
|
||||||
<label class="btn col-md-5 col-xs-12"
|
<label class="btn col-md-5 col-xs-12"
|
||||||
ng-class="{activeBtn: field.fieldValue == 'true'}">
|
ng-class="{activeBtn: field.fieldValue == 'true'}">
|
||||||
<input class="focusOn"
|
<input class="focusOn"
|
||||||
ng-focus="setActiveField(field._id, index, true)"
|
|
||||||
ng-style="{'color': design.colors.answerColor, 'border-color': design.colors.answerColor}"
|
ng-style="{'color': design.colors.answerColor, 'border-color': design.colors.answerColor}"
|
||||||
type="radio" value="true"
|
type="radio" value="true"
|
||||||
ng-model="field.fieldValue"
|
ng-model="field.fieldValue"
|
||||||
ng-model-options="{ debounce: 250 }"
|
ng-model-options="{ debounce: 250 }"
|
||||||
ng-required="field.required"
|
ng-required="field.required"
|
||||||
ng-disabled="field.disabled"
|
ng-disabled="field.disabled"
|
||||||
ng-change="$root.nextField()"/>
|
ng-change="nextField()"/>
|
||||||
<div class="letter" style="float:left">
|
<div class="letter" style="float:left">
|
||||||
Y
|
Y
|
||||||
</div>
|
</div>
|
||||||
|
@ -42,7 +40,7 @@
|
||||||
ng-model-options="{ debounce: 250 }"
|
ng-model-options="{ debounce: 250 }"
|
||||||
ng-required="field.required"
|
ng-required="field.required"
|
||||||
ng-disabled="field.disabled"
|
ng-disabled="field.disabled"
|
||||||
ng-change="$root.nextField()"/>
|
ng-change="nextField()"/>
|
||||||
<div class="letter" style="float:left">
|
<div class="letter" style="float:left">
|
||||||
N
|
N
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -26,7 +26,6 @@
|
||||||
</div>
|
</div>
|
||||||
<input ng-style="{'color': design.colors.answerColor, 'border-color': design.colors.answerColor}"
|
<input ng-style="{'color': design.colors.answerColor, 'border-color': design.colors.answerColor}"
|
||||||
type="radio" class="focusOn"
|
type="radio" class="focusOn"
|
||||||
ng-focus="setActiveField(field._id, index, true)"
|
|
||||||
value="{{option.option_value}}"
|
value="{{option.option_value}}"
|
||||||
ng-model="field.fieldValue"
|
ng-model="field.fieldValue"
|
||||||
ng-model-options="{ debounce: 250 }"
|
ng-model-options="{ debounce: 250 }"
|
||||||
|
|
|
@ -17,7 +17,8 @@
|
||||||
|
|
||||||
<input-stars max="{{field.ratingOptions.steps}}"
|
<input-stars max="{{field.ratingOptions.steps}}"
|
||||||
ng-init="field.fieldValue = 1"
|
ng-init="field.fieldValue = 1"
|
||||||
on-star-click="$root.nextField()"
|
on-shape-click="true"
|
||||||
|
on-star-click="nextField()"
|
||||||
icon-full="{{field.ratingOptions.shape}}"
|
icon-full="{{field.ratingOptions.shape}}"
|
||||||
icon-base="fa fa-3x"
|
icon-base="fa fa-3x"
|
||||||
icon-empty="{{field.ratingOptions.shape}}"
|
icon-empty="{{field.ratingOptions.shape}}"
|
||||||
|
@ -27,7 +28,6 @@
|
||||||
ng-disabled="field.disabled"
|
ng-disabled="field.disabled"
|
||||||
on-enter-or-tab-key="nextField()"
|
on-enter-or-tab-key="nextField()"
|
||||||
on-tab-and-shift-key="prevField()"
|
on-tab-and-shift-key="prevField()"
|
||||||
ng-focus="setActiveField(field._id, index, true)"
|
|
||||||
class="angular-input-stars focusOn">
|
class="angular-input-stars focusOn">
|
||||||
</input-stars>
|
</input-stars>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
<div class="statement field row"
|
<div class="statement field row"
|
||||||
on-enter-or-tab-key="nextField()"
|
on-enter-or-tab-key="nextField()"
|
||||||
on-tab-and-shift-key="prevField()"
|
on-tab-and-shift-key="prevField()">
|
||||||
ng-focus="setActiveField(field._id, index, true)">
|
|
||||||
<div class="row field-title field-title">
|
<div class="row field-title field-title">
|
||||||
<div class="col-xs-1"><i class="fa fa-quote-left fa-1"></i></div>
|
<div class="col-xs-1"><i class="fa fa-quote-left fa-1"></i></div>
|
||||||
<h2 class="text-left col-xs-9">{{field.title}}</h2>
|
<h2 class="text-left col-xs-9">{{field.title}}</h2>
|
||||||
|
@ -13,10 +12,9 @@
|
||||||
<p class="col-xs-12" ng-if="field.description.length">{{field.description}} </p>
|
<p class="col-xs-12" ng-if="field.description.length">{{field.description}} </p>
|
||||||
<br>
|
<br>
|
||||||
<div class="col-xs-offset-1 col-xs-11">
|
<div class="col-xs-offset-1 col-xs-11">
|
||||||
<button class="btn focusOn"
|
<button class="btn focusOn">
|
||||||
ng-style="{'font-size': '1.3em', 'background-color':design.colors.buttonColor, 'color':design.colors.buttonTextColor}"
|
ng-style="{'font-size': '1.3em', 'background-color':design.colors.buttonColor, 'color':design.colors.buttonTextColor}"
|
||||||
ng-focused="setActiveField(field._id, index, true)"
|
ng-click="nextField()">
|
||||||
ng-click="$root.nextField()">
|
|
||||||
{{ 'CONTINUE' | translate }}
|
{{ 'CONTINUE' | translate }}
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -22,7 +22,6 @@
|
||||||
value="{{field.fieldValue}}"
|
value="{{field.fieldValue}}"
|
||||||
ng-required="field.required"
|
ng-required="field.required"
|
||||||
ng-disabled="field.disabled"
|
ng-disabled="field.disabled"
|
||||||
ng-focus="setActiveField(field._id, index, true)"
|
|
||||||
on-enter-or-tab-key="nextField()"
|
on-enter-or-tab-key="nextField()"
|
||||||
on-tab-and-shift-key="prevField()"
|
on-tab-and-shift-key="prevField()"
|
||||||
style="border: none; border-left: lightgrey dashed 2px;">
|
style="border: none; border-left: lightgrey dashed 2px;">
|
||||||
|
|
|
@ -29,7 +29,6 @@
|
||||||
ng-model="field.fieldValue"
|
ng-model="field.fieldValue"
|
||||||
ng-model-options="{ debounce: 250 }"
|
ng-model-options="{ debounce: 250 }"
|
||||||
value="field.fieldValue"
|
value="field.fieldValue"
|
||||||
ng-focus="setActiveField(field._id, index, true)"
|
|
||||||
on-enter-or-tab-key="nextField()"
|
on-enter-or-tab-key="nextField()"
|
||||||
on-tab-and-shift-key="prevField()"
|
on-tab-and-shift-key="prevField()"
|
||||||
ng-required="field.required"
|
ng-required="field.required"
|
||||||
|
@ -41,7 +40,7 @@
|
||||||
<span class="glyphicon glyphicon-exclamation-sign" aria-hidden="true"></span>
|
<span class="glyphicon glyphicon-exclamation-sign" aria-hidden="true"></span>
|
||||||
<span class="sr-only">Error:</span>
|
<span class="sr-only">Error:</span>
|
||||||
<span ng-if="field.fieldType == 'email'"> {{ 'ERROR_EMAIL_INVALID' | translate }} </span>
|
<span ng-if="field.fieldType == 'email'"> {{ 'ERROR_EMAIL_INVALID' | translate }} </span>
|
||||||
<span ng-if="field.validateRegex"> {{ 'ERROR_NOT_A_NUMBER' | translate }} </span>
|
<span ng-if="field.fieldType == 'number'"> {{ 'ERROR_NOT_A_NUMBER' | translate }} </span>
|
||||||
<span ng-if="field.fieldType == 'link'"> {{ 'ERROR_URL_INVALID' | translate }} </span>
|
<span ng-if="field.fieldType == 'link'"> {{ 'ERROR_URL_INVALID' | translate }} </span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -49,7 +48,7 @@
|
||||||
<div>
|
<div>
|
||||||
<div class="btn btn-lg btn-default col-xs-12 col-sm-4 hidden-xs"
|
<div class="btn btn-lg btn-default col-xs-12 col-sm-4 hidden-xs"
|
||||||
style="padding: 4px; margin-top:8px; background: rgba(255,255,255,0.5)">
|
style="padding: 4px; margin-top:8px; background: rgba(255,255,255,0.5)">
|
||||||
<button ng-disabled="!field.fieldValue || forms.myForm.{{field.fieldType}}{{$index}}.$invalid"
|
<button ng-disabled="!field.fieldValue || field.$invalid"
|
||||||
ng-style="{'background-color':design.colors.buttonColor, 'color':design.colors.buttonTextColor}"
|
ng-style="{'background-color':design.colors.buttonColor, 'color':design.colors.buttonTextColor}"
|
||||||
ng-click="nextField()"
|
ng-click="nextField()"
|
||||||
class="btn col-sm-5 col-xs-5">
|
class="btn col-sm-5 col-xs-5">
|
||||||
|
|
|
@ -1,7 +1,9 @@
|
||||||
<div class="field row radio"
|
<div class="field row radio"
|
||||||
ng-click="setActiveField(field._id, index, true)"
|
ng-click="setActiveField(field._id, index, true)"
|
||||||
on-tab-and-shift-key="prevField()"
|
on-tab-and-shift-key="prevField()"
|
||||||
key-to-truthy key-char-truthy="y" key-char-falsey="n" field="field">
|
key-to-truthy key-char-truthy="y" key-char-falsey="n" field="field"
|
||||||
|
on-valid-key="nextField()"
|
||||||
|
ng-show="!field.disabled">
|
||||||
<div class="col-xs-12 field-title" ng-style="{'color': design.colors.questionColor}">
|
<div class="col-xs-12 field-title" ng-style="{'color': design.colors.questionColor}">
|
||||||
<h3 class="row">
|
<h3 class="row">
|
||||||
<small class="field-number">
|
<small class="field-number">
|
||||||
|
@ -26,11 +28,9 @@
|
||||||
class="focusOn"
|
class="focusOn"
|
||||||
style="opacity: 0; margin-left: 0px;"
|
style="opacity: 0; margin-left: 0px;"
|
||||||
ng-model="field.fieldValue"
|
ng-model="field.fieldValue"
|
||||||
ng-focus="setActiveField(field._id, index, true)"
|
|
||||||
ng-model-options="{ debounce: 250 }"
|
ng-model-options="{ debounce: 250 }"
|
||||||
ng-required="field.required"
|
ng-required="field.required"
|
||||||
ng-change="$root.nextField()"
|
ng-change="nextField()"/>
|
||||||
ng-disabled="field.disabled" />
|
|
||||||
<div class="letter">
|
<div class="letter">
|
||||||
{{ 'Y' | translate }}
|
{{ 'Y' | translate }}
|
||||||
</div>
|
</div>
|
||||||
|
@ -48,9 +48,7 @@
|
||||||
ng-model="field.fieldValue"
|
ng-model="field.fieldValue"
|
||||||
ng-model-options="{ debounce: 250 }"
|
ng-model-options="{ debounce: 250 }"
|
||||||
ng-required="field.required"
|
ng-required="field.required"
|
||||||
ng-change="$root.nextField()"
|
ng-change="nextField()"/>
|
||||||
ng-disabled="field.disabled"/>
|
|
||||||
|
|
||||||
<div class="letter">
|
<div class="letter">
|
||||||
{{ 'N' | translate }}
|
{{ 'N' | translate }}
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -4,23 +4,30 @@ angular.module('view-form').directive('keyToTruthy', ['$rootScope', function($ro
|
||||||
return {
|
return {
|
||||||
restrict: 'A',
|
restrict: 'A',
|
||||||
scope: {
|
scope: {
|
||||||
field: '='
|
field: '=',
|
||||||
|
nextField: '&'
|
||||||
},
|
},
|
||||||
link: function($scope, $element, $attrs) {
|
link: function($scope, $element, $attrs) {
|
||||||
$element.bind('keydown keypress', function(event) {
|
$element.bind('keydown keypress', function(event) {
|
||||||
var keyCode = event.which || event.keyCode;
|
var keyCode = event.which || event.keyCode;
|
||||||
var truthyKeyCode = $attrs.keyCharTruthy.charCodeAt(0) - 32;
|
var truthyKeyCode = $attrs.keyCharTruthy.charCodeAt(0) - 32;
|
||||||
var falseyKeyCode = $attrs.keyCharFalsey.charCodeAt(0) - 32;
|
var falseyKeyCode = $attrs.keyCharFalsey.charCodeAt(0) - 32;
|
||||||
|
console.log($scope);
|
||||||
if(keyCode === truthyKeyCode ) {
|
if(keyCode === truthyKeyCode ) {
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
$scope.$apply(function() {
|
$scope.$apply(function() {
|
||||||
$scope.field.fieldValue = 'true';
|
$scope.field.fieldValue = 'true';
|
||||||
|
if($attrs.onValidKey){
|
||||||
|
$scope.$root.$eval($attrs.onValidKey);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}else if(keyCode === falseyKeyCode){
|
}else if(keyCode === falseyKeyCode){
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
$scope.$apply(function() {
|
$scope.$apply(function() {
|
||||||
$scope.field.fieldValue = 'false';
|
$scope.field.fieldValue = 'false';
|
||||||
|
if($attrs.onValidKey){
|
||||||
|
$scope.$root.$eval($attrs.onValidKey);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
@ -19,16 +19,13 @@ angular.module('forms').directive('editFormDirective', ['$rootScope', 'FormField
|
||||||
//Setup UI-Sortable
|
//Setup UI-Sortable
|
||||||
$scope.sortableOptions = {
|
$scope.sortableOptions = {
|
||||||
appendTo: '.dropzone',
|
appendTo: '.dropzone',
|
||||||
helper: 'clone',
|
//helper: 'clone',
|
||||||
forceHelperSize: true,
|
forceHelperSize: true,
|
||||||
forcePlaceholderSize: true,
|
forcePlaceholderSize: true,
|
||||||
update: function(e, ui) {
|
update: function(e, ui) {
|
||||||
$scope.update(false, $scope.myform, false, false, function(err){
|
$scope.update(false, $scope.myform, false, false, function(err){
|
||||||
if(!err) $scope.myform.form_fields.push(newField);
|
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
start: function(e, ui) {
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -294,10 +291,10 @@ angular.module('forms').directive('editFormDirective', ['$rootScope', 'FormField
|
||||||
|
|
||||||
if(fieldType === 'rating'){
|
if(fieldType === 'rating'){
|
||||||
newField.ratingOptions = {
|
newField.ratingOptions = {
|
||||||
steps: 1,
|
steps: 5,
|
||||||
shape: 'Heart'
|
shape: 'Heart'
|
||||||
};
|
};
|
||||||
newField.fieldValue = '0';
|
newField.fieldValue = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if($scope.showAddOptions(newField)){
|
if($scope.showAddOptions(newField)){
|
||||||
|
|
|
@ -13,17 +13,9 @@ angular.module('forms').directive('editSubmissionsFormDirective', ['$rootScope',
|
||||||
|
|
||||||
$scope.table = {
|
$scope.table = {
|
||||||
masterChecker: false,
|
masterChecker: false,
|
||||||
rows: $scope.myform.submissions
|
rows: []
|
||||||
};
|
};
|
||||||
|
|
||||||
var initController = function(){
|
|
||||||
Forms.get({
|
|
||||||
formId: $stateParams.formId
|
|
||||||
}, function(form){
|
|
||||||
$scope.myform = form;
|
|
||||||
$scope.table.rows = form.submissions;
|
|
||||||
/*var defaultFormFields = _.cloneDeep($scope.myform.form_fields);
|
|
||||||
|
|
||||||
var submissions = $scope.myform.submissions || [];
|
var submissions = $scope.myform.submissions || [];
|
||||||
|
|
||||||
//Iterate through form's submissions
|
//Iterate through form's submissions
|
||||||
|
@ -39,7 +31,31 @@ angular.module('forms').directive('editSubmissionsFormDirective', ['$rootScope',
|
||||||
submissions[i].selected = false;
|
submissions[i].selected = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
$scope.table.rows = submissions;*/
|
$scope.table.rows = submissions;
|
||||||
|
|
||||||
|
var initController = function(){
|
||||||
|
Forms.get({
|
||||||
|
formId: $stateParams.formId
|
||||||
|
}, function(form){
|
||||||
|
$scope.myform = form;
|
||||||
|
var defaultFormFields = _.cloneDeep($scope.myform.form_fields);
|
||||||
|
|
||||||
|
var submissions = $scope.myform.submissions || [];
|
||||||
|
|
||||||
|
//Iterate through form's submissions
|
||||||
|
for(var i = 0; i < submissions.length; i++){
|
||||||
|
for(var x = 0; x < submissions[i].form_fields.length; x++){
|
||||||
|
if(submissions[i].form_fields[x].fieldType === 'dropdown'){
|
||||||
|
submissions[i].form_fields[x].fieldValue = submissions[i].form_fields[x].fieldValue.option_value;
|
||||||
|
}
|
||||||
|
//var oldValue = submissions[i].form_fields[x].fieldValue || '';
|
||||||
|
//submissions[i].form_fields[x] = _.merge(defaultFormFields, submissions[i].form_fields);
|
||||||
|
//submissions[i].form_fields[x].fieldValue = oldValue;
|
||||||
|
}
|
||||||
|
submissions[i].selected = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
$scope.table.rows = submissions;
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -67,7 +67,56 @@
|
||||||
<uib-tab ng-repeat="tab in tabData" index="{{$index+1}}" heading="{{tab.heading}}">
|
<uib-tab ng-repeat="tab in tabData" index="{{$index+1}}" heading="{{tab.heading}}">
|
||||||
<div class='row' data-ng-include="'/static/modules/forms/admin/views/adminTabs/'+tab.templateName+'.html'" onload="form_url = trustSrc(formURL)"></div>
|
<div class='row' data-ng-include="'/static/modules/forms/admin/views/adminTabs/'+tab.templateName+'.html'" onload="form_url = trustSrc(formURL)"></div>
|
||||||
</uib-tab>
|
</uib-tab>
|
||||||
<uib-tab ng-if="tabData && myform.form_fields.length" heading="{{ 'DESIGN_TAB' | translate }}" index="{{tabData.length+1}}">
|
<uib-tab index="2" heading="{{ 'ANALYZE_TAB' | translate }}">
|
||||||
|
<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}}">
|
||||||
|
<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 ng-if="tabData && myform.form_fields.length" heading="{{ 'DESIGN_TAB' | translate }}" index="{{tabData.length}}+1">
|
||||||
<div class="config-form design container">
|
<div class="config-form design container">
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-md-4 col-sm-12 container">
|
<div class="col-md-4 col-sm-12 container">
|
||||||
|
|
|
@ -556,7 +556,7 @@
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-sm-12 col-md-10 dropzoneContainer">
|
<div class="col-sm-12 col-md-10 dropzoneContainer">
|
||||||
|
|
||||||
<div class="panel-group dropzone" ui-sortable="sortableOptions">
|
<div class="panel-group dropzone" ui-sortable="sortableOptions" ng-model="myform.form_fields">
|
||||||
|
|
||||||
<div class="panel panel-default" ng-repeat="field in myform.form_fields"
|
<div class="panel panel-default" ng-repeat="field in myform.form_fields"
|
||||||
ng-if="!field.deletePreserved"
|
ng-if="!field.deletePreserved"
|
||||||
|
|
|
@ -26,7 +26,7 @@
|
||||||
<div class="col-xs-offset-3 col-xs-6 col-sm-offset-4 col-sm-4">
|
<div class="col-xs-offset-3 col-xs-6 col-sm-offset-4 col-sm-4">
|
||||||
<form name="userForm" data-ng-submit="signup()" class="signin form-horizontal" autocomplete="off">
|
<form name="userForm" data-ng-submit="signup()" class="signin form-horizontal" autocomplete="off">
|
||||||
<fieldset>
|
<fieldset>
|
||||||
<div data-ng-show="error" id="signup_errors" class="text-center text-danger">
|
<div data-ng-show="error" id="signup_errors" class="text-center">
|
||||||
{{'SIGNUP_ERROR_TEXT' | translate}}: <br>
|
{{'SIGNUP_ERROR_TEXT' | translate}}: <br>
|
||||||
<strong data-ng-bind="error"></strong>
|
<strong data-ng-bind="error"></strong>
|
||||||
</div>
|
</div>
|
||||||
|
|
Loading…
Reference in a new issue