fixed translation bug in form preview

This commit is contained in:
David Baldwynn 2017-09-20 16:57:05 -07:00
parent c396aa8a6d
commit 78a6c8fabc
45 changed files with 222 additions and 2369 deletions

View file

@ -1,18 +0,0 @@
'use strict';
// Configuring the Forms drop-down menus
angular.module('forms').value('supportedFields', [
'textfield',
'textarea',
'date',
'dropdown',
'hidden',
'password',
'radio',
'legal',
'statement',
'rating',
'yes_no',
'number',
'natural'
]);

View file

@ -1,36 +0,0 @@
'use strict';
angular.module('forms').config(['$translateProvider', function ($translateProvider) {
$translateProvider.translations('en', {
FORM_SUCCESS: 'Form entry successfully submitted!',
REVIEW: 'Review',
BACK_TO_FORM: 'Go back to Form',
EDIT_FORM: 'Edit this TellForm',
CREATE_FORM: 'Create this TellForm',
ADVANCEMENT: '{{done}} out of {{total}} answered',
CONTINUE_FORM: 'Continue to Form',
REQUIRED: 'required',
COMPLETING_NEEDED: '{{answers_not_completed}} answer(s) need completing',
OPTIONAL: 'optional',
ERROR_EMAIL_INVALID: 'Please enter a valid email address',
ERROR_NOT_A_NUMBER: 'Please enter valid numbers only',
ERROR_URL_INVALID: 'Please a valid url',
OK: 'OK',
ENTER: 'press ENTER',
YES: 'Yes',
NO: 'No',
NEWLINE: 'press SHIFT+ENTER to create a newline',
CONTINUE: 'Continue',
LEGAL_ACCEPT: 'I accept',
LEGAL_NO_ACCEPT: 'I dont accept',
DELETE: 'Delete',
CANCEL: 'Cancel',
SUBMIT: 'Submit',
UPLOAD_FILE: 'Upload your File',
TYPE_OR_SELECT_OPTION: 'Type or select an option',
ABORT_UPLOAD: 'Abort ongoing upload',
CLEAR_SELECTED_FILES: 'Clear selected files'
});
}]);

View file

@ -1,38 +0,0 @@
'use strict';
angular.module('forms').config(['$translateProvider', function ($translateProvider) {
$translateProvider.translations('es', {
FORM_SUCCESS: '¡El formulario ha sido enviado con éxito!',
REVIEW: 'Revisar',
BACK_TO_FORM: 'Regresar al formulario',
EDIT_FORM: 'Crear un TellForm',
CREATE_FORM: 'Editar este TellForm',
ADVANCEMENT: '{{done}} de {{total}} contestadas',
CONTINUE_FORM: 'Continuar al formulario',
REQUIRED: 'Información requerida',
COMPLETING_NEEDED: '{{answers_not_completed}} respuesta(s) necesita(n) ser completada(s)',
OPTIONAL: 'Opcional',
ERROR_EMAIL_INVALID: 'Favor de proporcionar un correo electrónico válido',
ERROR_NOT_A_NUMBER: 'Por favor, introduzca sólo números válidos',
ERROR_URL_INVALID: 'Favor de proporcionar un url válido',
OK: 'OK',
ENTER: 'pulse INTRO',
YES: 'Si',
NO: 'No',
NEWLINE: 'presione SHIFT+INTRO para crear una nueva línea',
CONTINUE: 'Continuar',
LEGAL_ACCEPT: 'Acepto',
LEGAL_NO_ACCEPT: 'No acepto',
DELETE: 'Eliminar',
CANCEL: 'Cancelar',
SUBMIT: 'Registrar',
UPLOAD_FILE: 'Cargar el archivo',
Y: 'S',
N: 'N',
TYPE_OR_SELECT_OPTION: 'Escriba o seleccione una opción',
ABORT_UPLOAD: 'Cancelar la subida en curso',
CLEAR_SELECTED_FILES: 'Borrar los archivos seleccionados'
});
}]);

View file

@ -1,26 +0,0 @@
'use strict';
// SubmitForm controller
angular.module('forms').controller('SubmitFormController', [
'$scope', '$rootScope', '$state', '$translate', 'myForm', 'Auth',
function($scope, $rootScope, $state, $translate, myForm, Auth) {
$scope.authentication = Auth;
$scope.myform = myForm;
$translate.use(myForm.language);
if(!$scope.myform.isLive){
// Show navbar if form is not public AND user IS loggedin
if($scope.authentication.isAuthenticated()){
$scope.hideNav = $rootScope.hideNav = false;
}
// Redirect if form is not public user IS NOT loggedin
else {
$scope.hideNav = $rootScope.hideNav = true;
$state.go('access_denied');
}
}else{
$scope.hideNav = $rootScope.hideNav = true;
}
}
]);

View file

@ -1,618 +0,0 @@
/* Custom Tab CSS */
.nav.nav-pills.nav-stacked {
width: 16.66666667%;
float: left;
position: relative;
min-height: 1px;
padding-right: 15px;
}
div.tab-content {
width: 83.33333333%;
position: relative;
min-height: 1px;
float:left;
padding-top: 0!important;
}
.panel-default.startPage {
border-style: dashed;
border-color: #a9a9a9;
border-width:3px;
}
.busy-updating-wrapper {
text-align: center;
font-size: 20px;
position: fixed;
bottom: 0;
right: 55px;
z-index: 1;
}
.busy-submitting-wrapper {
position: fixed;
top: 50%;
left: 0;
right: 0;
bottom: 0;
}
.dropzone h4.panel-title {
height: 17px;
overflow: hidden;
}
.container.admin-form {
margin-top: 70px;
}
.public-form.preview {
border: none;
box-shadow: 0px 0px 10px 0px grey;
overflow-y: scroll;
overflow-x: hidden;
height: 400px;
width: 90%;
position: absolute;
}
.public-form input, .public-form textarea {
background-color: #000000;
background-color: rgba(0,0,0,0);
border: 2px dashed #ddd!important;
}
.public-form input:focus, .public-form textarea:focus {
border: 2px dashed #ddd!important;
outline: 0;
}
/*.public-form input.no-border.ng-invalid, .public-form textarea.no-border {
border-color: none;
}*/
.public-form input.ng-valid, .public-form textarea.ng-valid {
border-color: #20FF20!important;
border-style: solid!important;
border-width: 3px!important;
}
.public-form input.ng-invalid.ng-dirty, .public-form textarea.ng-invalid.ng-dirty {
border-color: #FA787E!important;
border-style: solid!important;
border-width: 3px!important;
}
section.content p.breakwords {
word-break: break-all;
}
.public-form .btn {
border: 1px solid #c6c6c6;
}
.public-form .btn[type='submit'] {
font-size: 1.5em;
padding: 0.35em 1.2em 0.35em 1.2em;
}
section.content > section > section.container {
margin-top: 70px;
}
/*
** Modal CSS Styles
*/
.modal-header {
padding: 15px;
border-bottom: 1px solid #e5e5e5;
font-size: 18px;
font-weight: normal;
}
.public-form .input-block {
display: block;
width: 100%;
}
.modal-footer input[type='text'] {
min-height: 34px;
padding: 7px 8px;
font-size: 13px;
color: #333;
vertical-align: middle;
background-color: #fff;
background-repeat: no-repeat;
background-position: right 8px center;
border: 1px solid #ccc;
border-radius: 3px;
box-shadow: inset 0 1px 2px rgba(0,0,0,0.075);
}
.modal-body > .modal-body-alert {
color: #796620;
background-color: #f8eec7;
border-color: #f2e09a;
margin: -16px -15px 15px;
padding: 10px 15px;
border-style: solid;
border-width: 1px 0;
}
div.form-fields {
position: relative;
padding-top: 10%;
}
.public-form .letter {
position: relative;
display: -moz-inline-stack;
display: inline-block;
vertical-align: top;
zoom: 1;
width: 16px;
padding: 0;
height: 17px;
font-size: 12px;
line-height: 19px;
border: 1px solid #000;
border: 1px solid rgba(0,0,0,.2);
margin-right: 7px;
-webkit-border-radius: 3px;
-moz-border-radius: 3px;
border-radius: 3px;
text-align: center;
font-weight: 700;
}
div.form-submitted > .field.row {
padding-bottom: 2%;
margin-top: 10%;
}
div.form-submitted > .field.row > div {
font-size: 1.7em;
}
/* Styles for accordion */
form .accordion-edit {
width: inherit;
}
/*Styles for ui-datepicker*/
.ui-datepicker.ui-widget {
z-index: 99!important;
}
form .row.field .field-number {
margin-right: 0.5em;
}
/* Styles for form submission view (/forms/:formID) */
form .row.field {
padding: 1em 0 0 0;
width: inherit;
}
form .row.field > .field-title {
margin-top:0.5em;
font-size:1.2em;
padding-bottom: 1.8em;
width: inherit;
}
form .row.field > .field-input {
font-size: 1.4em;
color: #777;
}
form.submission-form .row.field.statement > .field-title {
font-size:1.7em;
}
form.submission-form .row.field.statement > .field-input {
font-size:1em;
color:#ddd;
}
form.submission-form .select.radio > .field-input input, form.submission-form .select > .field-input input {
width:20%;
}
form.submission-form .field.row.radio .btn.activeBtn {
background-color: #000!important;
background-color: rgba(0,0,0,0.7)!important;
color: white;
}
form.submission-form .field.row.radio .btn {
margin-right:1.2em;
}
form.submission-form .select > .field-input .btn {
text-align: left;
margin-bottom:0.7em;
}
form.submission-form .select > .field-input .btn > span {
font-size: 1.10em;
}
/*form.submission-form .field-input > input:focus {
font-size:1em;
}*/
form .field-input > textarea{
padding: 0.45em 0.9em;
width: 100%;
line-height: 160%;
}
form .field-input > input.hasDatepicker{
padding: 0.45em 0.9em;
width: 50%;
line-height: 160%;
}
form .field-input > input.text-field-input{
padding: 0.45em 0.9em;
width: 100%;
line-height: 160%;
}
form .required-error{
color: #ddd;
font-size:0.8em;
}
form .row.field.dropdown > .field-input input {
min-height: 34px;
border-width: 0 0 2px 0;
border-radius: 5px;
}
form .row.field.dropdown > .field-input input:focus {
border: none;
}
form .dropdown > .field-input .ui-select-choices-row-inner {
border-radius: 3px;
margin: 5px;
padding: 10px;
background-color: #000000;
background-color: rgba(0,0,0,0.05);
}
form .dropdown > .field-input .ui-select-choices-row-inner.active, form .dropdown > .field-input .ui-select-choices-row-inner.active:focus {
background-color: #000000;
background-color: rgba(0,0,0,0.1);
}
.config-form {
max-width: 100%;
}
.config-form > .row {
padding: 19px;
margin-bottom: 20px;
background-color: #f5f5f5;
border: 1px solid #e3e3e3;
border-radius: 4px;
-webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, .05);
-moz-box-shadow: inset 0 1px 1px rgba(0, 0, 0, .05);
box-shadow: inset 0 1px 1px rgba(0, 0, 0, .05);
}
div.config-form .row.field {
padding-top:1.5em;
}
div.config-form > .row > .container:nth-of-type(odd){
border-right: 1px #ddd solid;
}
div.config-form.design > .row > .container:nth-of-type(odd){
border-right: none;
}
div.config-form .row > .field-input {
padding-left:0.1em;
}
div.config-form .row > .field-input label {
padding-left:1.3em;
display: block;
}
/* Styles for form admin view (/forms/:formID/admin) */
.admin-form > .page-header {
padding-bottom: 0;
margin-bottom: 40px;
}
.admin-form > .page-header h1 {
margin-bottom: 0;
margin-top: 0;
}
.admin-form > .page-header > .col-xs-3 {
padding-top: 1.4em;
}
.admin-form .form-controls .row {
padding: 5px;
}
.admin-form .page-header {
border: none;
margin-top: none;
margin-bottom: none;
}
/*Styles for admin view tabs */
.admin-form .tab-content {
padding-top: 3em;
}
.admin-form .panel-heading {
background-color: #f1f1f1;
position: relative!important;
}
.admin-form .panel-heading:hover {
background-color: #fff;
cursor: pointer;
}
.admin-form .panel-heading a:hover {
text-decoration: none;
}
.current-fields .panel-body .row.question input[type='text'], .current-fields .panel-body .row.description textarea{
width: 100%;
}
.current-fields .panel-body .row.options input[type='text'] {
width: 80%;
}
/*Override Select2 UI*/
.ui-select-choices.ui-select-dropdown {
top:2.5em!important;
}
.ui-select-toggle {
box-shadow:none!important;
border:none!important;
}
.current-fields .tool-panel > .panel-default:hover {
border-color: #9d9d9d;
cursor: pointer;
}
.current-fields .tool-panel > .panel-default .panel-heading {
background-color: #fff;
color: #9d9d9d!important;
}
.current-fields .tool-panel > .panel-default .panel-heading:hover {
background-color: #eee;
color: #000!important;
cursor: pointer;
}
.current-fields .tool-panel > .panel-default .panel-heading a {
color: inherit;
}
.current-fields .tool-panel > .panel-default .panel-heading a:hover{
text-decoration: none;
}
/*Styles for submission table*/
.submissions-table .table-outer.row {
margin: 1.5em 0 2em 0!important;
}
.submissions-table .table-outer .col-xs-12 {
padding-left: 0!important;
border:1px solid #ddd;
overflow-x: scroll;
border-radius:3px;
}
.submissions-table .table > thead > tr > th {
min-width:8em;
}
.submissions-table .table > tbody > tr.selected {
background-color:#efefef;
}
/*Styles for add fields tab*/
.admin-form .add-field {
background-color: #ddd;
padding: 0 2% 0 2%;
border-radius: 3px;
}
.admin-form .add-field .col-xs-6 {
padding: 0.25em 0.4em;
}
.admin-form .add-field .col-xs-6 .panel-heading {
border-width: 1px;
border-style: solid;
border-color: #bbb;
border-radius: 4px;
}
.admin-form .oscar-field-select {
margin: 10px 0 10px;
}
.view-form-btn.span {
padding-right:0.6em;
}
.status-light.status-light-off {
color: #BE0000;
}
.status-light.status-light-on {
color: #33CC00;
}
/* Styles for form list view (/forms) */
section.public-form {
padding: 0 10% 0 10%;
}
section.public-form .form-submitted {
height: 100%;
}
section.public-form .btn {
border: 1px solid;
}
.form-item {
border-radius: 5px;
text-align: center;
background-color: #eee;
width: 180px;
position: relative;
height: 215px;
margin-bottom: 45px;
}
.form-item.paused {
background-color: red;
color: white;
}
.form-item.paused:hover {
background-color: darkred;
color: white;
}
.form-item.create-new input[type='text']{
width: inherit;
color:black;
border:none;
}
.form-item.create-new {
background-color: #3FA2F7;
color: white;
}
.form-item.create-new:hover {
background-color: #276496;
}
/*CREATE-NEW FORM MODAL*/
.form-item.create-new.new-form {
background-color: #832383;
background-color: rgb(300,131,131);
z-index: 11;
}
.form-item.create-new.new-form:hover {
background-color: #3079b5;
}
.form-item.new-form input[type='text'] {
margin-top:0.2em;
width: inherit;
color:black;
border:none;
padding: 0.3em 0.6em 0.3em 0.6em;
}
.form-item.new-form .custom-select {
margin-top: 0.2em
}
.form-item.new-form .custom-select select {
background-color: white;
}
.form-item.new-form .details-row {
margin-top: 1em;
}
.form-item.new-form .details-row.submit {
margin-top: 1.7em;
}
.form-item.new-form .details-row.submit .btn {
font-size: 0.95em;
}
.form-item.new-form .title-row {
margin-top: 1em;
top:0;
}
/*Modal overlay (for lightbox effect)*/
.overlay {
position: fixed;
top: 0;
left: 0;
height: 100%;
width: 100%;
background-color: #000;
background-color: rgba(0,0,0,0.5);
z-index: 10;
}
.overlay.submitform {
background-color: #fff;
background-color: rgba(256,256,256,0.8);
}
/*Modal overlay for live preview in Design Tab of Admin Form page*/
.overlay.previewform {
position: absolute;
}
.field-directive {
z-index: 9;
padding: 10% 10% 10% 0;
border: 25px transparent solid;
position: relative;
}
.activeField {
z-index: 11;
position: relative;
background-color: transparent;
}
.activeField.field-directive {
display: inline-block;
border-radius: 7px;
width: 100%;
border: 25px transparent solid;
}
.activeField input {
background-color: transparent;
}
h3.forms-list-title {
color: #3FA2F7;
font-weight: 600;
margin-bottom: 3em;
}
.form-item {
color: #71AADD;
background-color: #E4F1FD;
}
.form-item:hover {
background-color: #3FA2F7;
color: #23527C;
}
.form-item.create-new:hover {
background-color: #d9d9d9;
color: white;
}
.form-item.create-new:hover {
background-color: #515151;
background-color: rgb(81,81,81);
}
.form-item > .row.footer {
position: absolute;
bottom: 0;
left: 30%;
}
.form-item .title-row {
position: relative;
top: 15px;
padding-top:3em;
padding-bottom:1em;
}
.form-item .title-row h4 {
font-size: 1.3em;
}
.form-item.create-new .title-row{
padding: 0;
}
.form-item.create-new .title-row h4 {
font-size: 7em;
}
.form-item .details-row{
margin-top: 3.2em;
}
.form-item .details-row small {
font-size: 0.6em;
}
.form-item.create-new .details-row small {
font-size: 0.95em;
}

View file

@ -1,33 +0,0 @@
'use strict';
angular.module('forms').directive('fieldIconDirective', function() {
return {
template: '<i class="{{typeIcon}}"></i>',
restrict: 'E',
scope: {
typeName: '@'
},
controller: function($scope){
var iconTypeMap = {
'textfield': 'fa fa-pencil-square-o',
'dropdown': 'fa fa-th-list',
'date': 'fa fa-calendar',
'checkbox': 'fa fa-check-square-o',
'radio': 'fa fa-dot-circle-o',
'email': 'fa fa-envelope-o',
'textarea': 'fa fa-pencil-square',
'legal': 'fa fa-legal',
'file': 'fa fa-cloud-upload',
'rating': 'fa fa-star-half-o',
'link': 'fa fa-link',
'scale': 'fa fa-sliders',
'stripe': 'fa fa-credit-card',
'statement': 'fa fa-quote-left',
'yes_no': 'fa fa-toggle-on',
'number': 'fa fa-slack'
};
$scope.typeIcon = iconTypeMap[$scope.typeName];
}
};
});

View file

@ -1,108 +0,0 @@
'use strict';
// coffeescript's for in loop
var __indexOf = [].indexOf || function(item) {
for (var i = 0, l = this.length; i < l; i++) {
if (i in this && this[i] === item) return i;
}
return -1;
};
angular.module('forms').directive('fieldDirective', ['$http', '$compile', '$rootScope', '$templateCache', 'supportedFields',
function($http, $compile, $rootScope, $templateCache, supportedFields) {
var getTemplateUrl = function(fieldType) {
var type = fieldType;
var supported_fields = [
'textfield',
'textarea',
'file',
'date',
'dropdown',
'hidden',
'password',
'radio',
'legal',
'statement',
'rating',
'yes_no',
'number',
'natural'
];
var templateUrl = 'modules/forms/base/views/directiveViews/field/';
if (__indexOf.call(supportedFields, type) >= 0) {
templateUrl = templateUrl+type+'.html';
}
return $templateCache.get(templateUrl);
};
return {
template: '<div>{{field.title}}</div>',
restrict: 'E',
scope: {
field: '=',
required: '&',
design: '=',
index: '=',
forms: '='
},
link: function(scope, element) {
$rootScope.chooseDefaultOption = scope.chooseDefaultOption = function(type) {
if(type === 'yes_no'){
scope.field.fieldValue = 'true';
}else if(type === 'rating'){
scope.field.fieldValue = 0;
}else if(scope.field.fieldType === 'radio'){
scope.field.fieldValue = scope.field.fieldOptions[0].option_value;
}else if(type === 'legal'){
scope.field.fieldValue = 'true';
$rootScope.nextField();
}
};
scope.setActiveField = $rootScope.setActiveField;
//Set format only if field is a date
if(scope.field.fieldType === 'date'){
scope.dateOptions = {
changeYear: true,
changeMonth: true,
altFormat: 'mm/dd/yyyy',
yearRange: '1900:-0',
defaultDate: 0
};
}
var fieldType = scope.field.fieldType;
if(scope.field.fieldType === 'number' || scope.field.fieldType === 'textfield' || scope.field.fieldType === 'email' || scope.field.fieldType === 'link'){
switch(scope.field.fieldType){
case 'textfield':
scope.input_type = 'text';
break;
case 'email':
scope.input_type = 'email';
scope.placeholder = 'joesmith@example.com';
break;
case 'number':
scope.input_type = 'text';
scope.validateRegex = /^-?\d+$/;
break;
default:
scope.input_type = 'url';
scope.placeholder = 'http://example.com';
break;
}
fieldType = 'textfield';
}
var template = getTemplateUrl(fieldType);
element.html(template).show();
var output = $compile(element.contents())(scope);
}
};
}]);

View file

@ -1,76 +0,0 @@
'use strict';
//TODO: DAVID: Need to refactor this
angular.module('forms').directive('onEnterKey', ['$rootScope', function($rootScope){
return {
restrict: 'A',
link: function($scope, $element, $attrs) {
$element.bind('keydown keypress', function(event) {
var keyCode = event.which || event.keyCode;
var onEnterKeyDisabled = false;
if($attrs.onEnterKeyDisabled !== null) onEnterKeyDisabled = $attrs.onEnterKeyDisabled;
if(keyCode === 13 && !event.shiftKey && !onEnterKeyDisabled) {
event.preventDefault();
$rootScope.$apply(function() {
$rootScope.$eval($attrs.onEnterKey);
});
}
});
}
};
}]).directive('onTabKey', ['$rootScope', function($rootScope){
return {
restrict: 'A',
link: function($scope, $element, $attrs) {
$element.bind('keydown keypress', function(event) {
var keyCode = event.which || event.keyCode;
if(keyCode === 9 && !event.shiftKey) {
event.preventDefault();
$rootScope.$apply(function() {
$rootScope.$eval($attrs.onTabKey);
});
}
});
}
};
}]).directive('onEnterOrTabKey', ['$rootScope', function($rootScope){
return {
restrict: 'A',
link: function($scope, $element, $attrs) {
$element.bind('keydown keypress', function(event) {
var keyCode = event.which || event.keyCode;
if((keyCode === 13 || keyCode === 9) && !event.shiftKey) {
event.preventDefault();
$rootScope.$apply(function() {
$rootScope.$eval($attrs.onEnterOrTabKey);
});
}
});
}
};
}]).directive('onTabAndShiftKey', ['$rootScope', function($rootScope){
return {
restrict: 'A',
link: function($scope, $element, $attrs) {
$element.bind('keydown keypress', function(event) {
var keyCode = event.which || event.keyCode;
if(keyCode === 9 && event.shiftKey) {
event.preventDefault();
$rootScope.$apply(function() {
$rootScope.$eval($attrs.onTabAndShiftKey);
});
}
});
}
};
}]);

View file

@ -1,26 +0,0 @@
'use strict';
angular.module('forms').directive('onFinishRender', function ($rootScope) {
return {
restrict: 'A',
link: function (scope, element, attrs) {
//Don't do anything if we don't have a ng-repeat on the current element
if(!element.attr('ng-repeat') && !element.attr('data-ng-repeat')){
return;
}
var broadcastMessage = attrs.onFinishRender || 'ngRepeat';
if(scope.$first && !scope.$last) {
scope.$evalAsync(function () {
$rootScope.$broadcast(broadcastMessage+' Started');
});
} else if(scope.$last) {
scope.$evalAsync(function () {
$rootScope.$broadcast(broadcastMessage+' Finished');
});
}
}
};
});

View file

@ -1,259 +0,0 @@
'use strict';
angular.module('forms').directive('submitFormDirective', ['$http', 'TimeCounter', '$filter', '$rootScope', 'Auth', 'SendVisitorData',
function ($http, TimeCounter, $filter, $rootScope, Auth, SendVisitorData) {
return {
templateUrl: '/static/modules/forms/base/views/directiveViews/form/submit-form.client.view.html',
restrict: 'E',
scope: {
myform:'=',
ispreview: '='
},
controller: function($document, $window, $scope){
$scope.noscroll = false;
$scope.forms = {};
//Don't start timer if we are looking at a design preview
if($scope.ispreview){
TimeCounter.restartClock();
}
var form_fields_count = $scope.myform.visible_form_fields.filter(function(field){
if(field.fieldType === 'statement' || field.fieldType === 'rating'){
return false;
}
return true;
}).length;
var nb_valid = $filter('formValidity')($scope.myform);
$scope.translateAdvancementData = {
done: nb_valid,
total: form_fields_count,
answers_not_completed: form_fields_count - nb_valid
};
$scope.reloadForm = function(){
//Reset Form
$scope.myform.submitted = false;
$scope.myform.form_fields = _.chain($scope.myform.visible_form_fields).map(function(field){
field.fieldValue = '';
return field;
}).value();
$scope.loading = false;
$scope.error = '';
$scope.selected = {
_id: '',
index: 0
};
$scope.setActiveField($scope.myform.visible_form_fields[0]._id, 0, false);
//Reset Timer
if(!$scope.ispreview){
TimeCounter.restartClock();
}
};
//Fire event when window is scrolled
$window.onscroll = function(){
$scope.scrollPos = document.body.scrollTop || document.documentElement.scrollTop || 0;
var elemBox = document.getElementsByClassName('activeField')[0].getBoundingClientRect();
$scope.fieldTop = elemBox.top;
$scope.fieldBottom = elemBox.bottom;
//console.log($scope.forms.myForm);
var field_id;
var field_index;
if(!$scope.noscroll){
//Focus on submit button
if( $scope.selected.index === $scope.myform.visible_form_fields.length-1 && $scope.fieldBottom < 200){
field_index = $scope.selected.index+1;
field_id = 'submit_field';
$scope.setActiveField(field_id, field_index, false);
}
//Focus on field above submit button
else if($scope.selected.index === $scope.myform.visible_form_fields.length){
if($scope.fieldTop > 200){
field_index = $scope.selected.index-1;
field_id = $scope.myform.visible_form_fields[field_index]._id;
$scope.setActiveField(field_id, field_index, false);
}
}else if( $scope.fieldBottom < 0){
field_index = $scope.selected.index+1;
field_id = $scope.myform.visible_form_fields[field_index]._id;
$scope.setActiveField(field_id, field_index, false);
}else if ( $scope.selected.index !== 0 && $scope.fieldTop > 0) {
field_index = $scope.selected.index-1;
field_id = $scope.myform.visible_form_fields[field_index]._id;
$scope.setActiveField(field_id, field_index, false);
}
//console.log('$scope.selected.index: '+$scope.selected.index);
//console.log('scroll pos: '+$scope.scrollPos+' fieldTop: '+$scope.fieldTop+' fieldBottom: '+$scope.fieldBottom);
$scope.$apply();
}
};
/*
** Field Controls
*/
var getActiveField = function(){
if($scope.selected === null){
console.error('current active field is null');
throw new Error('current active field is null');
}
if($scope.selected._id === 'submit_field') {
return $scope.myform.form_fields.length - 1;
} else {
return $scope.selected.index;
}
};
$scope.setActiveField = $rootScope.setActiveField = function(field_id, field_index, animateScroll) {
if($scope.selected === null || $scope.selected._id === field_id){
//console.log('not scrolling');
//console.log($scope.selected);
return;
}
//console.log('field_id: '+field_id);
//console.log('field_index: '+field_index);
//console.log($scope.selected);
$scope.selected._id = field_id;
$scope.selected.index = field_index;
var nb_valid = $filter('formValidity')($scope.myform);
$scope.translateAdvancementData = {
done: nb_valid,
total: form_fields_count,
answers_not_completed: form_fields_count - nb_valid
};
if(animateScroll){
$scope.noscroll=true;
setTimeout(function() {
$document.scrollToElement(angular.element('.activeField'), -10, 200).then(function() {
$scope.noscroll = false;
setTimeout(function() {
if (document.querySelectorAll('.activeField .focusOn').length) {
//Handle default case
document.querySelectorAll('.activeField .focusOn')[0].focus();
} else if(document.querySelectorAll('.activeField input').length) {
//Handle case for rating input
document.querySelectorAll('.activeField input')[0].focus();
} else {
//Handle case for dropdown input
document.querySelectorAll('.activeField .selectize-input')[0].focus();
}
});
});
});
} else {
setTimeout(function() {
if (document.querySelectorAll('.activeField .focusOn')[0] !== undefined) {
//FIXME: DAVID: Figure out how to set focus without scroll movement in HTML Dom
document.querySelectorAll('.activeField .focusOn')[0].focus();
} else if(document.querySelectorAll('.activeField input')[0] !== undefined) {
document.querySelectorAll('.activeField input')[0].focus();
}
});
}
};
$rootScope.nextField = $scope.nextField = function(){
//console.log('nextfield');
//console.log($scope.selected.index);
//console.log($scope.myform.visible_form_fields.length-1);
var selected_index, selected_id;
if($scope.selected.index < $scope.myform.visible_form_fields.length-1){
selected_index = $scope.selected.index+1;
selected_id = $scope.myform.visible_form_fields[selected_index]._id;
$rootScope.setActiveField(selected_id, selected_index, true);
} else if($scope.selected.index === $scope.myform.visible_form_fields.length-1) {
//console.log('Second last element');
selected_index = $scope.selected.index+1;
selected_id = 'submit_field';
$rootScope.setActiveField(selected_id, selected_index, true);
}
};
$rootScope.prevField = $scope.prevField = function(){
if($scope.selected.index > 0){
var selected_index = $scope.selected.index - 1;
var selected_id = $scope.myform.visible_form_fields[selected_index]._id;
$scope.setActiveField(selected_id, selected_index, true);
}
};
/*
** Form Display Functions
*/
$scope.exitStartPage = function(){
$scope.myform.startPage.showStart = false;
if($scope.myform.visible_form_fields.length > 0){
$scope.selected._id = $scope.myform.visible_form_fields[0]._id;
}
};
$rootScope.goToInvalid = $scope.goToInvalid = function() {
document.querySelectorAll('.ng-invalid.focusOn')[0].focus();
};
$rootScope.submitForm = $scope.submitForm = function(cb) {
//Don't submit anything if we are looking at a design preview
if ($scope.ispreview) {
$scope.myform.submitted = true;
$scope.loading = false;
//Reload our form
$scope.reloadForm();
return;
}
var _timeElapsed = TimeCounter.stopClock();
$scope.loading = true;
var form = _.cloneDeep($scope.myform);
form.timeElapsed = _timeElapsed;
form.percentageComplete = $filter('formValidity')($scope.myform) / $scope.myform.visible_form_fields.length * 100;
delete form.visible_form_fields;
for(var i=0; i < $scope.myform.form_fields.length; i++){
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;
}
}
setTimeout(function () {
$scope.submitPromise = $http.post('/forms/' + $scope.myform._id, form)
.success(function (data, status, headers) {
$scope.myform.submitted = true;
$scope.loading = false;
SendVisitorData.send($scope.myform, getActiveField(), _timeElapsed);
if(cb){
cb();
}
})
.error(function (error) {
$scope.loading = false;
console.error(error);
$scope.error = error.message;
if(cb){
cb(error);
}
});
}, 500);
};
//Reload our form
$scope.reloadForm();
}
};
}
]);

View file

@ -1,18 +0,0 @@
'use strict';
//Forms service used for communicating with the forms REST endpoints
angular.module('forms').service('CurrentForm',
function(){
//Private variables
var _form = {};
//Public Methods
this.getForm = function() {
return _form;
};
this.setForm = function(form) {
_form = form;
};
}
);

View file

@ -1,32 +0,0 @@
'use strict';
//Forms service used for communicating with the forms REST endpoints
angular.module('forms').factory('Forms', ['$resource', 'FORM_URL',
function($resource, FORM_URL) {
return $resource(FORM_URL, {
formId: '@_id'
}, {
'query' : {
method: 'GET',
isArray: true
},
'get' : {
method: 'GET',
transformResponse: function(data, header) {
var form = angular.fromJson(data);
form.visible_form_fields = _.filter(form.form_fields, function(field){
return (field.deletePreserved === false);
});
return form;
}
},
'update': {
method: 'PUT'
},
'save': {
method: 'POST'
}
});
}
]);

View file

@ -1,68 +0,0 @@
(function () {
'use strict';
function Socket($timeout, $window) {
var service;
// Connect to Socket.io server
function connect(url) {
service.socket = io(url, {'transports': ['websocket', 'polling']});
}
// Wrap the Socket.io 'emit' method
function emit(eventName, data) {
if (service.socket) {
service.socket.emit(eventName, data);
}
}
// Wrap the Socket.io 'on' method
function on(eventName, callback) {
if (service.socket) {
service.socket.on(eventName, function (data) {
$timeout(function () {
callback(data);
});
});
}
}
// Wrap the Socket.io 'removeListener' method
function removeListener(eventName) {
if (service.socket) {
service.socket.removeListener(eventName);
}
}
service = {
connect: connect,
emit: emit,
on: on,
removeListener: removeListener,
socket: null
};
var url = '';
if($window.socketPort && $window.socketUrl){
url = $window.socketUrl + ':' + $window.socketPort;
} else if ($window.socketUrl && !$window.socketUrl){
url = $window.socketUrl;
} else if ($window.socketPort){
url = window.location.protocol+'//'+window.location.hostname + ':' + $window.socketPort;
} else {
url = window.location.protocol+'//'+window.location.hostname;
}
connect(url);
return service;
}
// Create the Socket.io wrapper service
angular.module('forms')
.factory('Socket', Socket);
Socket.$inject = ['$timeout', '$window'];
}());

View file

@ -1,38 +0,0 @@
'use strict';
angular.module('forms').service('TimeCounter', [
function(){
var _startTime, _endTime = null, that=this;
this.timeSpent = 0;
this.restartClock = function(){
_startTime = Date.now();
_endTime = null;
// console.log('Clock Started');
};
this.getTimeElapsed = function(){
if(_startTime) {
return Math.abs(Date.now().valueOf() - _startTime.valueOf()) / 1000;
}
};
this.stopClock = function(){
if(_startTime && _endTime === null){
_endTime = Date.now();
this.timeSpent = Math.abs(_endTime.valueOf() - _startTime.valueOf())/1000;
this._startTime = this._endTime = null;
return this.timeSpent;
}else{
return new Error('Clock has not been started');
}
};
this.clockStarted = function(){
return !!this._startTime;
};
}
]);

View file

@ -1,24 +0,0 @@
<div class="field row text-center">
<div class="col-xs-12 text-center">
<h1>{{pageData.introTitle}}</h1>
</div>
<div class="col-xs-10 col-xs-offset-1 text-left">
<p style="color:#ddd;">{{pageData.introParagraph}}</p>
</div>
</div>
<div class="row form-actions" style="padding-bottom:3em; padding-left: 1em; padding-right: 1em;">
<p ng-repeat="button in pageData.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">
<p class="col-xs-3 col-xs-offset-3 text-center">
<button class="btn btn-info" type="button">
<a ng-click="exitpageData()" style="color:white; font-size: 1.6em; text-decoration: none;">{{ 'CONTINUE_FORM' | translate }}</a>
</button>
</p>
</div>

View file

@ -1,33 +0,0 @@
<div class="field row"
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 && !field.fieldValue">{{ 'OPTIONAL' | translate }}</span>
</h3>
<p class="col-xs-12">
<small>{{field.description}}</small>
</p>
</div>
<div class="col-xs-12 field-input">
<div class="control-group input-append">
<input class="focusOn"
ng-style="{'color': design.colors.answerColor, 'border-color': design.colors.answerColor}"
ng-class="{ 'no-border': !!field.fieldValue }"
ui-date="dateOptions"
ng-model="field.fieldValue"
ng-model-options="{ debounce: 250 }"
ng-required="field.required"
placeholder="MM/DD/YYYY"
ng-focus="setActiveField(field._id, index, true)"
on-tab-key="nextField()"
on-tab-and-shift-key="prevField()"
ng-change="$root.nextField()">
</div>
</div>
</div>

View file

@ -1,36 +0,0 @@
<div class="field row dropdown"
ng-if="field.fieldOptions.length > 0">
<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>
<p class="col-xs-12">
<small>{{field.description}}</small>
</p>
</div>
<div class="col-xs-12 field-input">
<ui-select ng-model="field.fieldValue"
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()"
ng-change="$root.nextField()">
<ui-select-match placeholder="{{ 'TYPE_OR_SELECT_OPTION' | translate }}">
</ui-select-match>
<ui-select-choices repeat="option in field.fieldOptions | filter: $select.search"
ng-class="{'active': option.option_value === field.fieldValue }">
<span ng-bind-html="option.option_value | highlight: $select.search"></span>
</ui-select-choices>
</ui-select>
</div>
</div>
<br>

View file

@ -1,38 +0,0 @@
<div class="field row" 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="!field.file"></span>
<div class="file-caption-name" ng-if="field.file">
{{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' | translate }}" 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_UPLOAD' | translate }}" 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>

View file

@ -1 +0,0 @@
<input ng-focus="setActiveField(field._id, index, true)" ng-style="{'color': design.colors.answerColor, 'border-color': design.colors.answerColor}" type="hidden" ng-model="field.fieldValue" ng-model-options="{ debounce: 250 }" value="{{field.fieldValue}}" >

View file

@ -1,55 +0,0 @@
<div class="field row radio legal"
on-enter-or-tab-key="nextField()"
key-to-truthy key-char-truthy="y" key-char-falsey="n" field="field">
<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>
<br>
<p class="col-xs-12">{{field.description}}</p>
</div>
<div class="col-xs-12 field-input container">
<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"
ng-class="{activeBtn: field.fieldValue == 'true'}">
<input class="focusOn"
ng-focus="setActiveField(field._id, index, true)"
ng-style="{'color': design.colors.answerColor, 'border-color': design.colors.answerColor}"
type="radio" value="true"
ng-model="field.fieldValue"
ng-model-options="{ debounce: 250 }"
ng-required="field.required"
ng-change="$root.nextField()"/>
<div class="letter" style="float:left">
Y
</div>
<span>{{ 'LEGAL_ACCEPT' | translate }}</span>
</label>
<label class="btn col-md-5 col-md-offset-1 col-xs-12"
ng-class="{activeBtn: field.fieldValue == 'false'}">
<input class="focusOn"
ng-style="{'color': design.colors.answerColor, 'border-color': design.colors.answerColor}"
type="radio" value="false"
ng-model="field.fieldValue"
ng-model-options="{ debounce: 250 }"
ng-required="field.required"
ng-change="$root.nextField()"/>
<div class="letter" style="float:left">
N
</div>
<span>{{ 'LEGAL_NO_ACCEPT' | translate }}</span>
</label>
</div>
</div>
</div>
<br>

View file

@ -1,43 +0,0 @@
<div class="field row radio"
on-enter-or-tab-key="nextField()"
key-to-option field="field"
ng-if="field.fieldOptions.length > 0">
<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>
<p class="col-xs-12">
<small>{{field.description}}</small>
</p>
</div>
<div class="col-xs-12 field-input">
<div ng-repeat="option in field.fieldOptions" class="row-fluid">
<label class="btn col-md-4 col-xs-12 col-sm-12"
style="margin: 0.5em; padding-left:30px"
ng-class="{activeBtn: field.fieldValue == field.fieldOptions[$index].option_value}">
<div class="letter" style="float:left">
{{$index+1}}
</div>
<input ng-style="{'color': design.colors.answerColor, 'border-color': design.colors.answerColor}"
style="visibility:hidden;"
type="radio" class="focusOn"
ng-focus="setActiveField(field._id, index, true)"
value="{{option.option_value}}"
ng-model="field.fieldValue"
ng-model-options="{ debounce: 250 }"
ng-required="field.required"
ng-change="$root.nextField()"/>
<span ng-bind="option.option_value" style="white-space: normal;"></span>
</label>
</div>
</div>
</div>
<br>

View file

@ -1,33 +0,0 @@
<div class="textfield field row"
on-enter-or-tab-key="nextField()">
<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>
<p class="col-xs-12">
<small>{{field.description}}</small>
</p>
</div>
<div class="col-xs-12 field-input">
<input-stars max="{{field.ratingOptions.steps}}"
on-star-click="$root.nextField()"
icon-full="{{field.ratingOptions.shape}}"
icon-base="fa fa-3x"
icon-empty="{{field.ratingOptions.shape}}"
ng-model="field.fieldValue"
ng-model-options="{ debounce: 250 }"
ng-required="field.required"
on-enter-or-tab-key="nextField()"
on-tab-and-shift-key="prevField()"
ng-focus="setActiveField(field._id, index, true)"
class="angular-input-stars focusOn">
</input-stars>
</div>
</div>

View file

@ -1,24 +0,0 @@
<div class="statement field row"
on-enter-or-tab-key="nextField()"
on-tab-and-shift-key="prevField()"
ng-focus="setActiveField(field._id, index, true)">
<div class="row field-title field-title">
<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>
<p class="col-xs-12">
<small>{{field.description}}</small>
</p>
</div>
<div class="row field-title field-input">
<p class="col-xs-12" ng-if="field.description.length">{{field.description}} </p>
<br>
<div class="col-xs-offset-1 col-xs-11">
<button class="btn focusOn"
ng-style="{'font-size': '1.3em', 'background-color':design.colors.buttonColor, 'color':design.colors.buttonTextColor}"
ng-focused="setActiveField(field._id, index, true)"
ng-click="$root.nextField()">
{{ 'CONTINUE' | translate }}
</button>
</div>
</div>
</div>

View file

@ -1,49 +0,0 @@
<div class="field row" 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>
<small>{{ 'NEWLINE' | translate }}</small>
<p>
<small>{{field.description}}</small>
</p>
</div>
<div class="col-xs-12 field-input">
<small style="font-size:0.6em;">{{ 'NEWLINE' | translate }}</small>
<textarea class="textarea focusOn" type="text"
ng-model="field.fieldValue"
ng-model-options="{ debounce: 250 }"
ng-class="{ 'no-border': !!field.fieldValue }"
value="{{field.fieldValue}}"
ng-required="field.required"
ng-focus="setActiveField(field._id, index, true)"
on-enter-or-tab-key="nextField()"
on-tab-and-shift-key="prevField()"
style="border: none; border-left: lightgrey dashed 2px;">
</textarea>
</div>
</div>
<div>
<div class="btn btn-lg btn-default"
style="padding: 4px; margin-top:8px; background: rgba(255,255,255,0.5)">
<button ng-disabled="!field.fieldValue || forms.myForm.{{field.fieldType}}{{$index}}.$invalid"
ng-style="{'background-color':design.colors.buttonColor, 'color':design.colors.buttonTextColor}"
ng-click="$root.nextField()"
class="btn col-sm-5 col-xs-5">
{{ 'OK' | translate }} <i class="fa fa-check"></i>
</button>
<div class="col-sm-3 col-xs-6" style="margin-top:0.2em">
<small style="color:#ddd; font-size:70%">
{{ 'ENTER' | translate }}
</small>
</div>
</div>
</div>

View file

@ -1,65 +0,0 @@
<div class="textfield field row"
ng-click="setActiveField(field._id, index, true)">
<div class="col-xs-12 field-title row-fluid" ng-style="{'color': design.colors.questionColor}">
<h3 class="col-xs-12">
<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>
<p class="col-xs-12">
<small>{{field.description}}</small>
</p>
</div>
<div class="col-xs-12 field-input">
<input ng-style="{'color': design.colors.answerColor, 'border-color': design.colors.answerColor}"
name="{{field.fieldType}}{{index}}"
type="{{input_type}}"
ng-pattern="validateRegex"
placeholder="{{placeholder}}"
ng-class="{ 'no-border': !!field.fieldValue }"
class="focusOn text-field-input"
ng-model="field.fieldValue"
ng-model-options="{ debounce: 250 }"
value="field.fieldValue"
ng-focus="setActiveField(field._id, index, true)"
on-enter-or-tab-key="nextField()"
on-tab-and-shift-key="prevField()"
ng-required="field.required"
aria-describedby="inputError2Status">
</div>
<div class="col-xs-12">
<div ng-show="forms.myForm.{{field.fieldType}}{{index}}.$invalid && !!forms.myForm.{{field.fieldType}}{{index}}.$viewValue " class="alert alert-danger" role="alert">
<span class="glyphicon glyphicon-exclamation-sign" aria-hidden="true"></span>
<span class="sr-only">Error:</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 == 'link'"> {{ 'ERROR_URL_INVALID' | translate }} </span>
</div>
</div>
</div>
<div>
<div class="btn btn-lg btn-default"
style="padding: 4px; margin-top:8px; background: rgba(255,255,255,0.5)">
<button ng-disabled="!field.fieldValue || forms.myForm.{{field.fieldType}}{{$index}}.$invalid"
ng-style="{'background-color':design.colors.buttonColor, 'color':design.colors.buttonTextColor}"
ng-click="$root.nextField()"
class="btn col-sm-5 col-xs-5">
{{ 'OK' | translate }} <i class="fa fa-check"></i>
</button>
<div class="col-xs-6 col-sm-3" style="margin-top:0.2em">
<small style="color:#ddd; font-size:70%">
{{ 'ENTER' | translate }}
</small>
</div>
</div>
</div>

View file

@ -1,63 +0,0 @@
<div class="field row radio"
ng-click="setActiveField(field._id, index, true)"
on-tab-and-shift-key="prevField()"
key-to-truthy key-char-truthy="y" key-char-falsey="n" field="field">
<div class="col-xs-12 field-title" ng-style="{'color': design.colors.questionColor}">
<h3 class="row">
<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>
<p class="row">
{{field.description}}
</p>
</div>
<div class="col-xs-12 field-input">
<div class="row col-xs-12">
<label class="btn btn-default"
style="background: rgba(0,0,0,0.1); text-align:left;">
<input type="radio" value="true"
class="focusOn"
style="opacity: 0; margin-left: 0px;"
ng-model="field.fieldValue"
ng-focus="setActiveField(field._id, index, true)"
ng-model-options="{ debounce: 250 }"
ng-required="field.required"
ng-change="$root.nextField()"
/>
<div class="letter">
{{ 'Y' | translate }}
</div>
<span>{{ 'YES' | translate }}</span>
<i ng-show="field.fieldValue === 'true'" class="fa fa-check" aria-hidden="true"></i>
</label>
</div>
<div class="row col-xs-12" style="margin-top: 10px;">
<label class="btn btn-default"
style="background: rgba(0,0,0,0.1); text-align:left;">
<input type="radio" value="false"
style="opacity:0; margin-left:0px;"
ng-model="field.fieldValue"
ng-model-options="{ debounce: 250 }"
ng-required="field.required"
ng-change="$root.nextField()"
/>
<div class="letter">
{{ 'N' | translate }}
</div>
<span>{{ 'NO' | translate }}</span>
<i ng-show="field.fieldValue === 'false'" class="fa fa-check" aria-hidden="true"></i>
</label>
</div>
</div>
</div>
<br>

View file

@ -1,202 +0,0 @@
<section class="overlay submitform" ng-if="!ispreview && (loading || (!myform.submitted && !myform.startPage.showStart))"></section>
<section class="overlay previewform submitform" ng-if="ispreview && (loading || (!myform.submitted && !myform.startPage.showStart))"></section>
<!-- Start Page View -->
<div ng-show="!myform.submitted && myform.startPage.showStart"
class="form-submitted"
style="padding-top: 35vh;">
<div class="row">
<div class="col-xs-12 text-center" style="overflow-wrap: break-word;">
<h1 style="font-weight: 400; nont-size: 25px;">
{{myform.startPage.introTitle}}
</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.startPage.introParagraph}}
</p>
</div>
</div>
<div class="row form-actions text-center" style="padding: 5px 25px 5px 25px;">
<button ng-click="exitStartPage()" class="btn" type="button"
ng-style="{'background-color':myform.design.colors.buttonColor, 'color':myform.design.colors.buttonTextColor}">
<span style="font-size: 1.6em;">
{{myform.startPage.introButtonText}}
</span>
</button>
</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" 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>
</div>
<!-- Form Fields View -->
<div class="form-fields" ng-show="!myform.submitted && !myform.startPage.showStart"
ng-style="{ 'border-color': myform.design.colors.buttonTextColor }">
<div class="row">
<form name="forms.myForm"
novalidate
class="submission-form col-sm-12 col-md-offset-1 col-md-10">
<div ng-repeat="field in myform.form_fields"
ng-if="!field.deletePreserved"
data-index="{{$index}}"
data-id="{{field._id}}"
ng-class="{activeField: selected._id == field._id }"
class="row field-directive">
<field-directive field="field" design="myform.design" index="$index" forms="forms">
</field-directive>
</div>
</form>
</div>
<div class="row form-actions" id="submit_field"
ng-class="{activeField: selected._id == 'submit_field' }"
ng-style="{ 'background-color':myform.design.colors.buttonColor}"
style="border-top: 1px solid #ddd; margin-right: -13%; margin-left: -13%; margin-top: 30vh; height: 100vh">
<div class="col-xs-12 text-left"
style="background-color:#990000; color:white;"
ng-if="forms.myForm.$invalid">
{{ 'COMPLETING_NEEDED' | translate:translateAdvancementData }}
</div>
<button ng-if="!forms.myForm.$invalid"
class="Button btn col-sm-2 col-xs-8 focusOn"
v-busy="loading" v-busy-label="Please wait" v-pressable
ng-disabled="loading || forms.myForm.$invalid"
ng-click="submitForm()"
on-enter-key="submitForm()"
on-enter-key-disabled="loading || forms.myForm.$invalid"
ng-style="{'background-color':myform.design.colors.buttonColor, 'color':myform.design.colors.buttonTextColor}"
style="font-size: 1.6em; margin-left: 1em; margin-top: 1em;">
{{ 'SUBMIT' | translate }}
</button>
<button ng-if="forms.myForm.$invalid"
class="Button btn col-sm-2 col-xs-8 focusOn"
ng-click="goToInvalid()"
on-enter-key="goToInvalid()"
on-enter-key-disabled="!forms.myForm.$invalid"
style="font-size: 1.6em; margin-left: 1em; margin-top: 1em; background-color:#990000; color:white">
{{ 'REVIEW' | translate }}
</button>
<div class="col-sm-2 hidden-xs" style="font-size: 75%; margin-top:3.25em">
<small>
{{ 'ENTER' | translate }}
</small>
</div>
</div>
<section ng-if="!myform.hideFooter" class="navbar navbar-fixed-bottom"
ng-style="{ 'background-color':myform.design.colors.buttonColor, 'padding-top': '15px', 'border-top': '2px '+ myform.design.colors.buttonTextColor +' solid', 'color':myform.design.colors.buttonTextColor}">
<div class="container-fluid">
<div class="row">
<div class="col-sm-5 col-md-6 col-xs-5" ng-show="!myform.submitted">
<p class="lead">{{ 'ADVANCEMENT' | translate:translateAdvancementData }}</p>
</div>
<div class="col-md-6 col-md-offset-0 col-sm-offset-2 col-sm-3 col-xs-offset-1 col-xs-6 row">
<div class="col-md-4 col-md-offset-2 hidden-sm hidden-xs" ng-if="!authentication.isAuthenticated()">
<a href="/#!/forms" class="btn"
ng-style="{'background-color':myform.design.colors.buttonColor, 'color':myform.design.colors.buttonTextColor}">
{{ 'CREATE_FORM' | translate }}
</a>
</div>
<div class="col-md-4 col-md-offset-2 hidden-sm hidden-xs" ng-if="authentication.isAuthenticated()">
<a href="/#!/forms/{{myform._id}}/admin/create"
ng-style="{'background-color':myform.design.colors.buttonColor, 'color':myform.design.colors.buttonTextColor}"
class="btn">
{{ 'EDIT_FORM' | translate }}
</a>
</div>
<div class="col-md-4 col-sm-10 col-md-offset-0 col-sm-offset-2 col-xs-12 row">
<button class="btn btn-lg col-xs-6" id="focusDownButton"
ng-style="{'background-color':myform.design.colors.buttonColor, 'color':myform.design.colors.buttonTextColor}"
ng-click="nextField()"
ng-disabled="selected.index > myform.form_fields.length-1">
<i class="fa fa-chevron-down"></i>
</button>
<button class="btn btn-lg col-xs-6" id="focusUpButton"
ng-style="{'background-color':myform.design.colors.buttonColor, 'color':myform.design.colors.buttonTextColor}"
ng-click="prevField()"
ng-disabled="selected.index == 0">
<i class="fa fa-chevron-up"></i>
</button>
</div>
</div>
</div>
</div>
</section>
</div>
<!-- Default End Page View -->
<div ng-if="myform.submitted && !loading && !myform.endPage.showEnd" class="form-submitted"
ng-style="{'color':myform.design.colors.buttonTextColor}"
style="padding-top: 5vh;">
<div class="field row text-center">
<div class="col-xs-12 col-sm-12 col-md-6 col-md-offset-3 text-center">{{ 'FORM_SUCCESS' | translate }}</div>
</div>
<div class="row form-actions">
<p class="text-center">
<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;"> {{ 'BACK_TO_FORM' | translate }}</span>
</button>
</p>
</div>
</div>
<!-- Custom End Page View -->
<div ng-if="myform.submitted && !loading && myform.endPage.showEnd" class="form-submitted"
ng-style="{'color':myform.design.colors.buttonTextColor}"
style="padding-top: 5vh;">
<div class="row">
<div class="col-xs-12 text-center" style="overflow-wrap: break-word;">
<h1 style="font-weight: 400; nont-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>
</div>

View file

@ -1,15 +0,0 @@
<section class="public-form" ng-style="{ 'background-color': myform.design.colors.backgroundColor }">
<submit-form-directive myform="myform"></submit-form-directive>
</section>
<!-- User's Google Analytics -->
<script ng-if="myform.analytics.gaCode">
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','https://www.google-analytics.com/analytics.js','ga');
ga('create', '{{myform.analytics.gaCode}}', 'auto');
ga('send', 'pageview');
</script>
<!-- End Google Analytics -->

10
config/env/all.js vendored
View file

@ -96,17 +96,21 @@ module.exports = {
'!public/modules/**/dist/**/*.css',
'!public/modules/**/node_modules/**/*.css'
],
//Order matters here as some directives in form_modules override those in modules
js: [
'public/config.js',
'public/application.js',
'public/dist/populate_template_cache.js',
'public/form_modules/forms/*.js',
'public/form_modules/forms/base/**/*.js',
'!public/modules/forms/base/**/*.js',
'public/modules/*/*.js',
'public/modules/*/*/*.js',
'public/modules/*/*/*/*.js',
'public/modules/*/*/*/*/*.js',
'public/form_modules/forms/*.js',
'public/form_modules/forms/directives/*.js',
'public/form_modules/forms/base/config/*.js',
'public/form_modules/forms/base/config/*/*.js',
'public/form_modules/forms/base/**/*.js',
'!public/modules/forms/base/**/*.js',
'!public/modules/**/tests/**/*.js'
],
form_js: [

View file

@ -71,6 +71,7 @@ module.exports = function(db) {
app.locals.bowerOtherFiles = config.getBowerOtherAssets();
app.locals.jsFiles = config.getJavaScriptAssets();
console.log(app.locals.jsFiles);
app.locals.formJSFiles = config.getFormJavaScriptAssets();
app.locals.cssFiles = config.getCSSAssets();

View file

@ -9,8 +9,8 @@ jsep.addBinaryOp('!begins', 10);
jsep.addBinaryOp('ends', 10);
jsep.addBinaryOp('!ends', 10);
angular.module('view-form').directive('submitFormDirective', ['$http', 'TimeCounter', '$filter', '$rootScope', 'SendVisitorData',
function ($http, TimeCounter, $filter, $rootScope, SendVisitorData) {
angular.module('view-form').directive('submitFormDirective', ['$http', 'TimeCounter', '$filter', '$rootScope', 'SendVisitorData', '$translate',
function ($http, TimeCounter, $filter, $rootScope, SendVisitorData, $translate) {
return {
templateUrl: '/static/form_modules/forms/base/views/directiveViews/form/submit-form.client.view.html',
restrict: 'E',
@ -28,19 +28,23 @@ angular.module('view-form').directive('submitFormDirective', ['$http', 'TimeCoun
}
var form_fields_count = $scope.myform.visible_form_fields.filter(function(field){
if(field.fieldType === 'statement'){
return false;
}
return true;
return field.fieldType !== 'statement';
}).length;
var nb_valid = $filter('formValidity')($scope.myform);
$scope.translateAdvancementData = {
done: nb_valid,
total: form_fields_count,
answers_not_completed: form_fields_count - nb_valid
};
console.log('$scope.translateAdvancementData: ');
console.log($filter('translate')('CREATE_A_NEW_FORM'));
console.log( $translate('COMPLETING_NEEDED', {
answers_not_completed: $scope.translateAdvancementData.answers_not_completed
} ) );
$scope.reloadForm = function(){
//Reset Form
$scope.myform.submitted = false;

View file

@ -2,133 +2,94 @@
<section class="overlay previewform submitform" ng-if="ispreview && (loading || (!myform.submitted && !myform.startPage.showStart))"></section>
<!-- Start Page View -->
<div ng-show="!myform.submitted && myform.startPage.showStart"
class="form-submitted"
style="padding-top: 35vh;">
<div class="row">
<div class="col-xs-12 text-center" style="overflow-wrap: break-word;">
<h1 style="font-weight: 400; nont-size: 25px;">
{{myform.startPage.introTitle}}
</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.startPage.introParagraph}}
</p>
</div>
</div>
<div ng-show="!myform.submitted && myform.startPage.showStart" class="form-submitted" style="padding-top: 35vh;">
<div class="row">
<div class="col-xs-12 text-center" style="overflow-wrap: break-word;">
<h1 style="font-weight: 400; nont-size: 25px;">
{{myform.startPage.introTitle}}
</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.startPage.introParagraph}}
</p>
</div>
</div>
<div class="row form-actions text-center" style="padding: 5px 25px 5px 25px;">
<button ng-click="exitStartPage()" class="btn" type="button"
ng-style="{'background-color':myform.design.colors.buttonColor, 'color':myform.design.colors.buttonTextColor}">
<span style="font-size: 1.6em;">
{{myform.startPage.introButtonText}}
</span>
</button>
</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" 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>
<div class="row form-actions text-center" style="padding: 5px 25px 5px 25px;">
<button ng-click="exitStartPage()" class="btn" type="button" ng-style="{'background-color':myform.design.colors.buttonColor, 'color':myform.design.colors.buttonTextColor}">
<span style="font-size: 1.6em;">
{{myform.startPage.introButtonText}}
</span>
</button>
</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" 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>
</div>
<!-- Form Fields View -->
<div class="form-fields" ng-show="!myform.submitted && !myform.startPage.showStart"
ng-style="{ 'border-color': myform.design.colors.buttonTextColor }">
<div class="form-fields" ng-show="!myform.submitted && !myform.startPage.showStart" ng-style="{ 'border-color': myform.design.colors.buttonTextColor }">
<div class="row">
<form name="forms.myForm"
novalidate
class="submission-form col-sm-12 col-md-offset-1 col-md-10">
<div class="row">
<form name="forms.myForm" novalidate class="submission-form col-sm-12 col-md-offset-1 col-md-10">
<div ng-repeat="field in myform.form_fields"
ng-if="!field.deletePreserved"
data-index="{{$index}}"
data-id="{{field._id}}"
ng-class="{activeField: selected._id == field._id }"
class="row field-directive">
<div ng-repeat="field in myform.form_fields" ng-if="!field.deletePreserved" data-index="{{$index}}" data-id="{{field._id}}" ng-class="{activeField: selected._id == field._id }" class="row field-directive">
<field-directive field="field" design="myform.design" index="$index" forms="forms">
</field-directive>
</div>
<field-directive field="field" design="myform.design" index="$index" forms="forms">
</field-directive>
</div>
</form>
</div>
</form>
</div>
<div class="row form-actions" id="submit_field" ng-class="{activeField: selected._id == 'submit_field' }" ng-style="{ 'background-color':myform.design.colors.buttonColor}" style="border-top: 1px solid #ddd; margin-right: -13%; margin-left: -13%; margin-top: 30vh; height: 100vh">
<div class="col-xs-12 text-left" style="background-color:#990000; color:white;" ng-if="forms.myForm.$invalid">
{{ 'COMPLETING_NEEDED' | translate:translateAdvancementData }}
</div>
<div class="row form-actions" id="submit_field"
ng-class="{activeField: selected._id == 'submit_field' }"
ng-style="{ 'background-color':myform.design.colors.buttonColor}"
style="border-top: 1px solid #ddd; margin-right: -13%; margin-left: -13%; margin-top: 30vh; height: 100vh">
<div class="col-xs-12 text-left"
style="background-color:#990000; color:white;"
ng-if="forms.myForm.$invalid">
{{ 'COMPLETING_NEEDED' | translate:translateAdvancementData }}
</div>
<button ng-if="!forms.myForm.$invalid"
class="Button btn col-sm-2 col-xs-8 focusOn"
v-busy="loading" v-busy-label="Please wait" v-pressable
ng-disabled="loading || forms.myForm.$invalid"
ng-click="submitForm()"
on-enter-key="submitForm()"
on-enter-key-disabled="loading || forms.myForm.$invalid"
ng-style="{'background-color':myform.design.colors.buttonColor, 'color':myform.design.colors.buttonTextColor}"
style="font-size: 1.6em; margin-left: 1em; margin-top: 1em;">
<button ng-if="!forms.myForm.$invalid" class="Button btn col-sm-2 col-xs-8 focusOn" v-busy="loading" v-busy-label="Please wait" v-pressable ng-disabled="loading || forms.myForm.$invalid" ng-click="submitForm()" on-enter-key="submitForm()" on-enter-key-disabled="loading || forms.myForm.$invalid" ng-style="{'background-color':myform.design.colors.buttonColor, 'color':myform.design.colors.buttonTextColor}" style="font-size: 1.6em; margin-left: 1em; margin-top: 1em;">
{{ 'SUBMIT' | translate }}
</button>
<button ng-if="forms.myForm.$invalid"
class="Button btn col-sm-2 col-xs-8 focusOn"
ng-click="goToInvalid()"
on-enter-key="goToInvalid()"
on-enter-key-disabled="!forms.myForm.$invalid"
style="font-size: 1.6em; margin-left: 1em; margin-top: 1em; background-color:#990000; color:white">
<button ng-if="forms.myForm.$invalid" class="Button btn col-sm-2 col-xs-8 focusOn" ng-click="goToInvalid()" on-enter-key="goToInvalid()" on-enter-key-disabled="!forms.myForm.$invalid" style="font-size: 1.6em; margin-left: 1em; margin-top: 1em; background-color:#990000; color:white">
{{ 'REVIEW' | translate }}
</button>
<div class="col-sm-2 hidden-xs" style="font-size: 75%; margin-top:3.25em">
<small>
<div class="col-sm-2 hidden-xs" style="font-size: 75%; margin-top:3.25em">
<small>
{{ 'ENTER' | translate }}
</small>
</div>
</div>
</div>
</div>
<section ng-if="!myform.hideFooter" class="navbar navbar-fixed-bottom"
ng-style="{ 'background-color':myform.design.colors.buttonColor, 'padding-top': '15px', 'border-top': '2px '+ myform.design.colors.buttonTextColor +' solid', 'color':myform.design.colors.buttonTextColor}">
<section ng-if="!myform.hideFooter" class="navbar navbar-fixed-bottom" ng-style="{ 'background-color':myform.design.colors.buttonColor, 'padding-top': '15px', 'border-top': '2px '+ myform.design.colors.buttonTextColor +' solid', 'color':myform.design.colors.buttonTextColor}">
<div class="container-fluid">
<div class="row">
<div class="col-sm-5 col-md-6 col-xs-5" ng-show="!myform.submitted">
<p class="lead">{{ 'ADVANCEMENT' | translate:translateAdvancementData }}</p>
<p class="lead">{{ 'ADVANCEMENT' | translate:translateAdvancementData }}</p>
</div>
<div class="col-md-6 col-md-offset-0 col-sm-offset-2 col-sm-3 col-xs-offset-1 col-xs-6 row">
<div class="col-md-4 col-md-offset-2 hidden-sm hidden-xs">
<a href="/#!/forms" class="btn"
ng-style="{'background-color':myform.design.colors.buttonColor, 'color':myform.design.colors.buttonTextColor}">
<a href="/#!/forms" class="btn" ng-style="{'background-color':myform.design.colors.buttonColor, 'color':myform.design.colors.buttonTextColor}">
{{ 'CREATE_FORM' | translate }}
</a>
</div>
<div class="col-md-4 col-sm-10 col-md-offset-0 col-sm-offset-2 col-xs-12 row">
<button class="btn btn-lg col-xs-6" id="focusDownButton"
ng-style="{'background-color':myform.design.colors.buttonColor, 'color':myform.design.colors.buttonTextColor}"
ng-click="nextField()"
ng-disabled="selected.index > myform.form_fields.length-1">
<button class="btn btn-lg col-xs-6" id="focusDownButton" ng-style="{'background-color':myform.design.colors.buttonColor, 'color':myform.design.colors.buttonTextColor}" ng-click="nextField()" ng-disabled="selected.index > myform.form_fields.length-1">
<i class="fa fa-chevron-down"></i>
</button>
<button class="btn btn-lg col-xs-6" id="focusUpButton"
ng-style="{'background-color':myform.design.colors.buttonColor, 'color':myform.design.colors.buttonTextColor}"
ng-click="prevField()"
ng-disabled="selected.index == 0">
<button class="btn btn-lg col-xs-6" id="focusUpButton" ng-style="{'background-color':myform.design.colors.buttonColor, 'color':myform.design.colors.buttonTextColor}" ng-click="prevField()" ng-disabled="selected.index == 0">
<i class="fa fa-chevron-up"></i>
</button>
</div>
@ -138,59 +99,52 @@ ng-style="{'color':button.color}">
</section>
</div>
<!-- Default End Page View -->
<div ng-if="myform.submitted && !loading && !myform.endPage.showEnd" class="form-submitted"
ng-style="{'color':myform.design.colors.buttonTextColor}"
style="padding-top: 5vh;">
<div ng-if="myform.submitted && !loading && !myform.endPage.showEnd" class="form-submitted" ng-style="{'color':myform.design.colors.buttonTextColor}" style="padding-top: 5vh;">
<div class="field row text-center">
<div class="col-xs-12 col-sm-12 col-md-6 col-md-offset-3 text-center">{{ 'FORM_SUCCESS' | translate }}</div>
</div>
<div class="row form-actions">
<p class="text-center">
<button ng-click="reloadForm()" class="btn" type="button"
ng-style="{'background-color':myform.design.colors.buttonColor, 'color':myform.design.colors.buttonTextColor}">
<div class="field row text-center">
<div class="col-xs-12 col-sm-12 col-md-6 col-md-offset-3 text-center">{{ 'FORM_SUCCESS' | translate }}</div>
</div>
<div class="row form-actions">
<p class="text-center">
<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;"> {{ 'BACK_TO_FORM' | translate }}</span>
</button>
</p>
</div>
</p>
</div>
</div>
<!-- Custom End Page View -->
<div ng-if="myform.submitted && !loading && myform.endPage.showEnd" class="form-submitted"
ng-style="{'color':myform.design.colors.buttonTextColor}"
style="padding-top: 5vh;">
<div class="row">
<div class="col-xs-12 text-center" style="overflow-wrap: break-word;">
<h1 style="font-weight: 400; nont-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 ng-if="myform.submitted && !loading && myform.endPage.showEnd" class="form-submitted" ng-style="{'color':myform.design.colors.buttonTextColor}" style="padding-top: 5vh;">
<div class="row">
<div class="col-xs-12 text-center" style="overflow-wrap: break-word;">
<h1 style="font-weight: 400; nont-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}">
<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}">
</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>
</div>
</p>
</div>
</div>

View file

@ -137,33 +137,60 @@ angular.module('forms').config(['$translateProvider', function ($translateProvid
BTN_BACKGROUND_COLOR: 'Button Background Color',
BTN_TEXT_COLOR: 'Button Text Color',
//Share View
EMBED_YOUR_FORM: 'Embed your form',
SHARE_YOUR_FORM: 'Share your form',
//Share View
EMBED_YOUR_FORM: 'Embed your form',
SHARE_YOUR_FORM: 'Share your form',
//Admin Tabs
CREATE_TAB: 'Create',
DESIGN_TAB: 'Design',
CONFIGURE_TAB: 'Configure',
ANALYZE_TAB: 'Analyze',
SHARE_TAB: 'Share',
SHARE_TAB: 'Share',
//Field Types
SHORT_TEXT: 'Short Text',
EMAIL: 'Email',
MULTIPLE_CHOICE: 'Multiple Choice',
DROPDOWN: 'Dropdown',
DATE: 'Date',
PARAGRAPH_T: 'Paragraph',
YES_NO: 'Yes/No',
LEGAL: 'Legal',
RATING: 'Rating',
NUMBERS: 'Numbers',
SIGNATURE: 'Signature',
FILE_UPLOAD: 'File upload',
OPTION_SCALE: 'Option Scale',
PAYMENT: 'Payment',
STATEMENT: 'Statement',
LINK: 'Link'
//Field Types
SHORT_TEXT: 'Short Text',
EMAIL: 'Email',
MULTIPLE_CHOICE: 'Multiple Choice',
DROPDOWN: 'Dropdown',
DATE: 'Date',
PARAGRAPH_T: 'Paragraph',
YES_NO: 'Yes/No',
LEGAL: 'Legal',
RATING: 'Rating',
NUMBERS: 'Numbers',
SIGNATURE: 'Signature',
FILE_UPLOAD: 'File upload',
OPTION_SCALE: 'Option Scale',
PAYMENT: 'Payment',
STATEMENT: 'Statement',
LINK: 'Link',
//Form Preview
FORM_SUCCESS: 'Form entry successfully submitted!',
REVIEW: 'Review',
BACK_TO_FORM: 'Go back to Form',
EDIT_FORM: 'Edit this TellForm',
CREATE_FORM: 'Create this TellForm',
ADVANCEMENT: '{{done}} out of {{total}} answered',
CONTINUE_FORM: 'Continue to Form',
REQUIRED: 'required',
COMPLETING_NEEDED: '{{answers_not_completed}} answer(s) need completing',
OPTIONAL: 'optional',
ERROR_EMAIL_INVALID: 'Please enter a valid email address',
ERROR_NOT_A_NUMBER: 'Please enter valid numbers only',
ERROR_URL_INVALID: 'Please a valid url',
OK: 'OK',
ENTER: 'press ENTER',
YES: 'Yes',
NO: 'No',
NEWLINE: 'press SHIFT+ENTER to create a newline',
CONTINUE: 'Continue',
LEGAL_ACCEPT: 'I accept',
LEGAL_NO_ACCEPT: 'I dont accept',
DELETE: 'Delete',
CANCEL: 'Cancel',
SUBMIT: 'Submit',
UPLOAD_FILE: 'Upload your File',
});
}]);

View file

@ -1,8 +1,8 @@
'use strict';
angular.module('forms').config(['$translateProvider', function ($translateProvider) {
angular.module('view-form').config(['$translateProvider', function ($translateProvider) {
$translateProvider.translations('fr', {
$translateProvider.translations('french', {
FORM_SUCCESS: 'Votre formulaire a été enregistré!',
REVIEW: 'Incomplet',
BACK_TO_FORM: 'Retourner au formulaire',
@ -29,7 +29,7 @@ angular.module('forms').config(['$translateProvider', function ($translateProvid
SUBMIT: 'Enregistrer',
UPLOAD_FILE: 'Envoyer un fichier',
Y: 'O',
N: 'N'
N: 'N',
});
}]);

View file

@ -1,13 +1,13 @@
'use strict';
angular.module('forms').config(['$translateProvider', function ($translateProvider) {
angular.module('view-form').config(['$translateProvider', function ($translateProvider) {
$translateProvider.translations('de', {
$translateProvider.translations('german', {
FORM_SUCCESS: 'Ihre Angaben wurden gespeichert.',
REVIEW: 'Unvollständig',
BACK_TO_FORM: 'Zurück zum Formular',
EDIT_FORM: 'Bearbeiten Sie diese TellForm',
CREATE_FORM: 'Erstellen Sie eine TellForm',
EDIT_FORM: '',
CREATE_FORM: '',
ADVANCEMENT: '{{done}} von {{total}} beantwortet',
CONTINUE_FORM: 'Zum Formular',
REQUIRED: 'verpflichtend',
@ -22,14 +22,14 @@ angular.module('forms').config(['$translateProvider', function ($translateProvid
NO: 'Nein',
NEWLINE: 'Für eine neue Zeile SHIFT+ENTER drücken',
CONTINUE: 'Weiter',
LEGAL_ACCEPT: 'Ich akzeptiere',
LEGAL_NO_ACCEPT: 'Ich akzeptiere nicht',
LEGAL_ACCEPT: 'I accept',
LEGAL_NO_ACCEPT: 'I dont accept',
DELETE: 'Entfernen',
CANCEL: 'Canceln',
SUBMIT: 'Speichern',
UPLOAD_FILE: 'Datei versenden',
Y: 'J',
N: 'N'
N: 'N',
});
}]);

View file

@ -1,13 +1,13 @@
'use strict';
angular.module('forms').config(['$translateProvider', function ($translateProvider) {
angular.module('view-form').config(['$translateProvider', function ($translateProvider) {
$translateProvider.translations('it', {
$translateProvider.translations('italian', {
FORM_SUCCESS: 'Il formulario è stato inviato con successo!',
REVIEW: 'Incompleto',
BACK_TO_FORM: 'Ritorna al formulario',
EDIT_FORM: 'Modifica questo Tellform',
CREATE_FORM: 'Creare un TellForm',
EDIT_FORM: '',
CREATE_FORM: '',
ADVANCEMENT: '{{done}} su {{total}} completate',
CONTINUE_FORM: 'Vai al formulario',
REQUIRED: 'obbligatorio',
@ -22,14 +22,14 @@ angular.module('forms').config(['$translateProvider', function ($translateProvid
NO: 'No',
NEWLINE: 'premere SHIFT+INVIO per creare una nuova linea',
CONTINUE: 'Continua',
LEGAL_ACCEPT: 'Accetto',
LEGAL_NO_ACCEPT: 'Non accetto',
LEGAL_ACCEPT: 'I accept',
LEGAL_NO_ACCEPT: 'I dont accept',
DELETE: 'Cancella',
CANCEL: 'Reset',
SUBMIT: 'Registra',
UPLOAD_FILE: 'Invia un file',
Y: 'S',
N: 'N'
N: 'N',
});
}]);

View file

@ -146,24 +146,52 @@ angular.module('forms').config(['$translateProvider', function ($translateProvid
DESIGN_TAB: 'Diseño',
CONFIGURE_TAB: 'Configuración',
ANALYZE_TAB: 'Análisis',
SHARE_TAB: 'Compartir',
SHARE_TAB: 'Compartir',
//Field Types
SHORT_TEXT: 'Texto corto',
EMAIL: 'Email',
MULTIPLE_CHOICE: 'Opciones múltiples',
DROPDOWN: 'Desplegable',
DATE: 'Fecha',
PARAGRAPH_T: 'Párrafo',
YES_NO: 'Si/No',
LEGAL: 'Legal',
RATING: 'Puntaje',
NUMBERS: 'Números',
SIGNATURE: 'Firma',
FILE_UPLOAD: 'Subir archivo',
OPTION_SCALE: 'Escala',
PAYMENT: 'Pago',
STATEMENT: 'Declaración',
LINK: 'Enlace'
//Field Types
SHORT_TEXT: 'Texto corto',
EMAIL: 'Email',
MULTIPLE_CHOICE: 'Opciones múltiples',
DROPDOWN: 'Desplegable',
DATE: 'Fecha',
PARAGRAPH_T: 'Párrafo',
YES_NO: 'Si/No',
LEGAL: 'Legal',
RATING: 'Puntaje',
NUMBERS: 'Números',
SIGNATURE: 'Firma',
FILE_UPLOAD: 'Subir archivo',
OPTION_SCALE: 'Escala',
PAYMENT: 'Pago',
STATEMENT: 'Declaración',
LINK: 'Enlace',
FORM_SUCCESS: '¡El formulario ha sido enviado con éxito!',
REVIEW: 'Revisar',
BACK_TO_FORM: 'Regresar al formulario',
EDIT_FORM: '',
CREATE_FORM: '',
ADVANCEMENT: '{{done}} de {{total}} contestadas',
CONTINUE_FORM: 'Continuar al formulario',
REQUIRED: 'Información requerida',
COMPLETING_NEEDED: '{{answers_not_completed}} respuesta(s) necesita(n) ser completada(s)',
OPTIONAL: 'Opcional',
ERROR_EMAIL_INVALID: 'Favor de proporcionar un correo electrónico válido',
ERROR_NOT_A_NUMBER: 'Por favor, introduzca sólo números válidos',
ERROR_URL_INVALID: 'Favor de proporcionar un url válido',
OK: 'OK',
ENTER: 'pulse INTRO',
YES: 'Si',
NO: 'No',
NEWLINE: 'presione SHIFT+INTRO para crear una nueva línea',
CONTINUE: 'Continuar',
LEGAL_ACCEPT: 'Yo acepto',
LEGAL_NO_ACCEPT: 'Yo no acepto',
DELETE: 'Eliminar',
CANCEL: 'Cancelar',
SUBMIT: 'Registrar',
UPLOAD_FILE: 'Cargar el archivo',
Y: 'S',
N: 'N'
});
}]);

View file

@ -339,12 +339,12 @@ angular.module('forms').directive('editFormDirective', ['$rootScope', 'FormField
};
$scope.duplicateField = function(field_index){
var currField = _.cloneDeep($scope.myform.form_fields[field_index]);
var currField = angular.copy($scope.myform.form_fields[field_index]);
currField._id = 'cloned'+_.uniqueId();
currField.title += ' copy';
//Insert field at selected index
$scope.myform.form_fields.splice(field_index+1, 0, currField);
$scope.myform.form_fields.push(currField);
$scope.update(false, $scope.myform, false, true, null);
};

View file

@ -171,8 +171,8 @@
</div>
</div>
<div class="col-sm-8 hidden-xs">
<div class="public-form preview" ng-style="{ 'background-color': myform.design.colors.backgroundColor }">
<submit-form-directive myform="myform" ispreview="true"></submit-form-directive>
<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>

View file

@ -543,7 +543,7 @@
<div class="panel-group dropzone col-xs-12" ui-sortable="sortableOptions" ng-model="myform.form_fields">
<div class="col-xs-12 field-row" ng-repeat="field in myform.form_fields track by $index" ng-if="!field.deletePreserved">
<div class="col-xs-12 field-row" ng-repeat="field in myform.form_fields track by $id($index)" ng-if="!field.deletePreserved">
<div class="col-xs-10">
<div class="panel panel-default" ng-click="openEditModal(field)">
<div class="panel-heading">

View file

@ -346,11 +346,6 @@ section.public-form .btn {
background-color: rgba(256,256,256,0.8);
}
/*Modal overlay for live preview in Design Tab of Admin Form page*/
.overlay.previewform {
position: absolute;
}
.field-directive {
z-index: 9;
padding: 10% 10% 10% 0;

View file

@ -11,7 +11,7 @@ angular.module('forms').config(['$stateProvider',
templateUrl: 'modules/forms/admin/views/list-forms.client.view.html'
}).state('submitForm', {
url: '/forms/:formId',
templateUrl: 'modules/forms/base/views/submit-form.client.view.html',
templateUrl: '/static/form_modules/forms/base/views/submit-form.client.view.html',
data: {
hideNav: true
},
@ -35,7 +35,7 @@ angular.module('forms').config(['$stateProvider',
permissions: [ 'editForm' ]
},
resolve: {
Forms: 'GetForms',
GetForms: 'GetForms',
myForm: function (GetForms, $stateParams, $q) {
var deferred = $q.defer();
GetForms.get({formId: $stateParams.formId}, function(resolvedForm){

View file

@ -1,29 +0,0 @@
(function () {
'use strict';
//Dummy Service for Previewing Form
function SendVisitorData() {
// Create a controller method for sending visitor data
function send(form, lastActiveIndex) {
}
function init(){
}
var service = {
send: send
};
init();
return service;
}
// Create the SendVisitorData service
angular
.module('forms')
.factory('SendVisitorData', SendVisitorData);
SendVisitorData.$inject = [];
}());

View file

@ -1,26 +0,0 @@
'use strict';
angular.module('forms').directive('keyToOption', function(){
return {
restrict: 'A',
scope: {
field: '='
},
link: function($scope, $element, $attrs, $select) {
$element.bind('keydown keypress', function(event) {
var keyCode = event.which || event.keyCode;
var index = parseInt(String.fromCharCode(keyCode))-1;
//console.log($scope.field);
if (index < $scope.field.fieldOptions.length) {
event.preventDefault();
$scope.$apply(function () {
$scope.field.fieldValue = $scope.field.fieldOptions[index].option_value;
});
}
});
}
};
});

View file

@ -1,30 +0,0 @@
'use strict';
angular.module('forms').directive('keyToTruthy', ['$rootScope', function($rootScope){
return {
restrict: 'A',
scope: {
field: '='
},
link: function($scope, $element, $attrs) {
$element.bind('keydown keypress', function(event) {
var keyCode = event.which || event.keyCode;
var truthyKeyCode = $attrs.keyCharTruthy.charCodeAt(0) - 32;
var falseyKeyCode = $attrs.keyCharFalsey.charCodeAt(0) - 32;
if(keyCode === truthyKeyCode ) {
event.preventDefault();
$scope.$apply(function() {
$scope.field.fieldValue = 'true';
});
}else if(keyCode === falseyKeyCode){
event.preventDefault();
$scope.$apply(function() {
$scope.field.fieldValue = 'false';
});
}
});
}
};
}]);