2016-06-08 23:12:48 +00:00
'use strict' ;
// Init the application configuration module for AngularJS application
var ApplicationConfiguration = ( function ( ) {
// Init module configuration options
2017-09-30 00:33:55 +00:00
var applicationModuleName = 'TellForm' ;
var applicationModuleVendorDependencies = [ 'duScroll' , 'ui.select' , 'ngSanitize' , 'vButton' , 'ngResource' , 'TellForm.templates' , 'ui.router' , 'ui.bootstrap' , 'ui.utils' , 'pascalprecht.translate' , 'view-form' ] ;
2016-06-08 23:12:48 +00:00
// Add a new vertical module
var registerModule = function ( moduleName , dependencies ) {
// Create angular module
angular . module ( moduleName , dependencies || [ ] ) ;
// Add the module to the AngularJS configuration file
angular . module ( applicationModuleName ) . requires . push ( moduleName ) ;
} ;
return {
applicationModuleName : applicationModuleName ,
applicationModuleVendorDependencies : applicationModuleVendorDependencies ,
registerModule : registerModule
} ;
} ) ( ) ;
'use strict' ;
//Start by defining the main module and adding the module dependencies
angular . module ( ApplicationConfiguration . applicationModuleName , ApplicationConfiguration . applicationModuleVendorDependencies ) ;
// Setting HTML5 Location Mode
angular . module ( ApplicationConfiguration . applicationModuleName ) . config ( [ '$locationProvider' ,
function ( $locationProvider ) {
$locationProvider . hashPrefix ( '!' ) ;
}
] ) ;
//Permission Constants
angular . module ( ApplicationConfiguration . applicationModuleName ) . constant ( 'APP_PERMISSIONS' , {
viewAdminSettings : 'viewAdminSettings' ,
editAdminSettings : 'editAdminSettings' ,
editForm : 'editForm' ,
viewPrivateForm : 'viewPrivateForm'
} ) ;
2016-06-20 22:06:41 +00:00
2016-06-08 23:12:48 +00:00
//User Role constants
angular . module ( ApplicationConfiguration . applicationModuleName ) . constant ( 'USER_ROLES' , {
admin : 'admin' ,
normal : 'user' ,
superuser : 'superuser'
} ) ;
2016-06-20 22:06:41 +00:00
2016-06-08 23:12:48 +00:00
//form url
angular . module ( ApplicationConfiguration . applicationModuleName ) . constant ( 'FORM_URL' , '/forms/:formId' ) ;
//Then define the init function for starting up the application
angular . element ( document ) . ready ( function ( ) {
//Fixing facebook bug with redirect
if ( window . location . hash === '#_=_' ) window . location . hash = '#!' ;
//Then init the app
angular . bootstrap ( document , [ ApplicationConfiguration . applicationModuleName ] ) ;
} ) ;
2017-08-02 22:30:12 +00:00
angular . module ( 'TellForm.templates' , [ ] ) . run ( [ '$templateCache' , function ( $templateCache ) {
2017-07-26 20:41:53 +00:00
"use strict" ;
$templateCache . put ( "modules/core/views/header.client.view.html" ,
2017-08-02 22:30:12 +00:00
"<section class=\"navbar navbar-inverse\" data-ng-controller=HeaderController ng-hide=hideNav><div class=container><div class=navbar-header><button class=navbar-toggle type=button data-ng-click=toggleCollapsibleMenu()><span class=sr-only>Toggle navigation</span> <span>{{ 'MENU_BTN' | translate }}</span></button> <a href=\"/#!/\" class=navbar-brand><img src=/static/modules/core/img/logo_white.svg height=100%></a></div><nav class=\"collapse navbar-collapse\" collapse=!isCollapsed role=navigation><ul class=\"nav navbar-nav navbar-right\" data-ng-hide=authentication.isAuthenticated()><li ng-hide=$root.signupDisabled ui-route=/signup ng-class=\"{active: $uiRoute}\"><a href=/#!/signup>{{ 'SIGNUP_TAB' | translate }}</a></li><li class=divider-vertical></li><li ui-route=/signin ng-class=\"{active: $uiRoute}\"><a href=/#!/signin>{{ 'SIGNIN_TAB' | translate }}</a></li></ul><ul class=\"nav navbar-nav navbar-right\" data-ng-show=authentication.isAuthenticated()><li class=dropdown uib-dropdown><a href=# class=dropdown-toggle data-toggle=dropdown dropdown-toggle><span>{{ 'MY_SETTINGS' | translate }}</span> <b class=caret></b></a><ul class=dropdown-menu><li><a href=/#!/settings/profile>{{ 'EDIT_PROFILE' | translate }}</a></li><li class=divider></li><li><a href=/#!/settings/password>{{ 'CHANGE_PASSWORD' | translate }}</a></li></ul></li><li><a href=\"/\" ng-click=signout()>{{ 'SIGNOUT_TAB' | translate }}</a></li></ul></nav></div></section>" ) ;
2017-07-26 20:41:53 +00:00
$templateCache . put ( "modules/forms/admin/views/admin-form.client.view.html" ,
2017-09-30 00:33:55 +00:00
"<header data-ng-include=\"'/static/modules/core/views/header.client.view.html'\"></header><section class=\"admin-form container-fluid\"><script type=text/ng-template id=formDeleteModal.html><div class=\"modal-header\">\n" +
2017-07-26 20:41:53 +00:00
" <h2 class=\"modal-title hidden-md hidden-lg\">{{ 'ARE_YOU_SURE' | translate }}</h2>\n" +
" <h3 class=\"modal-title hidden-xs hidden-sm\">{{ 'ARE_YOU_SURE' | translate }}</h3>\n" +
" </div>\n" +
" <div class=\"modal-body\">\n" +
" <div class=\"modal-body-alert\">\n" +
" {{ 'READ_WARNING' | translate }}\n" +
" </div>\n" +
" <p class=\"hidden-xs hidden-sm\">\n" +
" {{ 'DELETE_WARNING1' | translate }} <strong>{{myform.title}}</strong> {{ 'DELETE_WARNING2' | translate }}\n" +
" </p>\n" +
" <p>{{ 'DELETE_CONFIRM' | translate }}</p>\n" +
" </div>\n" +
" <div class=\"modal-footer\">\n" +
" <input type=\"text\" style=\"width:100%\" data-ng-model=\"deleteConfirm\" class=\"input-block\" autofocus required aria-label=\"Type in the name of the form to confirm that you want to delete this form.\">\n" +
" <button type=\"submit\" ng-click=\"removeCurrentForm()\" class=\"btn btn-block btn-danger\" ng-disabled=\"myform.title != deleteConfirm\">\n" +
" {{ 'I_UNDERSTAND' | translate }}\n" +
" </button>\n" +
2017-10-07 08:34:01 +00:00
" </div></script><div class=\"page-header row\" style=\"padding-bottom: 1em\"><div class=\"col-xs-10 col-sm-8\"><h1 class=\"hidden-sm hidden-xs\" data-ng-bind=myform.title style=\"margin-bottom: 0px\"></h1><h2 class=\"hidden-md hidden-lg\" data-ng-bind=myform.title style=\"margin-bottom: 0px\"></h2></div><div class=\"col-xs-1 col-sm-2\"><small class=pull-right><button class=\"btn btn-danger\" ng-click=openDeleteModal()><i class=\"fa fa-trash-o\"></i> <span class=\"show-sm hidden-lg hidden-md hidden-xs\">{{ 'DELETE_FORM_SM' | translate}}</span> <span class=\"hidden-xs hidden-sm\">{{ 'DELETE_FORM_MD' | translate}}</span></button></small></div><div class=\"col-xs-1 col-sm-2\"><small class=pull-right><a class=\"btn btn-secondary view-form-btn\" href={{actualFormURL}}><span class=\"hidden-xs hidden-sm\">{{ 'VIEW' | translate }} <span ng-show=myform.isLive>{{ 'LIVE' | translate }}</span> <span ng-hide=myform.isLive>{{ 'PREVIEW' | translate }}</span></span> <i class=\"status-light status-light-on fa fa-dot-circle-o\" ng-if=myform.isLive></i> <i class=\"status-light status-light-off fa fa-dot-circle-o\" ng-if=!myform.isLive></i></a></small></div></div><div class=row><div class=col-xs-12><uib-tabset active=activePill vertical=true type=pills><uib-tab index=0 heading=\"{{ 'CREATE_TAB' | translate }}\" select=deactivateDesignTab()><edit-form-directive myform=myform></edit-form-directive></uib-tab><uib-tab ng-repeat=\"tab in tabData\" index={{$index+1}} heading={{tab.heading}} select=deactivateDesignTab()><div class=row data-ng-include=\"'/static/modules/forms/admin/views/adminTabs/'+tab.templateName+'.html'\"></div></uib-tab><uib-tab index=2 heading=\"{{ 'ANALYZE_TAB' | translate }}\" select=deactivateDesignTab()><edit-submissions-form-directive myform=myform user=myform.admin></edit-submissions-form-directive></uib-tab><uib-tab ng-if=tabData heading=\"{{ 'SHARE_TAB' | translate }}\" index={{tabData.length}} select=deactivateDesignTab()><div class=config-form><div class=row><div class=col-sm-12><uib-tabset active=activePill vertical=true type=pills><uib-tab index=0 heading=\"{{ 'SHARE_YOUR_FORM' | translate }}\"><div class=row><div class=col-sm-12>{{ 'TELLFORM_URL' | translate }}</div><div class=\"col-sm-8 form-input\"><span ngclipboard data-clipboard-target=#copyURL><input id=copyURL ng-value=actualFormURL class=\"form-control ng-pristine ng-untouched ng-valid\"></span></div><div class=col-sm-4><button class=\"btn btn btn-secondary view-form-btn\" ngclipboard data-clipboard-target=#copyURL>{{ 'COPY' | translate }} <i class=\"fa fa-clipboard\" aria-hidden=true></i></button></div></div></uib-tab><uib-tab index=1 heading=\"{{ 'EMBED_YOUR_FORM' | translate }}\"><div class=row><div class=col-sm-12>{{ 'COPY_AND_PASTE' | translate }}</div><div class=\"col-sm-8 form-input\"><span ngclipboard data-clipboard-target=#copyEmbedded><textarea id=copyEmbedded class=\"form-control ng-pristine ng-untouched ng-valid\" style=\"min-height:200px; width:100%; background-color: #FFFFCC; color: #30313F\">\n" +
2017-07-26 20:41:53 +00:00
" <!-- {{ 'CHANGE_WIDTH_AND_HEIGHT' | translate }} -->\n" +
" <iframe id=iframe src={{actualFormURL}} style=width:100%;height:500px></iframe>\n" +
" <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>\n" +
2017-10-07 08:34:01 +00:00
" </textarea></span></div><div class=col-sm-4><button class=\"btn btn btn-secondary view-form-btn\" ngclipboard data-clipboard-target=#copyEmbedded>{{ 'COPY' | translate }} <i class=\"fa fa-clipboard\" aria-hidden=true></i></button></div></div></uib-tab></uib-tabset></div></div></div></uib-tab><uib-tab class=design-tab ng-if=\"tabData && myform.form_fields.length\" heading=\"{{ 'DESIGN_TAB' | translate }}\" index={{tabData.length}}+1 select=activateDesignTab()><div class=\"config-form design container\"><div class=row><div class=\"col-sm-4 col-xs-12\"><div class=\"row field\"><div class=\"field-title col-sm-5\"><h5>{{ 'BACKGROUND_COLOR' | translate }}</h5></div><div class=\"field-input col-sm-6\"><input class=form-control colorpicker=hex ng-model=myform.design.colors.backgroundColor ng-pattern=\"/^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$/\" ng-style=\"{ 'background-color': myform.design.colors.backgroundColor }\"></div></div><div class=\"row field\"><div class=\"field-title col-sm-5\"><h5>{{ 'QUESTION_TEXT_COLOR' | translate }}</h5></div><div class=\"field-input col-sm-6\"><input class=form-control colorpicker=hex ng-model=myform.design.colors.questionColor ng-pattern=\"/^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$/\" ng-style=\"{ 'background-color': myform.design.colors.questionColor }\"></div></div><div class=\"row field\"><div class=\"field-title col-sm-5\"><h5>{{ 'ANSWER_TEXT_COLOR' | translate }}</h5></div><div class=\"field-input col-sm-6\"><input class=form-control colorpicker=hex ng-model=myform.design.colors.answerColor ng-pattern=\"/^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$/\" ng-style=\"{ 'background-color': myform.design.colors.answerColor }\"></div></div><div class=\"row field\"><div class=\"field-title col-sm-5\"><h5>{{ 'BTN_BACKGROUND_COLOR' | translate }}</h5></div><div class=\"field-input col-sm-6\"><input class=form-control colorpicker=hex ng-model=myform.design.colors.buttonColor ng-pattern=\"/^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$/\" ng-style=\"{ 'background-color': myform.design.colors.buttonColor }\"></div></div><div class=\"row field\"><div class=\"field-title col-sm-5\"><h5>{{ 'BTN_TEXT_COLOR' | translate }}</h5></div><div class=\"field-input col-sm-6\"><input class=form-control colorpicker=hex ng-model=myform.design.colors.buttonTextColor ng-pattern=\"/^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$/\" ng-style=\"{ 'background-color': myform.design.colors.buttonTextColor }\"></div></div></div><div class=\"col-sm-8 hidden-xs\" ng-if=designTabActive><div class=public-form ng-style=\"{ 'background-color': myform.design.colors.backgroundColor }\"><iframe id=iframe ng-if=!!formURL ng-src=\"{{formURL | trustSrc}}\" style=\"border: none; box-shadow: 0px 0px 10px 0px grey; overflow: hidden; height: 400px; width: 90%; position: absolute\"></iframe></div></div></div><div class=row><div class=\"col-sm-offset-4 col-sm-2\"><button class=\"btn btn-signup btn-rounded\" type=button ng-click=\"updateDesign(false, myform, false, false)\"><i class=\"icon-arrow-left icon-white\"></i>{{ 'SAVE_CHANGES' | translate }}</button></div><div class=col-sm-1><button class=\"btn btn-secondary btn-rounded\" type=button ng-click=resetForm()><i class=\"icon-eye-open icon-white\"></i>{{ 'CANCEL' | translate }}</button></div></div></div></uib-tab></uib-tabset></div></div></section>" ) ;
2017-07-26 20:41:53 +00:00
$templateCache . put ( "modules/forms/admin/views/list-forms.client.view.html" ,
"<header data-ng-include=\"'/static/modules/core/views/header.client.view.html'\"></header><section class=overlay ng-if=showCreateModal ng-click=closeCreateModal()></section><script type=text/ng-template id=deleteModalListForms.html><div class=\"modal-header\">\n" +
" <h2 class=\"modal-title hidden-md hidden-lg\">{{ 'ARE_YOU_SURE' | translate }}</h2>\n" +
" <h3 class=\"modal-title hidden-xs hidden-sm\">{{ 'ARE_YOU_SURE' | translate }}</h3>\n" +
" </div>\n" +
" <div class=\"modal-body\">\n" +
" <div class=\"modal-body-alert\">\n" +
" {{ 'READ_WARNING' | translate }}\n" +
" </div>\n" +
" <p class=\"hidden-xs hidden-sm\">\n" +
" {{ 'DELETE_WARNING1' | translate }} <strong>{{content.currFormTitle}}</strong> {{ 'DELETE_WARNING2' | translate }}\n" +
" </p>\n" +
" <p>{{ 'DELETE_CONFIRM' | translate }}</p>\n" +
" </div>\n" +
" <div class=\"modal-footer\">\n" +
" <input type=\"text\" style=\"width:100%\" data-ng-model=\"deleteConfirm\" class=\"input-block\" autofocus required aria-label=\"Type in the name of the form to confirm that you want to delete this form.\">\n" +
" <button type=\"submit\" ng-click=\"deleteForm()\" class=\"btn btn-block btn-danger\" ng-disabled=\"content.currFormTitle != deleteConfirm\">\n" +
" {{ 'I_UNDERSTAND' | translate }}\n" +
" </button>\n" +
2017-10-19 00:27:07 +00:00
" </div></script><section class=container><br><div class=row><div ng-click=openCreateModal() class=\"col-xs-6 col-xs-offset-3 col-sm-4 col-sm-offset-1 col-md-3 col-md-offset-1 form-item create-new\"><div class=\"title-row col-xs-12\"><h4 class=\"fa fa-plus fa-6\"></h4></div><div class=\"col-xs-12 details-row\"><small class=list-group-item-text>{{ 'CREATE_A_NEW_FORM' | translate }}</small></div></div><form name=forms.createForm class=\"col-xs-6 col-xs-offset-3 col-sm-4 col-sm-offset-1 col-md-3 col-md-offset-1 form-item create-new new-form\" ng-if=showCreateModal><div class=\"title-row row\"><div class=\"col-xs-5 field-title text-left\">{{ 'NAME' | translate }}</div><div class=\"col-xs-12 field-input\"><input name=title required ng-model=formTitle ng-pattern=languageRegExp ng-minlength=4 style=\"color:black\"></div></div><div class=\"details-row row\"><div class=\"col-xs-5 field-title text-left\">{{ 'LANGUAGE' | translate }}</div><div class=\"col-xs-12 field-input\"><div class=\"button custom-select\"><select style=color:black name=language required ng-model=formLanguage ng-init=\"formLanguage = user.language\"><option ng-repeat=\"language in languages\" value={{language}}>{{language}}</option></select></div></div></div><div class=\"details-row submit row\"><div class=\"col-xs-12 field-title text-center\"><button class=\"btn btn-primary\" ng-disabled=forms.createForm.$invalid ng-click=createNewForm()>{{ 'CREATE_FORM' | translate }}</button></div></div></form><div data-ng-repeat=\"form in myforms\" class=\"col-xs-6 col-xs-offset-3 col-sm-4 col-sm-offset-1 col-md-3 col-md-offset-1 form-item container\" ng-class=\"{'paused': !form.isLive}\" ng-clkc=\"goToWithId('viewForm.create', form._id)\"><div class=row><span class=pull-right><i style=cursor:pointer class=\"fa fa-trash-o\" ng-click=openDeleteModal($index)></i> <i style=cursor:pointer class=\"fa fa-files-o\" ng-click=duplicateForm($index)></i></span></div><div class=row><a data-ng-href=#!/forms/{{form._id}}/admin/create class=\"title-row col-xs-12\"><h4 class=list-group-item-heading data-ng-bind=form.title></h4></a><div class=\"col-xs-12 responses-row\"><small class=list-group-item-text><span>{{ form.numberOfResponses }} {{ 'RESPONSES' | translate }}</span></small><br><br><small ng-if=!form.isLive class=list-group-item-text><span>{{ 'FORM_PAUSED' | translate }}</span></small></div></div></div></div></section>" ) ;
2017-07-26 20:41:53 +00:00
$templateCache . put ( "modules/forms/admin/views/adminTabs/analyze.html" ,
"<edit-submissions-form-directive myform=myform user=user></edit-submissions-form-directive>" ) ;
$templateCache . put ( "modules/forms/admin/views/adminTabs/configure.html" ,
"<configure-form-directive myform=myform user=user></configure-form-directive>" ) ;
$templateCache . put ( "modules/forms/admin/views/adminTabs/create.html" ,
"<edit-form-directive myform=myform></edit-form-directive>" ) ;
$templateCache . put ( "modules/forms/admin/views/directiveViews/form/configure-form.client.view.html" ,
2017-10-07 08:34:01 +00:00
"<div class=\"config-form container\"><div class=row><div class=\"col-sm-offset-2 col-sm-4\"><div class=\"row field\"><div class=\"field-title col-sm-12\"><h5>{{ 'FORM_NAME' | translate }}</h5></div><div class=col-sm-12><input class=form-control ng-model=myform.title value={{myform.title}} style=\"width: 100%\" ng-minlength=4 ng-pattern=\"/^[a-zA-Z0-9 \\-.]*$/\"></div></div><div class=\"row field\"><div class=\"field-title col-sm-12\"><h5>{{ 'FORM_STATUS' | translate }}</h5></div><div class=\"field-input col-sm-12\"><label style=\"display: inline-block\"><input type=radio data-ng-value=true ng-model=myform.isLive ng-required=true style=\"background-color:#33CC00\"> <span>{{ 'PUBLIC' | translate }}</span></label><label style=\"display: inline-block\"><input type=radio data-ng-value=false ng-model=myform.isLive ng-required=\"true\"> <span>{{ 'PRIVATE' | translate }}</span></label></div></div><div class=\"row field\"><div class=\"col-sm-12 field-title\">{{ 'LANGUAGE' | translate }}</div><div class=\"col-sm-12 field-input\"><select ng-model=myform.language><option ng-repeat=\"language in languages\" ng-selected=\"language == myform.language\" value={{language}}>{{language}}</option></select><span class=required-error ng-show=\"field.required && !field.fieldValue\">* {{ 'REQUIRED_FIELD' | translate }}</span></div></div></div><div class=col-sm-4><div class=\"row field\"><div class=\"field-title col-sm-12\"><h5>{{ 'GA_TRACKING_CODE' | translate }}</h5></div><div class=col-sm-12><input class=form-control ng-model=myform.analytics.gaCode value={{myform.analytics.gaCode}} style=\"width: 100%\" ng-minlength=4 placeholder=UA-XXXXX-Y ng-pattern=\"/\\bUA-\\d{4,10}-\\d{1,4}\\b/\"></div></div><div class=\"row field\"><div class=\"field-title col-sm-12\"><h5>{{ 'DISPLAY_FOOTER' | translate }}</h5></div><div class=\"field-input col-sm-12\"><label style=\"display: inline-block\"><input type=radio data-ng-value=false ng-model=myform.hideFooter ng-required=\"true\"> <span>{{ 'YES' | translate }}</span></label><label style=\"display: inline-block\"><input type=radio data-ng-value=true ng-model=myform.hideFooter ng-required=\"true\"> <span>{{ 'NO' | translate }}</span></label></div></div><div class=\"row field\"><div class=\"field-title col-sm-12\"><h5>{{ 'DISPLAY_START_PAGE' | translate }}</h5></div><div class=\"field-input col-sm-12\"><label style=\"display: inline-block\"><input type=radio data-ng-value=true ng-model=myform.startPage.showStart ng-required=true style=\"background-color:#33CC00\"> <span>{{ 'YES' | translate }}</span></label><label style=\"display: inline-block\"><input type=radio data-ng-value=false ng-model=myform.startPage.showStart ng-required=\"true\"> <span>{{ 'NO' | translate }}</span></label></div></div><div class=\"row field\"><div class=\"field-title col-sm-12\"><h5>{{ 'DISPLAY_END_PAGE' | translate }}</h5></div><div class=\"field-input col-sm-12\"><label style=\"display: inline-block\"><input type=radio data-ng-value=true ng-model=myform.endPage.showEnd ng-required=true style=\"background-color:#33CC00\"> <span>{{ 'YES' | translate }}</span></label><label style=\"display: inline-block\"><input type=radio data-ng-value=false ng-model=myform.endPage.showEnd ng-required=\"true\"> <span>{{ 'NO' | translate }}</span></label></div></div></div></div><div class=row><div class=\"col-sm-offset-4 col-sm-2\"><button class=\"btn btn-signup btn-rounded\" type=button ng-click=\"update(false, myform, false, false, null)\"><i class=\"icon-arrow-left icon-white\"></i>{{ 'SAVE_CHANGES' | translate }}</button></div><div class=col-sm-1><button class=\"btn btn-secondary btn-rounded\" type=button ng-click=resetForm()><i class=\"icon-eye-open icon-white\"></i>{{ 'CANCEL' | translate }}</button></div></div></div>" ) ;
2017-07-26 20:41:53 +00:00
$templateCache . put ( "modules/forms/admin/views/directiveViews/form/edit-form.client.view.html" ,
2017-09-30 00:33:55 +00:00
"<form class=row name=editForm><script type=text/ng-template id=editEndPageModal.html class=edit-endpage-modal><div class=\"modal-body\">\n" +
2017-07-26 20:41:53 +00:00
" <div class=\"row\">\n" +
2017-09-30 00:33:55 +00:00
" <div class=\"edit-panel col-md-6 col-xs-12 col-sm-12\">\n" +
2017-07-26 20:41:53 +00:00
" <div class=\"row modal-header\">\n" +
" <h2 class=\"modal-title hidden-md hidden-lg\">{{ 'EDIT_END_PAGE' | translate }}</h2>\n" +
" <h3 class=\"modal-title hidden-xs hidden-sm\">{{ 'EDIT_END_PAGE' | translate }}</h3>\n" +
" </div>\n" +
"\n" +
" <div class=\"row question\">\n" +
" <div class=\"col-md-4 col-sm-12\">{{ 'TITLE' | translate }}:</div>\n" +
" <div class=\"col-md-8 col-sm-12\">\n" +
" <input class=\"form-control\" type=\"text\"\n" +
" ng-model=\"myform.endPage.title\" required>\n" +
" </div>\n" +
" </div>\n" +
"\n" +
" <div class=\"row\"><br></div>\n" +
"\n" +
" <div class=\"row question\">\n" +
" <div class=\"col-md-4 col-sm-12\">{{ 'PARAGRAPH' | translate }}:</div>\n" +
" <div class=\"col-md-8 col-sm-12\">\n" +
" <textarea class=\"form-control\" type=\"text\"\n" +
" ng-model=\"myform.endPage.paragraph\"></textarea>\n" +
" </div>\n" +
" </div>\n" +
"\n" +
" <div class=\"row\"><br></div>\n" +
"\n" +
" <div class=\"row question\">\n" +
" <div class=\"col-md-4 col-sm-12\">{{ 'BTN_TEXT' | translate }}:</div>\n" +
" <div class=\"col-md-8 col-sm-12\">\n" +
" <input class=\"form-control\" type=\"text\"\n" +
" ng-model=\"myform.endPage.buttonText\" required>\n" +
" </div>\n" +
" </div>\n" +
"\n" +
" <div class=\"row\"><br></div>\n" +
"\n" +
" <div class=\"row\">\n" +
" <div class=\"col-md-4 col-xs-12 field-input\">{{ 'SHOW_BUTTONS' | translate }}</div>\n" +
" <div class=\"col-md-8 col-xs-12 field-input\">\n" +
" <label class=\"switch-light switch-holo\" onclick=\"\">\n" +
" <input type=\"checkbox\" ng-model=\"showButtons\">\n" +
" <span>\n" +
" <span> {{ 'OFF' | translate }}</span>\n" +
" <span> {{ 'ON' | translate }}</span>\n" +
" <a></a>\n" +
" </span>\n" +
" </label>\n" +
" </div>\n" +
" </div>\n" +
"\n" +
" <div class=\"row options buttons\" ng-if=\"showButtons\">\n" +
" <div class=\"col-md-3 col-xs-12\">{{ 'BUTTONS' | translate }}:</div>\n" +
" <div class=\"col-md-9 col-xs-12\">\n" +
" <div ng-repeat=\"button in myform.endPage.buttons track by button._id\" class=\"row\" style=\"padding-bottom:1em;\">\n" +
"\n" +
" <div class=\"col-xs-5\">\n" +
" <span>{{ 'BUTTON_TEXT' | translate }}</span>\n" +
" <input type=\"text\"\n" +
" name=\"{{button.text}}_buttonText_startPage\"\n" +
" ng-model=\"button.text\"\n" +
" value=\"{{button.text}}\"\n" +
" placeholder=\"{{ 'BUTTON_TEXT' | translate }}\">\n" +
" </div>\n" +
"\n" +
"\n" +
" <div class=\"col-xs-5\">\n" +
" <span>{{ 'BUTTON_LINK' | translate }}</span>\n" +
" <input type=\"text\"\n" +
" name=\"{{button.url}}_url_startPage\"\n" +
" ng-model=\"button.url\"\n" +
" value=\"{{button.url}}\"\n" +
" placeholder=\"http://aeouaou.com/aoeuoa\">\n" +
" </div>\n" +
"\n" +
" <div class=\"col-xs-2\">\n" +
" <a class=\"btn btn-danger btn-mini right\" type=\"button\" ng-click=\"deleteButton(button)\">\n" +
" <i class=\"fa fa-trash-o\"></i>\n" +
" </a>\n" +
" </div>\n" +
" </div>\n" +
"\n" +
" <div class=\"row\"><br></div>\n" +
" <div class=\"row\">\n" +
" <button class=\"btn btn-primary btn-small col-md-offset-6 col-md-6 col-sm-4 col-sm-offset-8 col-xs-4 col-xs-offset-8\" type=\"button\" ng-click=\"addButton()\">\n" +
" <i class=\"icon-plus icon-white\"></i> {{ 'ADD_BUTTON' | translate }}\n" +
" </button>\n" +
" </div>\n" +
" </div>\n" +
" </div>\n" +
"\n" +
" <div class=\"modal-footer row\">\n" +
" <button type=\"submit\" ng-click=\"saveEndPage()\" class=\"btn btn-signup btn-rounded\">\n" +
" {{ 'SAVE_START_PAGE' | translate }}\n" +
" </button>\n" +
"\n" +
" <button ng-click=\"cancel()\" class=\"btn btn-secondary btn-rounded\">\n" +
" {{ 'CANCEL' | translate }}\n" +
" </button>\n" +
" </div>\n" +
" </div>\n" +
"\n" +
2017-09-30 00:33:55 +00:00
" <div class=\"preview-field-panel col-md-6 hidden-sm hidden-xs\">\n" +
2017-07-26 20:41:53 +00:00
" <form class=\"public-form\">\n" +
"\n" +
" <div class=\"row\">\n" +
" <div class=\"col-xs-12 text-center\" style=\"overflow-wrap: break-word;\">\n" +
" <h1 style=\"font-weight: 400; font-size: 25px;\">\n" +
" {{myform.endPage.title}}\n" +
" </h1>\n" +
" </div>\n" +
" <div class=\"col-xs-10 col-xs-offset-1 text-center\" style=\"overflow-wrap: break-word;\">\n" +
" <p style=\"color: grey; font-weight: 100; font-size: 16px;\">\n" +
" {{myform.endPage.paragraph}}\n" +
" </p>\n" +
" </div>\n" +
" </div>\n" +
"\n" +
" <div class=\"row form-actions text-center\" style=\"padding: 5px 25px 5px 25px;\">\n" +
" <button ng-click=\"reloadForm()\" class=\"btn\" type=\"button\"\n" +
" ng-style=\"{'background-color':myform.design.colors.buttonColor, 'color':myform.design.colors.buttonTextColor}\">\n" +
" <span style=\"font-size: 1.6em;\">\n" +
" {{myform.endPage.buttonText}}\n" +
" </span>\n" +
" </button>\n" +
" </div>\n" +
" <div class=\"row form-actions\" style=\"padding-bottom:3em; padding-left: 1em; padding-right: 1em;\">\n" +
" <p ng-repeat=\"button in myform.endPage.buttons\" class=\"text-center\" style=\"display:inline;\">\n" +
" <button class=\"btn\" style=\"background-color:rgb(156, 226, 235)\" type=\"button\" ng-style=\"{'background-color':button.bgColor, 'color':button.color}\">\n" +
" <a href=\"{{button.url}}\"\n" +
" style=\"font-size: 1.6em; text-decoration: none;\"\n" +
" ng-style=\"{'color':button.color}\">\n" +
" {{button.text}}\n" +
" </a>\n" +
" </button>\n" +
" </p>\n" +
" </div>\n" +
"\n" +
" </form>\n" +
" </div>\n" +
" </div>\n" +
"\n" +
" </div></script><script type=text/ng-template id=editStartPageModal.html class=edit-startpage-modal><div class=\"modal-body\">\n" +
" <div class=\"row\">\n" +
2017-09-30 00:33:55 +00:00
" <div class=\"edit-panel col-md-6 col-xs-12 col-sm-12\">\n" +
2017-07-26 20:41:53 +00:00
" <div class=\"row modal-header\">\n" +
" <h2 class=\"modal-title hidden-md hidden-lg\">{{ 'EDIT_START_PAGE' | translate }}</h2>\n" +
" <h3 class=\"modal-title hidden-xs hidden-sm\">{{ 'EDIT_START_PAGE' | translate }}</h3>\n" +
" </div>\n" +
"\n" +
" <div class=\"row question\">\n" +
" <div class=\"col-md-4 col-sm-12\">{{ 'INTRO_TITLE' | translate }}:</div>\n" +
" <div class=\"col-md-8 col-sm-12\">\n" +
" <input class=\"form-control\" type=\"text\"\n" +
" ng-model=\"myform.startPage.introTitle\"\n" +
" name=\"introTitleStartPage\" required>\n" +
" </div>\n" +
" </div>\n" +
"\n" +
" <div class=\"row\"><br></div>\n" +
"\n" +
" <div class=\"row question\">\n" +
" <div class=\"col-md-4 col-sm-12\">{{ 'INTRO_PARAGRAPH' | translate }}:</div>\n" +
" <div class=\"col-md-8 col-sm-12\">\n" +
" <textarea class=\"form-control\" type=\"text\"\n" +
" ng-model=\"myform.startPage.introParagraph\"\n" +
" name=\"introParagraphStartPage\"></textarea>\n" +
" </div>\n" +
" </div>\n" +
"\n" +
" <div class=\"row\"><br></div>\n" +
"\n" +
" <div class=\"row question\">\n" +
" <div class=\"col-md-4 col-sm-12\">{{ 'INTRO_BTN' | translate }}:</div>\n" +
" <div class=\"col-md-8 col-sm-12\">\n" +
" <input class=\"form-control\" type=\"text\"\n" +
" ng-model=\"myform.startPage.introButtonText\"\n" +
" name=\"introButtonText\" required>\n" +
" </div>\n" +
" </div>\n" +
"\n" +
" <div class=\"row\"><br></div>\n" +
"\n" +
" <div class=\"row\">\n" +
" <div class=\"col-md-4 col-xs-12 field-input\">{{ 'SHOW_BUTTONS' | translate }}</div>\n" +
" <div class=\"col-md-8 col-xs-12 field-input\">\n" +
" <label class=\"switch-light switch-holo\" onclick=\"\">\n" +
" <input type=\"checkbox\" ng-model=\"showButtons\">\n" +
" <span>\n" +
" <span> {{ 'OFF' | translate }}</span>\n" +
" <span> {{ 'ON' | translate }}</span>\n" +
" <a></a>\n" +
" </span>\n" +
" </label>\n" +
" </div>\n" +
" </div>\n" +
"\n" +
" <div class=\"row options buttons\" ng-if=\"showButtons\">\n" +
" <div class=\"col-md-3 col-xs-12\">{{ 'BUTTONS' | translate }}:</div>\n" +
" <div class=\"col-md-9 col-xs-12\">\n" +
" <div ng-repeat=\"button in myform.startPage.buttons track by button._id\" class=\"row\" style=\"padding-bottom:1em;\">\n" +
"\n" +
" <div class=\"col-xs-5\">\n" +
" <span>{{ 'BUTTON_TEXT' | translate }}</span>\n" +
" <input type=\"text\"\n" +
" name=\"{{button.text}}_buttonText_startPage\"\n" +
" ng-model=\"button.text\"\n" +
" value=\"{{button.text}}\"\n" +
" placeholder=\"{{ 'BUTTON_TEXT' | translate }}\">\n" +
" </div>\n" +
"\n" +
"\n" +
" <div class=\"col-xs-5\">\n" +
" <span>{{ 'BUTTON_LINK' | translate }}</span>\n" +
" <input type=\"text\"\n" +
" name=\"{{button.url}}_url_startPage\"\n" +
" ng-model=\"button.url\"\n" +
" value=\"{{button.url}}\"\n" +
" placeholder=\"http://aeouaou.com/aoeuoa\">\n" +
" </div>\n" +
"\n" +
" <div class=\"col-xs-2\">\n" +
" <a class=\"btn btn-danger btn-mini right\" type=\"button\" ng-click=\"deleteButton(button)\">\n" +
" <i class=\"fa fa-trash-o\"></i>\n" +
" </a>\n" +
" </div>\n" +
" </div>\n" +
"\n" +
" <div class=\"row\"><br></div>\n" +
" <div class=\"row\">\n" +
" <button class=\"btn btn-primary btn-small col-md-offset-6 col-md-6 col-sm-4 col-sm-offset-8 col-xs-4 col-xs-offset-8\" type=\"button\" ng-click=\"addButton()\">\n" +
" <i class=\"icon-plus icon-white\"></i> {{ 'ADD_BUTTON' | translate }}\n" +
" </button>\n" +
" </div>\n" +
" </div>\n" +
" </div>\n" +
"\n" +
" <div class=\"modal-footer row\">\n" +
" <button type=\"submit\" ng-click=\"saveStartPage()\" class=\"btn btn-signup btn-rounded\">\n" +
" {{ 'SAVE_START_PAGE' | translate }}\n" +
" </button>\n" +
"\n" +
" <button ng-click=\"cancel()\" class=\"btn btn-secondary btn-rounded\">\n" +
" {{ 'CANCEL' | translate }}\n" +
" </button>\n" +
" </div>\n" +
" </div>\n" +
"\n" +
2017-09-30 00:33:55 +00:00
" <div class=\"preview-field-panel col-md-6 hidden-sm hidden-xs\">\n" +
2017-07-26 20:41:53 +00:00
" <form class=\"public-form\">\n" +
"\n" +
" <div class=\"field row\">\n" +
" <div class=\"col-xs-12 text-center\" style=\"overflow-wrap: break-word;\">\n" +
" <h1>{{myform.startPage.introTitle}}</h1>\n" +
" </div>\n" +
" <div class=\"col-xs-10 col-xs-offset-1 text-left\" style=\"overflow-wrap: break-word;\">\n" +
" <p style=\"color:#ddd;\">{{myform.startPage.introParagraph}}</p>\n" +
" </div>\n" +
" </div>\n" +
" <div class=\"row form-actions\" style=\"padding-bottom:3em; padding-left: 1em; padding-right: 1em;\">\n" +
" <p ng-repeat=\"button in myform.startPage.buttons\" class=\"text-center\" style=\"display:inline;\">\n" +
" <button class=\"btn btn-info\" type=\"button\" ng-style=\"{'background-color':button.bgColor, 'color':button.color}\">\n" +
" <a href=\"{{button.url}}\" style=\"font-size: 1.6em; text-decoration: none; color: inherit;\" >\n" +
" {{button.text}}\n" +
" </a>\n" +
" </button>\n" +
" </p>\n" +
" </div>\n" +
" <div class=\"row form-actions\">\n" +
" <button class=\"btn btn-info btn btn-info col-md-6 col-md-offset-3 col-lg-6 col-lg-offset-3\" type=\"button\">\n" +
" <span style=\"color:white; font-size: 1.6em; text-decoration: none;\">\n" +
" {{myform.startPage.introButtonText}}\n" +
" </span>\n" +
" </button>\n" +
" </div>\n" +
"\n" +
" </form>\n" +
" </div>\n" +
" </div>\n" +
"\n" +
" </div></script><script type=text/ng-template id=editFieldModal.html class=edit-field-modal><div class=\"modal-body\">\n" +
" <div class=\"row\">\n" +
2017-09-30 00:33:55 +00:00
" <div class=\"edit-panel col-md-6 col-xs-12 col-sm-12\">\n" +
2017-07-26 20:41:53 +00:00
" <div class=\"row modal-header\">\n" +
" <h2 class=\"modal-title hidden-md hidden-lg\">{{ 'EDIT_FIELD' | translate }}</h2>\n" +
" <h3 class=\"modal-title hidden-xs hidden-sm\">{{ 'EDIT_FIELD' | translate }}</h3>\n" +
" </div>\n" +
" <div class=\"row question\">\n" +
" <div class=\"col-md-12 bold\">{{ 'QUESTION_TITLE' | translate }}</div>\n" +
" <div class=\"col-md-12\">\n" +
" <input type=\"text\" class=\"form-control\" ng-model=\"field.title\" name=\"title{{field._id}}\" value=\"{{field.title}}\" required></div>\n" +
" </div>\n" +
"\n" +
" <div class=\"row\"><br></div>\n" +
"\n" +
2017-10-19 00:27:07 +00:00
" <div class=\"row description\" ng-hide=\"showRatingOptions()\">\n" +
2017-07-26 20:41:53 +00:00
" <div class=\"col-md-12 bold\">{{ 'QUESTION_DESCRIPTION' | translate }}</div>\n" +
" <div class=\"col-md-12\">\n" +
" <textarea type=\"text\" class=\"form-control\" ng-model=\"field.description\" name=\"description{{field._id}}\"value=\"{{field.description}}\"></textarea>\n" +
" </div>\n" +
" </div>\n" +
"\n" +
2017-10-19 00:27:07 +00:00
" <div class=\"row\" ng-show=\"showAddOptions()\"><br></div>\n" +
" <div class=\"row options\" ng-if=\"showAddOptions()\">\n" +
2017-07-26 20:41:53 +00:00
" <div class=\"col-md-4 col-xs-12\">{{ 'OPTIONS' | translate }}</div>\n" +
" <div class=\"col-md-8 col-xs-12\">\n" +
" <div ng-repeat=\"option in field.fieldOptions track by option.option_id\" class=\"row\">\n" +
" <input type=\"text\" name=\"{{option.option_value}}{{field._id}}\" ng-model=\"option.option_value\" class=\"col-xs-5\">\n" +
"\n" +
2017-10-19 00:27:07 +00:00
" <a class=\"btn btn-danger btn-mini right\" type=\"button\" ng-click=\"deleteOption(option)\" class=\"col-xs-3\">\n" +
2017-07-26 20:41:53 +00:00
" <i class=\"fa fa-trash-o\"></i>\n" +
" </a>\n" +
" </div>\n" +
" <div class=\"row\">\n" +
2017-10-19 00:27:07 +00:00
" <button class=\"btn btn-primary btn-small col-md-offset-0 col-md-6 col-sm-4 col-sm-offset-4 col-xs-6 col-xs-offset-6\" type=\"button\" ng-click=\"addOption()\">\n" +
2017-07-26 20:41:53 +00:00
" <i class=\"icon-plus icon-white\"></i> {{ 'ADD_OPTION' | translate }}\n" +
" </button>\n" +
" </div>\n" +
" </div>\n" +
" </div>\n" +
"\n" +
2017-10-19 00:27:07 +00:00
" <div class=\"row\" ng-show=\"showRatingOptions()\"><br></div>\n" +
" <div class=\"row\" ng-if=\"showRatingOptions()\">\n" +
2017-07-26 20:41:53 +00:00
" <div class=\"col-md-9 col-sm-9\">{{ 'NUM_OF_STEPS' | translate }}</div>\n" +
" <div class=\"col-md-3 col-sm-3\">\n" +
" <input style=\"width:100%\" type=\"number\"\n" +
" min=\"1\" max=\"10\"\n" +
" ng-model=\"field.ratingOptions.steps\"\n" +
" name=\"ratingOptions_steps{{field._id}}\"\n" +
" ng-value=\"{{field.ratingOptions.steps}}\"\n" +
" required>\n" +
" </div>\n" +
" <br>\n" +
" <div class=\"col-md-5 col-sm-9\">{{ 'SHAPE' | translate }}:</div>\n" +
" <div class=\"col-md-7 col-sm-3\">\n" +
" <select style=\"width:100%\" ng-model=\"field.ratingOptions.shape\"\n" +
" value=\"{{field.ratingOptions.steps}}\"\n" +
" name=\"ratingOptions_shape{{field._id}}\" required>\n" +
" <option ng-repeat=\"shapeType in validShapes\"\n" +
" value=\"{{shapeType}}\">\n" +
" {{select2FA[shapeType]}}\n" +
" </option>\n" +
" </select>\n" +
" </div>\n" +
" </div>\n" +
"\n" +
" <div class=\"row\"><br></div>\n" +
"\n" +
" <div class=\"row\">\n" +
" <div class=\"col-md-4 col-xs-12 field-title\">{{ 'REQUIRED_FIELD' | translate }}</div>\n" +
" <div class=\"col-md-8 col-xs-12 field-input\">\n" +
" <label class=\"switch-light switch-holo\" onclick=\"\">\n" +
" <input type=\"checkbox\" ng-model=\"field.required\">\n" +
" <span class=\"large-3 columns float-left\">\n" +
" <span> {{ 'OFF' | translate }}</span>\n" +
" <span> {{ 'ON' | translate }}</span>\n" +
" <a></a>\n" +
" </span>\n" +
" </label>\n" +
" </div>\n" +
" </div>\n" +
"\n" +
" <div class=\"row\">\n" +
" <div class=\"col-md-4 col-xs-12 field-input\">{{ 'LOGIC_JUMP' | translate }}</div>\n" +
" <div class=\"col-md-8 col-xs-12 field-input\">\n" +
" <label class=\"switch-light switch-holo\" onclick=\"\">\n" +
2017-10-19 00:37:27 +00:00
" <input type=\"checkbox\" ng-model=\"field.logicJump.enabled\">\n" +
2017-07-26 20:41:53 +00:00
" <span>\n" +
" <span> {{ 'OFF' | translate }}</span>\n" +
" <span> {{ 'ON' | translate }}</span>\n" +
" <a></a>\n" +
" </span>\n" +
" </label>\n" +
" </div>\n" +
" </div>\n" +
2017-10-19 00:37:27 +00:00
" <div class=\"row question\" ng-if=\"field.logicJump.enabled\"\">\n" +
2017-07-26 20:41:53 +00:00
" <div class=\"col-md-4 col-sm-12\">\n" +
"\n" +
" <b> {{ 'IF_THIS_FIELD' | translate }} </b>\n" +
" </div>\n" +
" <div class=\"col-md-4 col-sm-12\">\n" +
" <select style=\"width:100%\" ng-model=\"field.logicJump.expressionString\"\n" +
" value=\"{{field.logicJump.expressionString}}\"\n" +
" name=\"logicjump_expressionString{{field._id}}\">\n" +
" <option value=\"field == static\">\n" +
"\n" +
" {{ 'IS_EQUAL_TO' | translate }}\n" +
" </option>\n" +
" <option value=\"field != static\">\n" +
"\n" +
" {{ 'IS_NOT_EQUAL_TO' | translate }}\n" +
" </option>\n" +
"\n" +
" <option value=\"field > static\" ng-if-start=\"field.fieldType === 'number' || field.fieldType === 'rating' || field.fieldType === 'number'\">\n" +
"\n" +
" {{ 'IS_GREATER_THAN' | translate }}\n" +
" </option>\n" +
" <option value=\"field >= static\">\n" +
"\n" +
" {{ 'IS_GREATER_OR_EQUAL_THAN' | translate }}\n" +
" </option>\n" +
" <option value=\"field < static\">\n" +
"\n" +
" {{ 'IS_SMALLER_THAN' | translate }}\n" +
" </option>\n" +
" <option value=\"field <= static\" ng-if-end>\n" +
"\n" +
" {{ 'IS_SMALLER_OR_EQUAL_THAN' | translate }}\n" +
" </option>\n" +
"\n" +
" <option value=\"field contains static\" ng-if-start=\"field.fieldType !== 'number' && field.fieldType !== 'rating' && field.fieldType !== 'number'\">\n" +
"\n" +
" {{ 'CONTAINS' | translate }}\n" +
" </option>\n" +
" <option value=\"field !contains static\">\n" +
"\n" +
" {{ 'DOES_NOT_CONTAINS' | translate }}\n" +
" </option>\n" +
" <option value=\"field ends static\">\n" +
"\n" +
" {{ 'ENDS_WITH' | translate }}\n" +
" </option>\n" +
" <option value=\"field !ends static\">\n" +
"\n" +
" {{ 'DOES_NOT_END_WITH' | translate }}\n" +
" </option>\n" +
" <option value=\"field starts static\">\n" +
"\n" +
" {{ 'STARTS_WITH' | translate }}\n" +
" </option>\n" +
" <option value=\"field !starts static\" ng-if-end>\n" +
"\n" +
" {{ 'DOES_NOT_START_WITH' | translate }}\n" +
" </option>\n" +
" </select>\n" +
" </div>\n" +
" <div class=\"col-md-4 col-sm-12\">\n" +
" <input type=\"text\" ng-model=\"field.logicJump.valueB\"/>\n" +
" </div>\n" +
" <div class=\"col-md-2\">\n" +
"\n" +
" <b>{{ 'THEN_JUMP_TO' | translate }}</b>\n" +
" </div>\n" +
" <div class=\"col-md-10\">\n" +
" <select style=\"width:100%\" ng-model=\"field.logicJump.jumpTo\"\n" +
" value=\"{{field.logicJump.jumpTo}}\"\n" +
" name=\"logicjump_jumpTo{{field._id}}\">\n" +
" <option ng-repeat=\"jump_field in myform.form_fields\"\n" +
" value=\"{{jump_field._id}}\">\n" +
" {{jump_field.title}}\n" +
" </option>\n" +
" </select>\n" +
" </div>\n" +
" </div>\n" +
" <div class=\"modal-footer row\">\n" +
" <button type=\"submit\" ng-click=\"saveField()\" class=\"btn btn-signup btn-rounded\">\n" +
" {{ 'SAVE_FIELD' | translate }}\n" +
" </button>\n" +
"\n" +
" <button ng-click=\"cancel()\" class=\"btn btn-secondary btn-rounded\">\n" +
" {{ 'CANCEL' | translate }}\n" +
" </button>\n" +
" </div>\n" +
" </div>\n" +
"\n" +
2017-09-30 00:33:55 +00:00
" <div class=\"preview-field-panel col-md-6 hidden-sm hidden-xs\">\n" +
2017-10-19 00:27:07 +00:00
" <form class=\"public-form\">\n" +
2017-07-26 20:41:53 +00:00
" <field-directive field=\"field\" validate=\"false\" class=\"preview-field\">\n" +
" </field-directive>\n" +
" </form>\n" +
" </div>\n" +
" </div>\n" +
"\n" +
2017-10-26 15:36:15 +00:00
" </div></script><div class=\"col-xs-2 col-sm-4 add-field\"><div class=\"row add-field-title\"><h3 class=\"col-md-12 hidden-sm hidden-xs\">{{ 'ADD_FIELD_LG' | translate }}</h3><h4 class=\"col-sm-12 hidden-xs hidden-md hidden-lg\">{{ 'ADD_FIELD_MD' | translate }}</h4><h5 class=\"col-xs-12 hidden-sm hidden-md hidden-lg\">{{ 'ADD_FIELD_SM' | translate }}</h5></div><div class=\"panel-group row\" class=draggable ng-model=addField.types><div class=\"col-xs-12 col-sm-12 col-md-6\" ng-repeat=\"type in addField.types\" style=padding-top:7.5px><div class=\"panel panel-default\" style=background-color:#f5f5f5><div class=panel-heading ng-click=addNewField(type.name) style=\"cursor: pointer; font-size:12px; padding-left: 10px; padding-right: 10px\"><span><field-icon-directive type-name={{type.name}}></field-icon-directive></span> <span class=hidden-xs style=padding-left:0.3em>{{type.value}}</span></div></div></div></div></div><div class=\"col-xs-10 col-sm-8 current-fields\"><div class=row ng-if=myform.startPage.showStart><div class=col-sm-12><div class=\"panel panel-default startPage\" ng-click=openEditStartPageModal()><div class=panel-heading><h4 class=text-center>{{ 'WELCOME_SCREEN' | translate }}</h4></div></div></div></div><div class=row><div class=col-sm-12><hr></div></div><div class=\"row dropzoneContainer\"><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 $id($index)\" ng-if=!field.deletePreserved><div class=col-xs-10><div class=\"panel panel-default\" ng-click=\"openEditModal(field, true, $index)\"><div class=panel-heading><div class=row><span class=col-xs-1 ng-switch=field.fieldType><field-icon-directive type-name={{field.fieldType}}></field-icon-directive></span> <span class=col-xs-11>{{field.title}} <span ng-show=field.required>*</span></span></div></div></div></div><div class=\"col-xs-1 box\"><div class=\"panel tool-panel panel-default\"><div class=panel-heading style=\"padding: 10px 10px\" ng-click=deleteField($index)><span class=text-center><a href=\"\" class=\"fa fa-trash-o\"></a></span></div></div></div><div class=\"col-xs-1 box\"><div class=\"panel tool-panel panel-default\"><div class=panel-heading style=\"padding: 10px 10px\" ng-click=duplicateField($index)><span class=text-center><a href=\"\" class=\"fa fa-files-o\"></a></span></div></div></div></div><div class=\"col-xs-12 field-row\"><div class=col-xs-12 style=\"padding-right: 5px\"><div class=\"panel panel-default\" style=\"border-style: dashed; border-color: #a9a9a9\"><div class=panel-heading><h4 class=\"panel-title text-center\" style=\"color: #a9a9a9\">{{ 'CLICK_FIELDS_FOOTER' | translate }}</h4></div></div></div></div><hr></div></div><div class=row ng-if=myform.endPage.showEnd><div class=col-sm-12><div class=\"panel panel-default startPage\" ng-click=openEditEndPageModal()><div class=panel-heading><h4 class=text-center>{{ 'END_SCREEN' | translate }}</h4></div></div></div></div></div></form>" ) ;
2017-07-26 20:41:53 +00:00
$templateCache . put ( "modules/forms/admin/views/directiveViews/form/edit-submissions-form.client.view.html" ,
2017-09-30 00:33:55 +00:00
"<div class=\"submissions-table container\"><div class=\"row text-center analytics\"><div class=\"col-xs-12 header-title\"><div class=col-xs-3>{{ 'TOTAL_VIEWS' | translate }}</div><div class=col-xs-3>{{ 'RESPONSES' | translate }}</div><div class=col-xs-3>{{ 'COMPLETION_RATE' | translate }}</div><div class=col-xs-3>{{ 'AVERAGE_TIME_TO_COMPLETE' | translate }}</div></div><div class=\"col-xs-12 header-numbers\"><div class=col-xs-3>{{myform.analytics.visitors.length}}</div><div class=col-xs-3>{{myform.analytics.submissions}}</div><div class=col-xs-3>{{myform.analytics.conversionRate | number:0}}%</div><div class=col-xs-3>{{ AverageTimeElapsed | secondsToDateTime | date:'mm:ss'}}</div></div><div class=\"col-xs-12 detailed-title\"><div class=col-xs-3>{{ 'DESKTOP_AND_LAPTOP' | translate }}</div><div class=col-xs-3>{{ 'TABLETS' | translate }}</div><div class=col-xs-3>{{ 'PHONES' | translate }}</div><div class=col-xs-3>{{ 'OTHER' | translate }}</div></div><div class=\"col-xs-12 detailed-row\"><div class=col-xs-3><div class=\"row header\">{{ 'UNIQUE_VISITS' | translate }}</div><div class=row>{{DeviceStatistics.desktop.visits}}</div></div><div class=col-xs-3><div class=\"row header\">{{ 'UNIQUE_VISITS' | translate }}</div><div class=row>{{DeviceStatistics.tablet.visits}}</div></div><div class=col-xs-3><div class=\"row header\">{{ 'UNIQUE_VISITS' | translate }}</div><div class=row>{{DeviceStatistics.tablet.visits}}</div></div><div class=col-xs-3><div class=\"row header\">{{ 'UNIQUE_VISITS' | translate }}</div><div class=row>{{DeviceStatistics.other.visits}}</div></div></div><div class=\"col-xs-12 detailed-row\"><div class=col-xs-3><div class=\"row header\">{{ 'RESPONSES' | translate }}</div><div class=row>{{DeviceStatistics.desktop.responses}}</div></div><div class=col-xs-3><div class=\"row header\">{{ 'RESPONSES' | translate }}</div><div class=row>{{DeviceStatistics.tablet.responses}}</div></div><div class=col-xs-3><div class=\"row header\">{{ 'RESPONSES' | translate }}</div><div class=row>{{DeviceStatistics.phone.responses}}</div></div><div class=col-xs-3><div class=\"row header\">{{ 'RESPONSES' | translate }}</div><div class=row>{{DeviceStatistics.other.responses}}</div></div></div><div class=\"col-xs-12 detailed-row\"><div class=col-xs-3><div class=\"row header\">{{ 'COMPLETION_RATE' | translate }}</div><div class=row>{{DeviceStatistics.desktop.completion}}%</div></div><div class=col-xs-3><div class=\"row header\">{{ 'COMPLETION_RATE' | translate }}</div><div class=row>{{DeviceStatistics.tablet.completion}}%</div></div><div class=col-xs-3><div class=\"row header\">{{ 'COMPLETION_RATE' | translate }}</div><div class=row>{{DeviceStatistics.phone.completion}}%</div></div><div class=col-xs-3><div class=\"row header\">{{ 'COMPLETION_RATE' | translate }}</div><div class=row>{{DeviceStatistics.other.completion}}%</div></div></div><div class=\"col-xs-12 detailed-row\"><div class=col-xs-3><div class=\"row header\">{{ 'AVERAGE_TIME_TO_COMPLETE' | translate }}</div><div class=row>{{DeviceStatistics.desktop.average_time | secondsToDateTime | date:'mm:ss'}}</div></div><div class=col-xs-3><div class=\"row header\">{{ 'AVERAGE_TIME_TO_COMPLETE' | translate }}</div><div class=row>{{DeviceStatistics.tablet.average_time | secondsToDateTime | date:'mm:ss'}}</div></div><div class=col-xs-3><div class=\"row header\">{{ 'AVERAGE_TIME_TO_COMPLETE' | translate }}</div><div class=row>{{DeviceStatistics.phone.average_time | secondsToDateTime | date:'mm:ss'}}</div></div><div class=col-xs-3><div class=\"row header\">{{ 'AVERAGE_TIME_TO_COMPLETE' | translate }}</div><div class=row>{{DeviceStatistics.other.average_time | secondsToDateTime | date:'mm:ss'}}</div></div></div><div class=\"col-xs-12 field-title-row\"><div class=col-xs-3><strong>{{ 'FIELD_TITLE' | translate }}</strong></div><div class=col-xs-3><strong>{{ 'FIELD_VIEWS' | translate }}</strong></div><div class=col-xs-3><strong>{{ 'FIELD_RESPONSES' | translate }}</strong></div><div class=col-xs-3><strong>{{ 'FIELD_DROPOFF' | translate }}</strong></div></div><div class=\" col - xs - 12 field - detailed - ro
2017-07-26 20:41:53 +00:00
$templateCache . put ( "modules/users/views/authentication/access-denied.client.view.html" ,
"<section class=\"text-center auth\"><h3 class=col-md-12>{{ 'ACCESS_DENIED_TEXT' | translate }}</h3><a href=/#!/sigin class=col-md-12>{{ 'SIGNIN_BTN' | translate }}</a></section>" ) ;
$templateCache . put ( "modules/users/views/authentication/signin.client.view.html" ,
"<section class=\"auth sigin-view valign-wrapper\" data-ng-controller=AuthenticationController><div class=\"row valign\"><div class=\"col-md-4 col-md-offset-4\"><div class=\"col-md-12 text-center\" style=\"padding-bottom: 50px\"><img src=/static/modules/core/img/logo_white.svg height=100px></div><div class=col-md-12><form class=\"signin form-horizontal\" autocomplete=off><fieldset><div data-ng-show=error class=\"text-center text-danger\">Error: <strong data-ng-bind=error></strong></div><div class=form-group><input id=username name=username class=form-control data-ng-model=credentials.username placeholder=\"{{ 'USERNAME_OR_EMAIL_LABEL' | translate }}\" ng-minlength=4></div><div class=form-group><input type=password id=password name=password class=form-control data-ng-model=credentials.password placeholder=\"{{ 'PASSWORD_LABEL' | translate }}\" ng-minlength=4></div><div class=form-group><button class=\"btn btn-signup btn-rounded btn-block\" ng-click=signin()>{{ 'SIGNIN_BTN' | translate }}</button></div><div class=\"text-center forgot-password\"><a ui-sref=forgot>{{ 'FORGOT_PASSWORD_LINK' | translate }}</a></div></fieldset></form></div></div><div class=\"text-center forgot-password col-md-12\"><a ui-sref=signup>{{ 'SIGNUP_ACCOUNT_LINK' | translate }}</a></div></div></section>" ) ;
$templateCache . put ( "modules/users/views/authentication/signup-success.client.view.html" ,
2017-08-02 22:30:12 +00:00
"<section class=\"auth signup-view success\" data-ng-controller=AuthenticationController><h3 class=\"col-xs-offset-2 col-xs-8 col-md-offset-3 col-md-6 text-center\">{{ 'SUCCESS_HEADER' | translate }}</h3><div class=\"col-xs-offset-2 col-xs-8 col-md-offset-3 col-md-6\"><h2>{{ 'SUCCESS_TEXT' | translate }}<br><br>{{ 'NOT_ACTIVATED_YET' | translate }}</h2><br><br><p><strong>{{ 'BEFORE_YOU_CONTINUE' | translate }}</strong> <a href=mail:polydaic@gmail.com>polydaic@gmail.com</a></p><div class=\"text-center form-group\"><button type=submit class=\"btn btn-primary btn-rounded\"><a href=\"/#!/\" style=\"color: white; text-decoration: none\">{{ 'CONTINUE' | translate }}</a></button></div></div></section>" ) ;
2017-07-26 20:41:53 +00:00
$templateCache . put ( "modules/users/views/authentication/signup.client.view.html" ,
2017-09-20 18:29:17 +00:00
"<section class=\"auth signup-view valign-wrapper\" data-ng-controller=AuthenticationController><div class=\"row valign\"><div class=\"col-md-12 text-center vcenter\" style=\"padding-bottom: 50px\"><img src=/static/modules/core/img/logo_white.svg height=100px></div><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><fieldset><div data-ng-show=error id=signup_errors class=text-center>{{'SIGNUP_ERROR_TEXT' | translate}}:<br><strong data-ng-bind=error></strong></div><div class=form-group><input id=username name=username class=form-control ng-pattern=languageRegExp ng-minlength=4 ng-model=credentials.username placeholder=\"{{ 'USERNAME_LABEL' | translate }}\" ng-minlength=4></div><div class=form-group><input type=email id=email name=email class=form-control ng-model=credentials.email placeholder=\"{{ 'EMAIL_LABEL' | translate }}\"></div><div class=form-group><input type=password id=password name=password class=form-control ng-model=credentials.password placeholder=\"{{ 'PASSWORD_LABEL' | translate }}\" ng-minlength=4></div><div class=\"text-center form-group\"><button type=submit class=\"btn btn-signup btn-rounded btn-block\">{{ 'SIGNUP_BTN' | translate }}</button></div></fieldset></form><div class=\"text-center forgot-password\"><a ui-sref=signin>{{ 'SIGN_IN_ACCOUNT_LINK' | translate }}</a></div></div></div></section>" ) ;
2017-07-26 20:41:53 +00:00
$templateCache . put ( "modules/users/views/password/forgot-password.client.view.html" ,
2017-10-07 08:34:01 +00:00
"<section class=\"auth valign-wrapper\" data-ng-controller=PasswordController><div class=\"row valign\"><div class=\"col-md-4 col-md-offset-4\"><div class=\"col-md-12 text-center\" style=\"padding-bottom: 50px\"><img src=/static/modules/core/img/logo_white.svg height=100px></div><div class=col-md-12><form data-ng-submit=askForPasswordReset() autocomplete=off><fieldset><div class=form-group><input id=username name=username class=form-control data-ng-model=credentials.username placeholder=\"{{ 'USERNAME_OR_EMAIL_LABEL' | translate }}\"></div><div class=\"text-center form-group\"><button type=submit class=\"btn btn-signup btn-rounded btn-block\">{{ 'PASSWORD_RESTORE_HEADER' | translate }}</button></div><div data-ng-show=error class=text-center><strong>Error: {{error}}</strong></div><div data-ng-show=success class=text-center><strong>{{success}}</strong></div></fieldset></form></div></div></div></section>" ) ;
2017-07-26 20:41:53 +00:00
$templateCache . put ( "modules/users/views/password/reset-password-invalid.client.view.html" ,
"<section class=\"row text-center\"><h3 class=col-md-12>{{ 'PASSWORD_RESET_INVALID' | translate }}</h3><a href=/#!/password/forgot class=col-md-12>{{ 'ASK_FOR_NEW_PASSWORD' | translate }}</a></section>" ) ;
$templateCache . put ( "modules/users/views/password/reset-password-success.client.view.html" ,
2017-08-02 22:30:12 +00:00
"<section class=\"row text-center\"><h3 class=col-md-12>{{ 'PASSWORD_RESET_SUCCESS' | translate }}</h3><a href=\"/#!/\" class=col-md-12>{{ 'CONTINUE_TO_LOGIN' | translate }}</a></section>" ) ;
2017-07-26 20:41:53 +00:00
$templateCache . put ( "modules/users/views/password/reset-password.client.view.html" ,
"<section class=\"row auth\" data-ng-controller=PasswordController><h3 class=\"col-md-12 text-center\">{{ 'RESET_PASSWORD' | translate }}</h3><div class=\"col-xs-offset-2 col-xs-8 col-md-offset-3 col-md-6\"><form data-ng-submit=resetUserPassword() class=\"signin form-horizontal\" autocomplete=off><fieldset><div class=form-group><label for=newPassword>{{ 'NEW_PASSWORD_LABEL' | translate }}</label><input type=password id=newPassword name=newPassword class=form-control data-ng-model=passwordDetails.newPassword placeholder=\"{{ 'NEW_PASSWORD_LABEL' | translate }}\"></div><div class=form-group><label for=verifyPassword>{{ 'VERIFY_PASSWORD_LABEL' | translate }}</label><input type=password id=verifyPassword name=verifyPassword class=form-control data-ng-model=passwordDetails.verifyPassword placeholder=\"{{ 'VERIFY_PASSWORD_LABEL' | translate }}\"></div><div class=\"text-center form-group\"><button type=submit class=\"btn btn-large btn-primary\">{{ 'UPDATE_PASSWORD_LABEL' | translate }}</button></div><div data-ng-show=error class=\"text-center text-danger\"><strong>{{error}}</strong></div><div data-ng-show=success class=\"text-center text-success\"><strong>{{success}}</strong></div></fieldset></form></div></section>" ) ;
$templateCache . put ( "modules/users/views/settings/change-password.client.view.html" ,
"<header data-ng-include=\"'/static/modules/core/views/header.client.view.html'\"></header><section class=row data-ng-controller=SettingsController><h3 class=\"col-md-12 text-center\">{{ 'CHANGE_PASSWORD' | translate }}</h3><div class=\"col-xs-offset-2 col-xs-8 col-md-offset-3 col-md-6\"><form data-ng-submit=changeUserPassword() class=\"signin form-horizontal\" autocomplete=off><fieldset><div class=form-group><label for=currentPassword>{{ 'CURRENT_PASSWORD_LABEL' | translate }}</label><input type=password id=currentPassword name=currentPassword class=form-control data-ng-model=passwordDetails.currentPassword placeholder=\"{{ 'CURRENT_PASSWORD_LABEL' | translate }}\"></div><hr><div class=form-group><label for=newPassword>{{ 'NEW_PASSWORD_LABEL' | translate }}</label><input type=password id=newPassword name=newPassword class=form-control data-ng-model=passwordDetails.newPassword placeholder=\"{{ 'NEW_PASSWORD_LABEL' | translate }}\"></div><div class=form-group><label for=verifyPassword>{{ 'VERIFY_PASSWORD_LABEL' | translate }}</label><input type=password id=verifyPassword name=verifyPassword class=form-control data-ng-model=passwordDetails.verifyPassword placeholder=\"{{ 'VERIFY_PASSWORD_LABEL' | translate }}\"></div><div class=\"text-center form-group\"><button type=submit class=\"btn btn-large btn-primary\">{{ 'SAVE_PASSWORD_BTN' | translate }}</button></div><div data-ng-show=success class=\"text-center text-success\"><strong>{{ 'PASSWORD_CHANGE_SUCCESS' | translate }}</strong></div><div data-ng-show=error class=\"text-center text-danger\"><strong data-ng-bind=error></strong></div></fieldset></form></div></section>" ) ;
$templateCache . put ( "modules/users/views/settings/edit-profile.client.view.html" ,
"<header data-ng-include=\"'/static/modules/core/views/header.client.view.html'\"></header><section class=row data-ng-controller=SettingsController><h2 class=\"col-xs-offset-1 col-xs-10 text-center\">{{ 'EDIT_PROFILE' | translate }}</h2><div class=\"col-xs-offset-3 col-xs-6\"><form name=userForm data-ng-submit=updateUserProfile(userForm.$valid) class=\"signin form-horizontal\" autocomplete=off><fieldset><div data-ng-show=success class=\"text-center text-success\"><strong>{{ 'PROFILE_SAVE_SUCCESS' | translate }}</strong></div><div data-ng-show=error class=\"text-center text-danger\">{{ 'PROFILE_SAVE_ERROR' | translate }}<br><strong data-ng-bind=error></strong></div><div class=\"form-group row\"><div class=\"col-xs-7 field-title\">{{ 'FIRST_NAME_LABEL' | translate }}</div><div class=\"col-xs-12 field-input\"><input id=firstName name=firstName class=form-control data-ng-model=user.firstName ng-pattern=\"/^[\\w0-9 \\-.]*$/\"></div></div><div class=\"form-group row\"><div class=\"col-xs-7 field-title\">{{ 'LAST_NAME_LABEL' | translate }}</div><div class=\"col-xs-12 field-input\"><input id=lastName name=lastName class=form-control data-ng-model=user.lastName ng-pattern=\"/^[\\w0-9 \\-.]*$/\"></div></div><div class=row><hr></div><div class=\"row form-group\"><div class=\"col-xs-7 field-title\">{{ 'LANGUAGE_LABEL' | translate }}</div><div class=\"col-xs-12 field-input\"><select ng-model=user.language required><option ng-repeat=\"language in languages\" ng-selected=\"language == user.language\" value={{language}}>{{language}}</option></select></div></div><div class=\"row form-group\"><div class=\"col-xs-7 field-title\">{{ 'USERNAME_LABEL' | translate }}</div><div class=\"col-xs-12 field-input\"><input id=username name=username class=form-control data-ng-model=user.username></div></div><div class=\"row form-group\"><div class=\"col-xs-7 field-title\">{{ 'EMAIL_LABEL' | translate }}</div><div class=\"col-xs-12 field-input\"><input type=email id=email name=email class=form-control data-ng-model=user.email></div></div><div class=\"text-center form-group\"><button type=submit class=\"btn btn-signup btn-rounded\">{{ 'SAVE_CHANGES' | translate }}</button> <button type=none ng-click=cancel() class=\"btn btn-rounded\">{{ 'CANCEL_BTN' | translate }}</button></div></fieldset></form></div></section>" ) ;
$templateCache . put ( "modules/users/views/settings/social-accounts.client.view.html" ,
2017-08-02 22:30:12 +00:00
"<header data-ng-include=\"'/static/modules/core/views/header.client.view.html'\"></header><section class=row data-ng-controller=SettingsController><h3 class=\"col-md-12 text-center\" data-ng-show=hasConnectedAdditionalSocialAccounts()>{{ 'CONNECTED_SOCIAL_ACCOUNTS' | translate }}:</h3><div class=\"col-md-12 text-center\"><div data-ng-repeat=\"(providerName, providerData) in user.additionalProvidersData\" class=remove-account-container><img ng-src=/modules/users/img/buttons/{{providerName}}.png> <a class=\"btn btn-danger btn-remove-account\" data-ng-click=removeUserSocialAccount(providerName)><i class=\"glyphicon glyphicon-trash\"></i></a></div></div><h3 class=\"col-md-12 text-center\">{{ 'CONNECT_OTHER_SOCIAL_ACCOUNTS' | translate }}</h3><div class=\"col-md-12 text-center\"><a href=/auth/facebook data-ng-hide=\"isConnectedSocialAccount('facebook')\" class=undecorated-link><img src=/modules/users/img/buttons/facebook.png></a> <a href=/auth/twitter data-ng-hide=\"isConnectedSocialAccount('twitter')\" class=undecorated-link><img src=/modules/users/img/buttons/twitter.png></a> <a href=/auth/google data-ng-hide=\"isConnectedSocialAccount('google')\" class=undecorated-link><img src=/modules/users/img/buttons/google.png></a> <a href=/auth/linkedin data-ng-hide=\"isConnectedSocialAccount('linkedin')\" class=undecorated-link><img src=/modules/users/img/buttons/linkedin.png></a> <a href=/auth/github data-ng-hide=\"isConnectedSocialAccount('github')\" class=undecorated-link><img src=/modules/users/img/buttons/github.png></a></div></section>" ) ;
2017-07-26 20:41:53 +00:00
$templateCache . put ( "modules/users/views/verify/resend-verify-email.client.view.html" ,
2017-08-02 22:30:12 +00:00
"<section class=\"auth valign-wrapper\" data-ng-controller=VerifyController><section class=\"row valign\" ng-if=!isResetSent><div class=\"col-md-4 col-md-offset-4\"><div class=\"col-md-12 text-center\" style=\"padding-bottom: 50px\"><img src=/static/modules/core/img/logo_white.svg height=100px></div><div data-ng-show=error class=\"text-center text-danger\"><strong>{{error}}</strong></div><div class=col-md-12><form data-ng-submit=resendVerifyEmail() class=\"signin form-horizontal\" autocomplete=off><fieldset><div class=form-group><input id=email name=email class=form-control data-ng-model=credentials.email placeholder=\"{{ 'ENTER_ACCOUNT_EMAIL' | translate}}\"></div><div class=\"text-center form-group\"><button type=submit class=\"btn btn-signup btn-rounded btn-block\" ng-click=resendVerifyEmail()>{{ 'RESEND_VERIFICATION_EMAIL' | translate }}</button></div></fieldset></form></div></div></section><section class=\"row valign\" ng-if=isResetSent><div class=\"col-md-4 col-md-offset-4\"><div class=\"col-md-12 text-center\" style=\"padding-bottom: 50px\"><img src=/static/modules/core/img/logo_white.svg height=100px></div><h3 class=\"col-md-12 text-center\">{{ 'VERIFICATION_EMAIL_SENT' | translate }}</h3><div class=col-md-12><h2>{{ 'VERIFICATION_EMAIL_SENT_TO' | translate }} {{username}}.<br>{{ 'NOT_ACTIVATED_YET' | translate }}</h2><p>{{ 'CHECK_YOUR_EMAIL' | translate }} <a href=mail:polydaic@gmail.com>polydaic@gmail.com</a></p><div class=\"text-center form-group\"><button type=submit class=\"btn btn-large btn-primary btn-rounded\"><a href=\"/#!/\" style=color:white>{{ 'CONTINUE' | translate }}</a></button></div></div></div></section></section>" ) ;
2017-07-26 20:41:53 +00:00
$templateCache . put ( "modules/users/views/verify/verify-account.client.view.html" ,
"<section class=auth data-ng-controller=VerifyController ng-init=validateVerifyToken()><section class=\"row text-center\" ng-if=isResetSent><div class=\"col-md-4 col-md-offset-4\"><div class=\"col-md-12 text-center\" style=\"padding-bottom: 50px\"><img src=/static/modules/core/img/logo_white.svg height=100px></div><h3 class=col-md-12>{{ 'VERIFY_SUCCESS' | translate }}</h3><div class=col-md-12><a href=/#!/signin class=\"btn btn-signup btn-rounded btn-block\">{{ 'CONTINUE_TO_LOGIN' | translate }}</a></div></div></section><section class=\"row text-center\" ng-if=!isResetSent><div class=\"col-md-4 col-md-offset-4\"><div class=\"col-md-12 text-center\" style=\"padding-bottom: 50px\"><img src=/static/modules/core/img/logo_white.svg height=100px></div><h3 class=col-md-12>{{ 'VERIFY_ERROR' | translate }}</h3><div class=col-md-12><a href=/#!/verify class=\"btn btn-rounded btn-default\">{{ 'REVERIFY_ACCOUNT_LINK' | translate }}</a></div><div class=col-sm-12><a href=/#!/signin class=\"btn btn-rounded btn-primary\">{{ 'SIGNIN_BTN' | translate }}</a></div></div></section></section>" ) ;
2017-09-30 00:33:55 +00:00
$templateCache . put ( "form_modules/forms/base/views/directiveViews/entryPage/startPage.html" ,
"<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>" ) ;
$templateCache . put ( "form_modules/forms/base/views/directiveViews/field/date.html" ,
2017-10-07 08:34:01 +00:00
"<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-focus=\"setActiveField(field._id, null, false)\" 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 on-tab-key=nextField() on-tab-and-shift-key=prevField() ng-change=nextField()></div></div></div>" ) ;
2017-09-30 00:33:55 +00:00
$templateCache . put ( "form_modules/forms/base/views/directiveViews/field/dropdown.html" ,
2017-10-07 08:34:01 +00:00
"<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 ng-focus=\"setActiveField(field._id, null, false)\" theme=selectize search-enabled=true search-by=option_value set-search-to-answer=true ng-required=field.required on-tab-and-shift-key=prevField() on-tab-key=nextField() ng-change=nextField()><ui-select-match placeholder=\"Type or select an option\"></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>" ) ;
2017-09-30 00:33:55 +00:00
$templateCache . put ( "form_modules/forms/base/views/directiveViews/field/hidden.html" ,
"<input type=hidden>" ) ;
$templateCache . put ( "form_modules/forms/base/views/directiveViews/field/legal.html" ,
"<div class=\"field row radio legal\" on-enter-or-tab-key=nextField() 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}\"><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><label class=\"btn col-md-5 col-xs-12\" ng-class=\"{activeBtn: field.fieldValue == 'true'}\"><input class=focusOn 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=\"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=\"nextField()\"><div class=letter style=float:left>N</div><span>{{ 'LEGAL_NO_ACCEPT' | translate }}</span></label></div></div></div><br>" ) ;
$templateCache . put ( "form_modules/forms/base/views/directiveViews/field/radio.html" ,
2017-10-07 08:34:01 +00:00
"<div class=\"field row radio\" on-enter-or-tab-key=nextField() on-tab-and-shift-key=prevField() 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}\" ng-focus=\"setActiveField(field._id, null, false)\" type=radio class=focusOn 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></span></label></div></div></div><br>" ) ;
2017-09-30 00:33:55 +00:00
$templateCache . put ( "form_modules/forms/base/views/directiveViews/field/rating.html" ,
"<div class=\"textfield field row\"><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}} ng-init=\"field.fieldValue = 1\" on-shape-click=true on-star-click=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() class=\"angular-input-stars focusOn\"></input-stars></div></div>" ) ;
$templateCache . put ( "form_modules/forms/base/views/directiveViews/field/statement.html" ,
2017-10-07 08:34:01 +00:00
"<div class=\"statement field row\" on-enter-or-tab-key=nextField() on-tab-and-shift-key=prevField()><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-click=nextField()>{{ 'CONTINUE' | translate }}</button></div></div></div>" ) ;
2017-09-30 00:33:55 +00:00
$templateCache . put ( "form_modules/forms/base/views/directiveViews/field/textarea.html" ,
2017-10-07 08:34:01 +00:00
"<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>Press SHIFT+ENTER to add a newline</small><textarea class=\"textarea focusOn\" type=text ng-focus=\"setActiveField(field._id, null, false)\" ng-model=field.fieldValue ng-model-options=\"{ debounce: 250 }\" ng-class=\"{ 'no-border': !!field.fieldValue }\" value={{field.fieldValue}} ng-required=field.required on-enter-or-tab-key=nextField() on-tab-and-shift-key=prevField() style=\"border: none; border-left: lightgrey dashed 2px\">\n" +
2017-09-30 00:33:55 +00:00
" </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>" ) ;
$templateCache . put ( "form_modules/forms/base/views/directiveViews/field/textfield.html" ,
2017-10-07 08:34:01 +00:00
"<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-focus=\"setActiveField(field._id, null, false)\" ng-model=field.fieldValue ng-model-options=\"{ debounce: 250 }\" value=field.fieldValue 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.fieldType == 'number'\">{{ '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\" ng-disabled=\"!field.fieldValue || field.$invalid\" style=\"padding: 4px; margin-top:8px; background: rgba(255,255,255,0.5)\"><button ng-disabled=\"!field.fieldValue || field.$invalid\" ng-style=\"{'background-color':design.colors.buttonColor, 'color':design.colors.buttonTextColor}\" ng-click=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>" ) ;
2017-09-30 00:33:55 +00:00
$templateCache . put ( "form_modules/forms/base/views/directiveViews/field/yes_no.html" ,
2017-10-07 08:34:01 +00:00
"<div class=\"field row radio\" ng-click=\"setActiveField(field._id, index, true)\" key-to-truthy key-char-truthy=y key-char-falsey=n field=field on-tab-key=nextField() on-tab-and-shift-key=prevField() on-valid-key=nextField()><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><label class=\"btn btn-default col-md-2 col-sm-3 col-xs-7\" 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-focus=\"setActiveField(field._id, null, false)\" ng-model=field.fieldValue ng-model-options=\"{ debounce: 250 }\" ng-required=field.required ng-change=\"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 style=\"margin-top: 10px\"><label class=\"btn btn-default col-md-2 col-sm-3 col-xs-7\" style=\"background: rgba(0,0,0,0.1); text-align:left\"><input type=radio value=false style=\"opacity:0; margin-left:0px\" ng-focus=\"setActiveField(field._id, null, false)\" ng-model=field.fieldValue ng-model-options=\"{ debounce: 250 }\" ng-required=field.required ng-change=\"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>" ) ;
2017-09-30 00:33:55 +00:00
$templateCache . put ( "form_modules/forms/base/views/directiveViews/form/submit-form.client.view.html" ,
2017-10-07 08:34:01 +00:00
"<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\" ng-style=\"{'color': myform.design.colors.questionColor}\">{{myform.startPage.introTitle}}</h1></div><div class=\"col-xs-10 col-xs-offset-1 text-center\" style=\"overflow-wrap: break-word\"><p style=\"font-weight: 100; font-size: 16px\" ng-style=\"{'color': myform.design.colors.questionColor}\">{{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><div class=form-fields ng-show=\"!myform.submitted && !myform.startPage.showStart\" ng-style=\"{ 'border-color': myform.design.colors.buttonTextColor }\"><div class=\"row form-field-wrapper\"><form name=forms.myForm novalidate class=submission-form><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><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-top: 30vh; height: 100vh; margin-left: 1%; margin-right: 1%\" on-tab-and-shift-key=prevField() on-tab-key=nextField() on-enter-key=submitForm()><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-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></form></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\" > < a href
$templateCache . put ( "form_modules/forms/base/views/form-not-found.client.view.html" ,
"<script>$(\".loader\").fadeOut(\"slow\");</script><section class=\"public-form auth sigin-view valign-wrapper\"><div class=\"row valign\"><h3 class=\"col-md-12 text-center\">404 - Form Does not Exist</h3><div class=\"col-md-4 col-md-offset-4\"><div class=\"col-md-12 text-center\" style=\"padding-bottom: 50px\">The form you are trying to access does not exist. Sorry about that!</div></div></div></section>" ) ;
2017-09-30 00:33:55 +00:00
$templateCache . put ( "form_modules/forms/base/views/form-unauthorized.client.view.html" ,
2017-10-07 08:34:01 +00:00
"<script>$(\".loader\").fadeOut(\"slow\");</script><section class=\"public-form auth sigin-view valign-wrapper\"><div class=\"row valign\"><h3 class=\"col-md-12 text-center\">Not Authorized to Access Form</h3><div class=\"col-md-4 col-md-offset-4\"><div class=\"col-md-12 text-center\" style=\"padding-bottom: 50px\">The form you are trying to access is currently private and not accesible publically.<br>If you are the owner of the form, you can set it to \"Public\" in the \"Configuration\" panel in the form admin.</div></div></div></section>" ) ;
2017-09-30 00:33:55 +00:00
$templateCache . put ( "form_modules/forms/base/views/submit-form.client.view.html" ,
2017-10-07 08:34:01 +00:00
"<section class=public-form><submit-form-directive myform=myform></submit-form-directive></section><script ng-if=myform.analytics.gaCode>window.ga=function(){ga.q.push(arguments)};ga.q=[];ga.l=+new Date;\n" +
2017-10-02 10:18:47 +00:00
" ga('create', '{{myform.analytics.gaCode}}', 'auto'); ga('send', 'pageview');</script><script ng-if=myform.analytics.gaCode src=https://www.google-analytics.com/analytics.js async defer></script>" ) ;
2017-07-26 20:41:53 +00:00
} ] ) ;
2016-05-20 20:35:50 +00:00
'use strict' ;
2016-06-08 23:12:48 +00:00
// Use Application configuration module to register a new module
ApplicationConfiguration . registerModule ( 'core' , [ 'users' ] ) ;
2016-05-20 20:35:50 +00:00
2016-06-08 23:12:48 +00:00
'use strict' ;
2016-05-20 20:35:50 +00:00
2016-06-08 23:12:48 +00:00
// Use Application configuration module to register a new module
ApplicationConfiguration . registerModule ( 'forms' , [
'ngFileUpload' , 'ui.router.tabs' , 'ui.date' , 'ui.sortable' ,
2016-11-02 21:29:10 +00:00
'angular-input-stars' , 'users' , 'ngclipboard'
2016-06-08 23:12:48 +00:00
] ) ; //, 'colorpicker.module' @TODO reactivate this module
2016-05-20 20:35:50 +00:00
'use strict' ;
2016-06-08 23:12:48 +00:00
// Use Application configuration module to register a new module
ApplicationConfiguration . registerModule ( 'users' ) ;
'use strict' ;
2016-05-20 20:35:50 +00:00
2017-09-30 00:33:55 +00:00
// Setting up route
angular . module ( 'core' ) . config ( [ '$stateProvider' , '$urlRouterProvider' ,
function ( $stateProvider , $urlRouterProvider , Authorization ) {
// Redirect to home view when route not found
$urlRouterProvider . otherwise ( '/forms' ) ;
}
] ) ;
2016-06-18 21:01:02 +00:00
2017-09-30 00:33:55 +00:00
angular . module ( ApplicationConfiguration . applicationModuleName ) . run ( [ '$rootScope' , 'Auth' , '$state' , '$stateParams' ,
function ( $rootScope , Auth , $state , $stateParams ) {
2016-06-18 21:01:02 +00:00
2017-09-30 00:33:55 +00:00
$rootScope . $state = $state ;
$rootScope . $stateParams = $stateParams ;
2017-03-10 18:25:35 +00:00
2017-09-30 00:33:55 +00:00
// add previous state property
$rootScope . $on ( '$stateChangeSuccess' , function ( event , toState , toParams , fromState ) {
$state . previous = fromState ;
2016-06-18 21:01:02 +00:00
2017-09-30 00:33:55 +00:00
var statesToIgnore = [ 'home' , 'signin' , 'resendVerifyEmail' , 'verify' , 'signup' , 'signup-success' , 'forgot' , 'reset-invalid' , 'reset' , 'reset-success' ] ;
2016-06-18 21:01:02 +00:00
2017-09-30 00:33:55 +00:00
//Redirect to listForms if user is authenticated
if ( statesToIgnore . indexOf ( toState . name ) > 0 ) {
if ( Auth . isAuthenticated ( ) ) {
event . preventDefault ( ) ; // stop current execution
$state . go ( 'listForms' ) ; // go to listForms page
}
}
//Redirect to 'signup' route if user is not authenticated
else if ( toState . name !== 'access_denied' && ! Auth . isAuthenticated ( ) && toState . name !== 'submitForm' ) {
event . preventDefault ( ) ; // stop current execution
$state . go ( 'listForms' ) ; // go to listForms page
}
2016-06-18 21:01:02 +00:00
2017-09-30 00:33:55 +00:00
} ) ;
2016-06-18 21:01:02 +00:00
2017-09-30 00:33:55 +00:00
}
] ) ;
2016-06-18 21:01:02 +00:00
2017-09-30 00:33:55 +00:00
//Page access/authorization logic
angular . module ( ApplicationConfiguration . applicationModuleName ) . run ( [ '$rootScope' , 'Auth' , 'User' , 'Authorizer' , '$state' , '$stateParams' ,
function ( $rootScope , Auth , User , Authorizer , $state , $stateParams ) {
$rootScope . $on ( '$stateChangeStart' , function ( event , next ) {
var authenticator , permissions , user ;
permissions = next && next . data && next . data . permissions ? next . data . permissions : null ;
2016-06-18 21:01:02 +00:00
2017-09-30 00:33:55 +00:00
Auth . ensureHasCurrentUser ( User ) ;
user = Auth . currentUser ;
2017-07-31 21:30:55 +00:00
2017-09-30 00:33:55 +00:00
if ( user ) {
authenticator = new Authorizer ( user ) ;
2017-10-02 10:18:47 +00:00
2017-09-30 00:33:55 +00:00
if ( ( permissions !== null ) ) {
if ( ! authenticator . canAccess ( permissions ) ) {
event . preventDefault ( ) ;
$state . go ( 'access_denied' ) ;
}
}
}
} ) ;
} ] ) ;
2016-06-18 21:01:02 +00:00
'use strict' ;
2017-09-30 00:33:55 +00:00
angular . module ( 'core' ) . controller ( 'HeaderController' , [ '$rootScope' , '$scope' , 'Menus' , '$state' , 'Auth' , 'User' , '$window' , '$translate' , '$locale' ,
function ( $rootScope , $scope , Menus , $state , Auth , User , $window , $translate , $locale ) {
2017-07-20 23:09:21 +00:00
2017-09-30 00:33:55 +00:00
$rootScope . signupDisabled = $window . signupDisabled ;
2017-07-20 23:09:21 +00:00
2017-09-30 00:33:55 +00:00
$scope . user = $rootScope . user = Auth . ensureHasCurrentUser ( User ) ;
2017-07-20 23:09:21 +00:00
2017-09-30 00:33:55 +00:00
$scope . authentication = $rootScope . authentication = Auth ;
2017-07-20 23:09:21 +00:00
2017-09-30 00:33:55 +00:00
$rootScope . languages = $scope . languages = [ 'en' , 'fr' , 'es' , 'it' , 'de' ] ;
2017-07-20 23:09:21 +00:00
2017-09-30 00:33:55 +00:00
//Set global app language
if ( $scope . authentication . isAuthenticated ( ) ) {
$rootScope . language = $scope . user . language ;
} else {
$rootScope . language = $locale . id . substring ( 0 , 2 ) ;
}
$translate . use ( $rootScope . language ) ;
2017-07-20 23:09:21 +00:00
2017-09-30 00:33:55 +00:00
$scope . isCollapsed = false ;
$rootScope . hideNav = false ;
$scope . menu = Menus . getMenu ( 'topbar' ) ;
2017-07-20 23:09:21 +00:00
2017-09-30 00:33:55 +00:00
$scope . signout = function ( ) {
var promise = User . logout ( ) ;
promise . then ( function ( ) {
Auth . logout ( ) ;
Auth . ensureHasCurrentUser ( User ) ;
$scope . user = $rootScope . user = null ;
$state . go ( 'listForms' ) ;
2017-07-20 23:09:21 +00:00
2017-09-30 00:33:55 +00:00
//Refresh view
$state . reload ( ) ;
} ,
function ( reason ) {
console . error ( 'Logout Failed: ' + reason ) ;
} ) ;
} ;
2017-07-20 23:09:21 +00:00
2017-09-30 00:33:55 +00:00
$scope . toggleCollapsibleMenu = function ( ) {
$scope . isCollapsed = ! $scope . isCollapsed ;
} ;
2017-07-20 23:09:21 +00:00
2017-09-30 00:33:55 +00:00
// Collapsing the menu after navigation
$scope . $on ( '$stateChangeSuccess' , function ( event , toState , toParams , fromState , fromParams ) {
$scope . isCollapsed = false ;
$rootScope . hideNav = false ;
if ( angular . isDefined ( toState . data ) ) {
2017-07-20 23:09:21 +00:00
2017-09-30 00:33:55 +00:00
if ( angular . isDefined ( toState . data . hideNav ) ) {
$rootScope . hideNav = toState . data . hideNav ;
}
}
} ) ;
2017-07-31 21:30:55 +00:00
2017-09-30 00:33:55 +00:00
}
] ) ;
2017-07-20 23:09:21 +00:00
'use strict' ;
2017-09-30 00:33:55 +00:00
//Menu service used for managing menus
angular . module ( 'core' ) . service ( 'Menus' , [
2016-06-18 21:01:02 +00:00
2017-09-30 00:33:55 +00:00
function ( ) {
// Define a set of default roles
this . defaultRoles = [ '*' ] ;
2017-07-20 23:09:21 +00:00
2017-09-30 00:33:55 +00:00
// Define the menus object
this . menus = { } ;
2016-05-05 19:12:40 +00:00
2017-09-30 00:33:55 +00:00
// A private function for rendering decision
var shouldRender = function ( user ) {
if ( user ) {
if ( ~ this . roles . indexOf ( '*' ) ) {
return true ;
}
for ( var userRoleIndex in user . roles ) {
for ( var roleIndex in this . roles ) {
if ( this . roles [ roleIndex ] === user . roles [ userRoleIndex ] ) {
return true ;
}
}
}
return false ;
2016-05-05 19:12:40 +00:00
2017-09-30 00:33:55 +00:00
}
return this . isPublic ;
} ;
2016-06-08 23:56:06 +00:00
2017-09-30 00:33:55 +00:00
// Validate menu existance
this . validateMenuExistance = function ( menuId ) {
if ( menuId && menuId . length ) {
if ( this . menus [ menuId ] ) {
return true ;
} else {
throw new Error ( 'Menu does not exists' ) ;
}
} else {
throw new Error ( 'MenuId was not provided' ) ;
}
} ;
2016-06-08 23:56:06 +00:00
2017-09-30 00:33:55 +00:00
// Get the menu object by menu id
this . getMenu = function ( menuId ) {
// Validate that the menu exists
this . validateMenuExistance ( menuId ) ;
2016-05-05 19:12:40 +00:00
2017-09-30 00:33:55 +00:00
// Return the menu object
return this . menus [ menuId ] ;
} ;
2016-05-05 19:12:40 +00:00
2017-09-30 00:33:55 +00:00
// Add new menu object by menu id
this . addMenu = function ( menuId , isPublic , roles ) {
// Create the new menu
this . menus [ menuId ] = {
isPublic : isPublic || false ,
roles : roles || this . defaultRoles ,
items : [ ] ,
shouldRender : shouldRender
} ;
2016-06-08 23:56:06 +00:00
2017-09-30 00:33:55 +00:00
// Return the menu object
return this . menus [ menuId ] ;
} ;
2016-06-08 23:56:06 +00:00
2017-09-30 00:33:55 +00:00
// Remove existing menu object by menu id
this . removeMenu = function ( menuId ) {
// Validate that the menu exists
this . validateMenuExistance ( menuId ) ;
2016-06-08 23:56:06 +00:00
2017-09-30 00:33:55 +00:00
// Return the menu object
delete this . menus [ menuId ] ;
} ;
2016-06-08 23:56:06 +00:00
2017-09-30 00:33:55 +00:00
// Add menu item object
this . addMenuItem = function ( menuId , menuItemTitle , menuItemURL , menuItemType , menuItemUIRoute , isPublic , roles , position ) {
// Validate that the menu exists
this . validateMenuExistance ( menuId ) ;
2016-06-08 23:56:06 +00:00
2017-09-30 00:33:55 +00:00
// Push new menu item
this . menus [ menuId ] . items . push ( {
title : menuItemTitle ,
link : menuItemURL ,
menuItemType : menuItemType || 'item' ,
menuItemClass : menuItemType ,
uiRoute : menuItemUIRoute || ( '/' + menuItemURL ) ,
isPublic : ( ( isPublic === null || typeof isPublic === 'undefined' ) ? this . menus [ menuId ] . isPublic : isPublic ) ,
roles : ( ( roles === null || typeof roles === 'undefined' ) ? this . menus [ menuId ] . roles : roles ) ,
position : position || 0 ,
items : [ ] ,
shouldRender : shouldRender
} ) ;
2016-05-05 19:12:40 +00:00
2017-09-30 00:33:55 +00:00
// Return the menu object
return this . menus [ menuId ] ;
} ;
2016-05-20 20:35:50 +00:00
2017-09-30 00:33:55 +00:00
// Add submenu item object
this . addSubMenuItem = function ( menuId , rootMenuItemURL , menuItemTitle , menuItemURL , menuItemUIRoute , isPublic , roles , position ) {
// Validate that the menu exists
this . validateMenuExistance ( menuId ) ;
2016-06-20 22:06:41 +00:00
2017-09-30 00:33:55 +00:00
// Search for menu item
for ( var itemIndex in this . menus [ menuId ] . items ) {
if ( this . menus [ menuId ] . items [ itemIndex ] . link === rootMenuItemURL ) {
// Push new submenu item
this . menus [ menuId ] . items [ itemIndex ] . items . push ( {
title : menuItemTitle ,
link : menuItemURL ,
uiRoute : menuItemUIRoute || ( '/' + menuItemURL ) ,
isPublic : ( ( isPublic === null || typeof isPublic === 'undefined' ) ? this . menus [ menuId ] . items [ itemIndex ] . isPublic : isPublic ) ,
roles : ( ( roles === null || typeof roles === 'undefined' ) ? this . menus [ menuId ] . items [ itemIndex ] . roles : roles ) ,
position : position || 0 ,
shouldRender : shouldRender
} ) ;
}
}
2016-06-20 22:06:41 +00:00
2017-09-30 00:33:55 +00:00
// Return the menu object
return this . menus [ menuId ] ;
} ;
2016-06-20 22:06:41 +00:00
2017-09-30 00:33:55 +00:00
// Remove existing menu object by menu id
this . removeMenuItem = function ( menuId , menuItemURL ) {
// Validate that the menu exists
this . validateMenuExistance ( menuId ) ;
2016-06-20 22:06:41 +00:00
2017-09-30 00:33:55 +00:00
// Search for menu item to remove
for ( var itemIndex in this . menus [ menuId ] . items ) {
if ( this . menus [ menuId ] . items [ itemIndex ] . link === menuItemURL ) {
this . menus [ menuId ] . items . splice ( itemIndex , 1 ) ;
2016-06-20 22:06:41 +00:00
}
}
2017-09-30 00:33:55 +00:00
// Return the menu object
return this . menus [ menuId ] ;
} ;
2016-06-20 22:06:41 +00:00
2017-09-30 00:33:55 +00:00
// Remove existing menu object by menu id
this . removeSubMenuItem = function ( menuId , submenuItemURL ) {
// Validate that the menu exists
this . validateMenuExistance ( menuId ) ;
2016-06-20 22:06:41 +00:00
2017-09-30 00:33:55 +00:00
// Search for menu item to remove
for ( var itemIndex in this . menus [ menuId ] . items ) {
for ( var subitemIndex in this . menus [ menuId ] . items [ itemIndex ] . items ) {
if ( this . menus [ menuId ] . items [ itemIndex ] . items [ subitemIndex ] . link === submenuItemURL ) {
this . menus [ menuId ] . items [ itemIndex ] . items . splice ( subitemIndex , 1 ) ;
2016-06-20 22:06:41 +00:00
}
}
}
2017-09-30 00:33:55 +00:00
// Return the menu object
return this . menus [ menuId ] ;
} ;
2016-05-20 20:35:50 +00:00
2017-09-30 00:33:55 +00:00
//Adding the topbar menu
this . addMenu ( 'topbar' , false , [ '*' ] ) ;
2016-06-16 00:38:22 +00:00
2017-09-30 00:33:55 +00:00
//Adding the bottombar menu for the Form-Footer view
this . addMenu ( 'bottombar' , false , [ '*' ] ) ;
}
] ) ;
2016-05-20 20:35:50 +00:00
2016-06-08 23:12:48 +00:00
'use strict' ;
2016-06-20 22:06:41 +00:00
angular . module ( 'core' ) . factory ( 'subdomain' , [ '$location' , function ( $location ) {
var host = $location . host ( ) ;
2017-07-20 23:09:21 +00:00
if ( host . indexOf ( '.' ) < 0 ) {
2016-06-20 22:06:41 +00:00
return null ;
2017-07-20 23:09:21 +00:00
}
return host . split ( '.' ) [ 0 ] ;
2016-06-20 22:06:41 +00:00
} ] ) ;
'use strict' ;
2016-06-08 23:12:48 +00:00
// Configuring the Forms drop-down menus
angular . module ( 'forms' ) . run ( [ 'Menus' ,
function ( Menus ) {
// Set top bar menu items
Menus . addMenuItem ( 'topbar' , 'My Forms' , 'forms' , '' , '/forms' , false ) ;
}
2016-06-18 21:01:02 +00:00
] ) . filter ( 'secondsToDateTime' , [ function ( ) {
return function ( seconds ) {
return new Date ( 1970 , 0 , 1 ) . setSeconds ( seconds ) ;
} ;
2017-09-30 00:33:55 +00:00
} ] ) . filter ( 'formValidity' , [ function ( ) {
2016-06-08 23:12:48 +00:00
return function ( formObj ) {
if ( formObj && formObj . form _fields && formObj . visible _form _fields ) {
//get keys
var formKeys = Object . keys ( formObj ) ;
//we only care about things that don't start with $
var fieldKeys = formKeys . filter ( function ( key ) {
return key [ 0 ] !== '$' ;
} ) ;
2016-05-20 20:35:50 +00:00
2016-06-08 23:12:48 +00:00
var fields = formObj . form _fields ;
2016-05-20 20:35:50 +00:00
2016-06-08 23:12:48 +00:00
var valid _count = fields . filter ( function ( field ) {
if ( typeof field === 'object' && field . fieldType !== 'statement' && field . fieldType !== 'rating' ) {
return ! ! ( field . fieldValue ) ;
2017-07-27 05:22:58 +00:00
} else if ( field . fieldType === 'rating' ) {
return true ;
2016-06-08 23:12:48 +00:00
}
2016-05-05 19:12:40 +00:00
2016-06-08 23:12:48 +00:00
} ) . length ;
return valid _count - ( formObj . form _fields . length - formObj . visible _form _fields . length ) ;
}
return 0 ;
} ;
2017-09-30 00:33:55 +00:00
} ] ) . filter ( 'trustSrc' , [ '$sce' , function ( $sce ) {
return function ( formUrl ) {
return $sce . trustAsResourceUrl ( formUrl ) ;
} ;
} ] ) . config ( [ '$provide' , function ( $provide ) {
2016-06-08 23:12:48 +00:00
$provide . decorator ( 'accordionDirective' , [ "$delegate" , function ( $delegate ) {
var directive = $delegate [ 0 ] ;
directive . replace = true ;
return $delegate ;
} ] ) ;
2016-05-20 20:35:50 +00:00
} ] ) ;
2016-05-05 19:12:40 +00:00
2016-05-20 20:35:50 +00:00
'use strict' ;
2016-06-08 23:12:48 +00:00
// Setting up route
angular . module ( 'forms' ) . config ( [ '$stateProvider' ,
2016-05-20 20:35:50 +00:00
2016-06-08 23:12:48 +00:00
function ( $stateProvider ) {
// Forms state routing
$stateProvider .
state ( 'listForms' , {
url : '/forms' ,
2017-10-19 00:27:07 +00:00
templateUrl : 'modules/forms/admin/views/list-forms.client.view.html' ,
resolve : {
Forms : 'GetForms' ,
myForms : [ "GetForms" , "$q" , function ( GetForms , $q ) {
var deferred = $q . defer ( ) ;
GetForms . query ( function ( forms ) {
deferred . resolve ( forms ) ;
} ) ;
return deferred . promise ;
} ]
} ,
controller : 'ListFormsController' ,
controllerAs : 'ctrl'
2016-07-05 01:07:25 +00:00
} ) . state ( 'submitForm' , {
url : '/forms/:formId' ,
2017-09-30 00:33:55 +00:00
templateUrl : '/static/form_modules/forms/base/views/submit-form.client.view.html' ,
2016-07-05 01:07:25 +00:00
data : {
hideNav : true
} ,
resolve : {
2017-09-30 00:33:55 +00:00
Forms : 'GetForms' ,
myForm : [ "GetForms" , "$stateParams" , "$q" , function ( GetForms , $stateParams , $q ) {
var deferred = $q . defer ( ) ;
GetForms . get ( { formId : $stateParams . formId } , function ( resolvedForm ) {
deferred . resolve ( resolvedForm ) ;
} ) ;
return deferred . promise ;
} ]
2016-07-05 01:07:25 +00:00
} ,
controller : 'SubmitFormController' ,
controllerAs : 'ctrl'
} ) . state ( 'viewForm' , {
2016-06-08 23:12:48 +00:00
url : '/forms/:formId/admin' ,
templateUrl : 'modules/forms/admin/views/admin-form.client.view.html' ,
data : {
permissions : [ 'editForm' ]
} ,
resolve : {
2017-09-30 00:33:55 +00:00
GetForms : 'GetForms' ,
myForm : [ "GetForms" , "$stateParams" , "$q" , function ( GetForms , $stateParams , $q ) {
var deferred = $q . defer ( ) ;
GetForms . get ( { formId : $stateParams . formId } , function ( resolvedForm ) {
deferred . resolve ( resolvedForm ) ;
} ) ;
return deferred . promise ;
2016-06-08 23:12:48 +00:00
} ]
} ,
controller : 'AdminFormController'
} ) . state ( 'viewForm.configure' , {
url : '/configure' ,
templateUrl : 'modules/forms/admin/views/adminTabs/configure.html'
} ) . state ( 'viewForm.design' , {
url : '/design' ,
templateUrl : 'modules/forms/admin/views/adminTabs/design.html'
} ) . state ( 'viewForm.analyze' , {
url : '/analyze' ,
2016-11-09 19:04:47 +00:00
templateUrl : 'modules/forms/admin/views/adminTabs/analyze.html'
2016-06-08 23:12:48 +00:00
} ) . state ( 'viewForm.create' , {
url : '/create' ,
templateUrl : 'modules/forms/admin/views/adminTabs/create.html'
} ) ;
}
] ) ;
2016-05-20 20:35:50 +00:00
2017-09-30 00:33:55 +00:00
'use strict' ;
2016-05-20 20:35:50 +00:00
2017-09-30 00:33:55 +00:00
//Forms service used for communicating with the forms REST endpoints
angular . module ( 'forms' ) . factory ( 'GetForms' , [ '$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 ) ;
2016-05-20 20:35:50 +00:00
2017-09-30 00:33:55 +00:00
form . visible _form _fields = _ . filter ( form . form _fields , function ( field ) {
return ( field . deletePreserved === false ) ;
} ) ;
return form ;
}
} ,
'update' : {
method : 'PUT'
} ,
'save' : {
method : 'POST'
}
} ) ;
}
] ) ;
2016-05-20 20:35:50 +00:00
2016-06-08 23:12:48 +00:00
'use strict' ;
2016-05-20 20:35:50 +00:00
2016-06-08 23:12:48 +00:00
// Config HTTP Error Handling
angular . module ( 'users' ) . config ( [ '$httpProvider' ,
function ( $httpProvider ) {
$httpProvider . interceptors . push ( [ "$q" , "$location" , function ( $q , $location ) {
return {
responseError : function ( response ) {
if ( $location . path ( ) !== '/users/me' && response . config ) {
if ( response . config . url !== '/users/me' ) {
if ( response . status === 401 ) {
// save the current location so that login can redirect back
$location . nextAfterLogin = $location . path ( ) ;
$location . path ( '/signin' ) ;
} else if ( response . status === 403 ) {
$location . path ( '/access_denied' ) ;
}
}
2016-06-04 23:34:43 +00:00
2016-06-08 23:12:48 +00:00
}
return $q . reject ( response ) ;
}
} ;
} ] ) ;
} ] ) ;
2016-05-20 20:35:50 +00:00
2016-06-08 23:12:48 +00:00
'use strict' ;
2016-05-20 20:35:50 +00:00
2016-06-08 23:12:48 +00:00
// Setting up route
angular . module ( 'users' ) . config ( [ '$stateProvider' ,
function ( $stateProvider ) {
2016-05-20 20:35:50 +00:00
2016-06-08 23:12:48 +00:00
var checkLoggedin = function ( $q , $timeout , $state , User , Auth ) {
var deferred = $q . defer ( ) ;
2017-03-30 22:14:19 +00:00
2016-06-08 23:12:48 +00:00
if ( Auth . currentUser && Auth . currentUser . email ) {
$timeout ( deferred . resolve ) ;
}
else {
Auth . currentUser = User . getCurrent (
function ( ) {
Auth . login ( ) ;
$timeout ( deferred . resolve ( ) ) ;
} ,
function ( ) {
Auth . logout ( ) ;
$timeout ( deferred . reject ( ) ) ;
$state . go ( 'signin' , { reload : true } ) ;
} ) ;
}
2016-05-20 20:35:50 +00:00
2016-06-08 23:12:48 +00:00
return deferred . promise ;
} ;
checkLoggedin . $inject = [ "$q" , "$timeout" , "$state" , "User" , "Auth" ] ;
2016-05-20 20:35:50 +00:00
2016-06-08 23:12:48 +00:00
var checkSignupDisabled = function ( $window , $timeout , $q ) {
var deferred = $q . defer ( ) ;
if ( $window . signupDisabled ) {
$timeout ( deferred . reject ( ) ) ;
} else {
$timeout ( deferred . resolve ( ) ) ;
}
return deferred . promise ;
} ;
checkSignupDisabled . $inject = [ "$window" , "$timeout" , "$q" ] ;
// Users state routing
$stateProvider .
state ( 'profile' , {
resolve : {
loggedin : checkLoggedin
} ,
url : '/settings/profile' ,
templateUrl : 'modules/users/views/settings/edit-profile.client.view.html'
} ) .
state ( 'password' , {
resolve : {
loggedin : checkLoggedin
} ,
url : '/settings/password' ,
templateUrl : 'modules/users/views/settings/change-password.client.view.html'
} ) .
state ( 'accounts' , {
resolve : {
loggedin : checkLoggedin
} ,
url : '/settings/accounts' ,
templateUrl : 'modules/users/views/settings/social-accounts.client.view.html'
} ) .
state ( 'signup' , {
resolve : {
isDisabled : checkSignupDisabled
} ,
url : '/signup' ,
templateUrl : 'modules/users/views/authentication/signup.client.view.html'
} ) .
state ( 'signup-success' , {
resolve : {
isDisabled : checkSignupDisabled
} ,
url : '/signup-success' ,
templateUrl : 'modules/users/views/authentication/signup-success.client.view.html'
} ) .
state ( 'signin' , {
url : '/signin' ,
templateUrl : 'modules/users/views/authentication/signin.client.view.html'
} ) .
state ( 'access_denied' , {
url : '/access_denied' ,
templateUrl : 'modules/users/views/authentication/access-denied.client.view.html'
} ) .
state ( 'verify' , {
resolve : {
isDisabled : checkSignupDisabled
} ,
url : '/verify/:token' ,
templateUrl : 'modules/users/views/verify/verify-account.client.view.html'
} ) .
state ( 'resendVerifyEmail' , {
resolve : {
isDisabled : checkSignupDisabled
} ,
url : '/verify' ,
templateUrl : 'modules/users/views/verify/resend-verify-email.client.view.html'
} ) .
state ( 'forgot' , {
url : '/password/forgot' ,
templateUrl : 'modules/users/views/password/forgot-password.client.view.html'
} ) .
state ( 'reset-invalid' , {
url : '/password/reset/invalid' ,
templateUrl : 'modules/users/views/password/reset-password-invalid.client.view.html'
} ) .
state ( 'reset-success' , {
url : '/password/reset/success' ,
templateUrl : 'modules/users/views/password/reset-password-success.client.view.html'
} ) .
state ( 'reset' , {
url : '/password/reset/:token' ,
templateUrl : 'modules/users/views/password/reset-password.client.view.html'
} ) ;
}
2016-05-05 19:12:40 +00:00
] ) ;
2016-05-20 20:35:50 +00:00
2016-05-05 19:12:40 +00:00
'use strict' ;
2016-05-20 20:35:50 +00:00
2016-06-08 23:12:48 +00:00
angular . module ( 'users' ) . controller ( 'AuthenticationController' , [ '$scope' , '$location' , '$state' , '$rootScope' , 'User' , 'Auth' ,
function ( $scope , $location , $state , $rootScope , User , Auth ) {
2016-05-20 20:35:50 +00:00
2016-06-08 23:12:48 +00:00
$scope = $rootScope ;
$scope . credentials = { } ;
$scope . error = '' ;
2016-05-20 20:35:50 +00:00
2016-06-08 23:12:48 +00:00
$scope . signin = function ( ) {
User . login ( $scope . credentials ) . then (
function ( response ) {
Auth . login ( response ) ;
$scope . user = $rootScope . user = Auth . ensureHasCurrentUser ( User ) ;
2017-10-02 10:18:47 +00:00
if ( $state . previous . name !== 'home' && $state . previous . name !== 'verify' && $state . previous . name !== '' ) {
2016-06-08 23:12:48 +00:00
$state . go ( $state . previous . name ) ;
2017-10-02 10:18:47 +00:00
} else {
2016-06-08 23:12:48 +00:00
$state . go ( 'listForms' ) ;
}
} ,
function ( error ) {
$rootScope . user = Auth . ensureHasCurrentUser ( User ) ;
$scope . user = $rootScope . user ;
$scope . error = error ;
2017-07-25 22:08:25 +00:00
console . error ( 'loginError: ' + error ) ;
2016-06-08 23:12:48 +00:00
}
) ;
2016-05-05 19:12:40 +00:00
} ;
2016-06-08 23:12:48 +00:00
$scope . signup = function ( ) {
2017-09-30 00:33:55 +00:00
if ( $scope . credentials === 'admin' ) {
2017-10-02 10:18:47 +00:00
$scope . error = 'Username cannot be \'admin\'. Please pick another username.' ;
2017-09-30 00:33:55 +00:00
return ;
}
2016-06-08 23:12:48 +00:00
User . signup ( $scope . credentials ) . then (
function ( response ) {
$state . go ( 'signup-success' ) ;
} ,
function ( error ) {
2017-07-25 22:08:25 +00:00
console . error ( error ) ;
2016-06-08 23:12:48 +00:00
if ( error ) {
$scope . error = error ;
2017-07-25 22:08:25 +00:00
console . error ( error ) ;
} else {
console . error ( 'No response received' ) ;
2016-06-08 23:12:48 +00:00
}
}
) ;
2016-05-05 19:12:40 +00:00
} ;
2016-06-08 23:12:48 +00:00
}
] ) ;
2016-05-05 19:12:40 +00:00
'use strict' ;
2016-06-08 23:12:48 +00:00
angular . module ( 'users' ) . controller ( 'PasswordController' , [ '$scope' , '$stateParams' , '$state' , 'User' ,
function ( $scope , $stateParams , $state , User ) {
2017-03-30 22:14:19 +00:00
2016-06-08 23:12:48 +00:00
$scope . error = '' ;
2016-08-26 22:34:29 +00:00
2016-06-08 23:12:48 +00:00
// Submit forgotten password account id
$scope . askForPasswordReset = function ( ) {
User . askForPasswordReset ( $scope . credentials ) . then (
function ( response ) {
$scope . success = response . message ;
$scope . credentials = null ;
} ,
function ( error ) {
$scope . error = error ;
$scope . credentials = null ;
}
) ;
} ;
2016-05-20 20:35:50 +00:00
2016-06-08 23:12:48 +00:00
// Change user password
$scope . resetUserPassword = function ( ) {
$scope . success = $scope . error = null ;
User . resetPassword ( $scope . passwordDetails , $stateParams . token ) . then (
function ( response ) {
// If successful show success message and clear form
$scope . success = response . message ;
$scope . passwordDetails = null ;
// And redirect to the index page
$state . go ( 'reset-success' ) ;
} ,
function ( error ) {
$scope . error = error . message || error ;
$scope . passwordDetails = null ;
}
) ;
} ;
2016-05-20 20:35:50 +00:00
}
2016-05-05 19:12:40 +00:00
] ) ;
2016-10-07 15:31:15 +00:00
2016-05-05 19:12:40 +00:00
'use strict' ;
2016-10-07 15:31:15 +00:00
angular . module ( 'users' ) . controller ( 'SettingsController' , [ '$scope' , '$rootScope' , '$http' , '$state' , 'Users' , 'Auth' ,
function ( $scope , $rootScope , $http , $state , Users , Auth ) {
$scope . user = Auth . currentUser ;
2016-05-05 19:12:40 +00:00
2016-08-26 22:34:29 +00:00
// Check if there are additional accounts
2016-06-08 23:12:48 +00:00
$scope . hasConnectedAdditionalSocialAccounts = function ( provider ) {
for ( var i in $scope . user . additionalProvidersData ) {
return true ;
}
return false ;
} ;
2016-05-05 19:12:40 +00:00
2016-10-07 15:31:15 +00:00
$scope . cancel = function ( ) {
$scope . user = Auth . currentUser ;
} ;
2016-06-08 23:12:48 +00:00
// Check if provider is already in use with current user
$scope . isConnectedSocialAccount = function ( provider ) {
return $scope . user . provider === provider || ( $scope . user . additionalProvidersData && $scope . user . additionalProvidersData [ provider ] ) ;
2016-05-05 19:12:40 +00:00
} ;
2016-06-08 23:12:48 +00:00
// Remove a user social account
$scope . removeUserSocialAccount = function ( provider ) {
$scope . success = $scope . error = null ;
$http . delete ( '/users/accounts' , {
params : {
provider : provider
}
} ) . success ( function ( response ) {
// If successful show success message and clear form
$scope . success = true ;
$scope . user = response ;
} ) . error ( function ( response ) {
$scope . error = response . message ;
} ) ;
} ;
// Update a user profile
$scope . updateUserProfile = function ( isValid ) {
if ( isValid ) {
$scope . success = $scope . error = null ;
var user = new Users ( $scope . user ) ;
user . $update ( function ( response ) {
$scope . success = true ;
$scope . user = response ;
} , function ( response ) {
$scope . error = response . data . message ;
} ) ;
} else {
$scope . submitted = true ;
2016-06-07 21:22:20 +00:00
}
} ;
2016-05-20 20:35:50 +00:00
2016-06-08 23:12:48 +00:00
// Change user password
$scope . changeUserPassword = function ( ) {
$scope . success = $scope . error = null ;
2016-05-20 20:35:50 +00:00
2016-06-08 23:12:48 +00:00
$http . post ( '/users/password' , $scope . passwordDetails ) . success ( function ( response ) {
// If successful show success message and clear form
$scope . success = true ;
$scope . passwordDetails = null ;
} ) . error ( function ( response ) {
$scope . error = response . message ;
} ) ;
} ;
}
] ) ;
2016-10-07 15:31:15 +00:00
2016-06-08 23:12:48 +00:00
'use strict' ;
angular . module ( 'users' ) . controller ( 'VerifyController' , [ '$scope' , '$state' , '$rootScope' , 'User' , 'Auth' , '$stateParams' ,
function ( $scope , $state , $rootScope , User , Auth , $stateParams ) {
$scope . isResetSent = false ;
$scope . credentials = { } ;
$scope . error = '' ;
// Submit forgotten password account id
$scope . resendVerifyEmail = function ( ) {
User . resendVerifyEmail ( $scope . credentials . email ) . then (
function ( response ) {
$scope . success = response . message ;
$scope . credentials = null ;
$scope . isResetSent = true ;
} ,
function ( error ) {
$scope . error = error ;
$scope . credentials . email = null ;
$scope . isResetSent = false ;
}
) ;
} ;
//Validate Verification Token
$scope . validateVerifyToken = function ( ) {
if ( $stateParams . token ) {
console . log ( $stateParams . token ) ;
User . validateVerifyToken ( $stateParams . token ) . then (
function ( response ) {
$scope . success = response . message ;
$scope . isResetSent = true ;
$scope . credentials . email = null ;
} ,
function ( error ) {
$scope . isResetSent = false ;
$scope . error = error ;
$scope . credentials . email = null ;
}
) ;
2016-05-05 19:12:40 +00:00
}
} ;
}
2016-06-07 21:22:20 +00:00
] ) ;
2016-06-07 21:30:15 +00:00
'use strict' ;
2016-05-20 20:35:50 +00:00
2016-06-08 23:12:48 +00:00
angular . module ( 'users' ) . factory ( 'Auth' , [ '$window' ,
function ( $window ) {
2016-05-20 20:35:50 +00:00
2016-06-08 23:12:48 +00:00
var userState = {
isLoggedIn : false
} ;
2016-05-20 20:35:50 +00:00
2016-06-08 23:12:48 +00:00
var service = {
_currentUser : null ,
get currentUser ( ) {
return this . _currentUser ;
} ,
2016-05-20 20:35:50 +00:00
2016-06-08 23:12:48 +00:00
// Note: we can't make the User a dependency of Auth
// because that would create a circular dependency
// Auth <- $http <- $resource <- LoopBackResource <- User <- Auth
ensureHasCurrentUser : function ( User ) {
if ( service . _currentUser && service . _currentUser . username ) {
return service . _currentUser ;
2017-10-02 10:18:47 +00:00
} else if ( $window . user ) {
2016-06-08 23:12:48 +00:00
service . _currentUser = $window . user ;
return service . _currentUser ;
2017-10-02 10:18:47 +00:00
} else {
2016-06-08 23:12:48 +00:00
User . getCurrent ( ) . then ( function ( user ) {
// success
service . _currentUser = user ;
userState . isLoggedIn = true ;
$window . user = service . _currentUser ;
return service . _currentUser ;
} ,
function ( response ) {
userState . isLoggedIn = false ;
service . _currentUser = null ;
$window . user = null ;
return null ;
} ) ;
}
} ,
2016-05-20 20:35:50 +00:00
2016-06-08 23:12:48 +00:00
isAuthenticated : function ( ) {
return ! ! service . _currentUser ;
} ,
2016-05-20 20:35:50 +00:00
2016-06-08 23:12:48 +00:00
getUserState : function ( ) {
return userState ;
} ,
2016-05-20 20:35:50 +00:00
2016-06-08 23:12:48 +00:00
login : function ( new _user ) {
userState . isLoggedIn = true ;
service . _currentUser = new _user ;
} ,
2016-06-01 01:06:45 +00:00
2016-06-08 23:12:48 +00:00
logout : function ( ) {
$window . user = null ;
userState . isLoggedIn = false ;
service . _currentUser = null ;
}
} ;
return service ;
2016-06-01 01:06:45 +00:00
2016-06-08 23:12:48 +00:00
}
] ) ;
2016-05-20 20:35:50 +00:00
2016-06-08 23:12:48 +00:00
'use strict' ;
2016-05-20 20:35:50 +00:00
2016-06-08 23:12:48 +00:00
angular . module ( 'users' ) . service ( 'Authorizer' , [ "APP_PERMISSIONS" , "USER_ROLES" , function ( APP _PERMISSIONS , USER _ROLES ) {
return function ( user ) {
return {
canAccess : function ( permissions ) {
var i , len , permission ;
if ( ! angular . isArray ( permissions ) ) {
permissions = [ permissions ] ;
}
for ( i = 0 , len = permissions . length ; i < len ; i ++ ) {
permission = permissions [ i ] ;
if ( APP _PERMISSIONS [ permission ] === null ) {
throw 'Bad permission value' ;
}
if ( user && user . roles ) {
switch ( permission ) {
case APP _PERMISSIONS . viewAdminSettings :
case APP _PERMISSIONS . editAdminSettings :
return user . roles . indexOf ( USER _ROLES . admin ) > - 1 ;
case APP _PERMISSIONS . viewPrivateForm :
case APP _PERMISSIONS . editForm :
return user . roles . indexOf ( USER _ROLES . admin ) > - 1 || user . roles . indexOf ( USER _ROLES . normal ) > - 1 ;
}
} else {
return false ;
}
}
2016-05-20 20:35:50 +00:00
2016-06-08 23:12:48 +00:00
return false ;
}
} ;
} ;
} ] ) ;
'use strict' ;
2016-05-20 20:35:50 +00:00
2016-06-08 23:12:48 +00:00
angular . module ( 'users' ) . factory ( 'User' , [ '$window' , '$q' , '$timeout' , '$http' , '$state' ,
function ( $window , $q , $timeout , $http , $state ) {
2016-05-20 20:35:50 +00:00
2016-06-08 23:12:48 +00:00
var userService = {
getCurrent : function ( ) {
var deferred = $q . defer ( ) ;
2016-05-20 20:35:50 +00:00
2016-06-08 23:12:48 +00:00
$http . get ( '/users/me' )
. success ( function ( response ) {
deferred . resolve ( response ) ;
} )
. error ( function ( ) {
deferred . reject ( 'User\'s session has expired' ) ;
} ) ;
2016-05-20 20:35:50 +00:00
2016-06-08 23:12:48 +00:00
return deferred . promise ;
} ,
login : function ( credentials ) {
2016-05-20 20:35:50 +00:00
2016-06-08 23:12:48 +00:00
var deferred = $q . defer ( ) ;
2017-03-27 20:32:06 +00:00
$http . post ( '/auth/signin' , credentials ) . then ( function ( response ) {
deferred . resolve ( response . data ) ;
} , function ( error ) {
deferred . reject ( error . data . message || error . data ) ;
2016-06-08 23:12:48 +00:00
} ) ;
2016-05-20 20:35:50 +00:00
2016-06-08 23:12:48 +00:00
return deferred . promise ;
} ,
logout : function ( ) {
2016-06-07 21:30:15 +00:00
2016-06-08 23:12:48 +00:00
var deferred = $q . defer ( ) ;
2017-03-27 20:32:06 +00:00
$http . get ( '/auth/signout' ) . then ( function ( response ) {
2016-06-08 23:12:48 +00:00
deferred . resolve ( null ) ;
2017-03-27 20:32:06 +00:00
} , function ( error ) {
deferred . reject ( error . data . message || error . data ) ;
2016-06-08 23:12:48 +00:00
} ) ;
2016-05-20 20:35:50 +00:00
2016-06-08 23:12:48 +00:00
return deferred . promise ;
} ,
signup : function ( credentials ) {
2016-05-20 20:35:50 +00:00
2016-06-08 23:12:48 +00:00
var deferred = $q . defer ( ) ;
2017-03-27 20:32:06 +00:00
$http . post ( '/auth/signup' , credentials ) . then ( function ( response ) {
2016-06-08 23:12:48 +00:00
// If successful we assign the response to the global user model
2017-03-27 20:32:06 +00:00
deferred . resolve ( response . data ) ;
} , function ( error ) {
deferred . reject ( error . data . message || error . data ) ;
2016-06-08 23:12:48 +00:00
} ) ;
2016-05-20 20:35:50 +00:00
2016-06-08 23:12:48 +00:00
return deferred . promise ;
} ,
2016-05-20 20:35:50 +00:00
2016-06-08 23:12:48 +00:00
resendVerifyEmail : function ( _email ) {
2016-05-20 20:35:50 +00:00
2016-06-08 23:12:48 +00:00
var deferred = $q . defer ( ) ;
2017-03-27 20:32:06 +00:00
$http . post ( '/auth/verify' , { email : _email } ) . then ( function ( response ) {
deferred . resolve ( response . data ) ;
} , function ( error ) {
deferred . reject ( error . data . message || error . data ) ;
2016-06-07 21:30:15 +00:00
} ) ;
2016-05-20 20:35:50 +00:00
2016-06-08 23:12:48 +00:00
return deferred . promise ;
} ,
2016-05-20 20:35:50 +00:00
2016-06-08 23:12:48 +00:00
validateVerifyToken : function ( token ) {
2016-06-07 21:30:15 +00:00
2016-06-08 23:12:48 +00:00
//DAVID: TODO: The valid length of a token should somehow be linked to server config values
//DAVID: TODO: SEMI-URGENT: Should we even be doing this?
var validTokenRe = /^([A-Za-z0-9]{48})$/g ;
if ( ! validTokenRe . test ( token ) ) throw new Error ( 'Error token: ' + token + ' is not a valid verification token' ) ;
2016-05-20 20:35:50 +00:00
2016-06-08 23:12:48 +00:00
var deferred = $q . defer ( ) ;
2017-03-27 20:32:06 +00:00
$http . get ( '/auth/verify/' + token ) . then ( function ( response ) {
deferred . resolve ( response . data ) ;
} , function ( error ) {
deferred . reject ( error . data ) ;
2016-06-08 23:12:48 +00:00
} ) ;
2016-05-20 20:35:50 +00:00
2016-06-08 23:12:48 +00:00
return deferred . promise ;
} ,
2016-05-20 20:35:50 +00:00
2016-06-08 23:12:48 +00:00
resetPassword : function ( passwordDetails , token ) {
2016-05-20 20:35:50 +00:00
2016-06-08 23:12:48 +00:00
var deferred = $q . defer ( ) ;
2017-03-30 22:14:19 +00:00
$http . post ( '/auth/reset/' + token , passwordDetails ) . then ( function ( response ) {
deferred . resolve ( response ) ;
2017-03-27 20:32:06 +00:00
} , function ( error ) {
deferred . reject ( error . data . message || error . data ) ;
2016-06-08 23:12:48 +00:00
} ) ;
2016-06-04 10:53:51 +00:00
2016-06-08 23:12:48 +00:00
return deferred . promise ;
} ,
2016-06-04 10:53:51 +00:00
2016-06-08 23:12:48 +00:00
// Submit forgotten password account id
askForPasswordReset : function ( credentials ) {
2016-06-04 10:53:51 +00:00
2016-06-08 23:12:48 +00:00
var deferred = $q . defer ( ) ;
2017-03-27 20:32:06 +00:00
$http . post ( '/auth/forgot' , credentials ) . then ( function ( response ) {
2016-06-08 23:12:48 +00:00
// Show user success message and clear form
2017-03-27 20:32:06 +00:00
deferred . resolve ( response . data ) ;
} , function ( error ) {
2016-06-08 23:12:48 +00:00
// Show user error message
2017-03-27 20:32:06 +00:00
deferred . reject ( error . data . message || error . data ) ;
2016-06-08 23:12:48 +00:00
} ) ;
2016-06-04 10:53:51 +00:00
2016-06-08 23:12:48 +00:00
return deferred . promise ;
}
2016-06-04 10:53:51 +00:00
2016-06-08 23:12:48 +00:00
} ;
2016-06-04 10:53:51 +00:00
2016-06-08 23:12:48 +00:00
return userService ;
2016-06-04 10:53:51 +00:00
2016-06-08 23:12:48 +00:00
}
] ) ;
2016-06-04 10:53:51 +00:00
2016-06-08 23:12:48 +00:00
'use strict' ;
2016-06-04 10:53:51 +00:00
2016-06-08 23:12:48 +00:00
// Users service used for communicating with the users REST endpoint
angular . module ( 'users' ) . factory ( 'Users' , [ '$resource' ,
function ( $resource ) {
return $resource ( 'users' , { } , {
update : {
method : 'PUT'
}
} ) ;
}
] ) ;
'use strict' ;
2016-06-04 10:53:51 +00:00
2016-06-16 00:38:22 +00:00
angular . module ( 'core' ) . config ( [ '$translateProvider' , function ( $translateProvider ) {
2016-06-18 21:01:02 +00:00
$translateProvider . translations ( 'en' , {
2016-06-16 00:38:22 +00:00
MENU : 'MENU' ,
SIGNUP _TAB : 'Sign Up' ,
SIGNIN _TAB : 'Sign In' ,
SIGNOUT _TAB : 'Signout' ,
EDIT _PROFILE : 'Edit Profile' ,
MY _FORMS : 'My Forms' ,
MY _SETTINGS : 'My Settings' ,
CHANGE _PASSWORD : 'Change Password'
} ) ;
2016-06-18 21:01:02 +00:00
$translateProvider . preferredLanguage ( 'en' )
. fallbackLanguage ( 'en' )
2016-06-16 00:38:22 +00:00
. useSanitizeValueStrategy ( 'escape' ) ;
} ] ) ;
'use strict' ;
2016-06-18 21:01:02 +00:00
angular . module ( 'core' ) . config ( [ '$translateProvider' , function ( $translateProvider ) {
$translateProvider . translations ( 'fr' , {
MENU : 'MENU' ,
SIGNUP _TAB : 'Créer un Compte' ,
SIGNIN _TAB : 'Connexion' ,
SIGNOUT _TAB : 'Créer un compte' ,
EDIT _PROFILE : 'Modifier Mon Profil' ,
MY _FORMS : 'Mes Formulaires' ,
MY _SETTINGS : 'Mes Paramètres' ,
CHANGE _PASSWORD : 'Changer mon Mot de Pass'
} ) ;
} ] ) ;
'use strict' ;
2017-07-20 23:09:21 +00:00
angular . module ( 'core' ) . config ( [ '$translateProvider' , function ( $translateProvider ) {
$translateProvider . translations ( 'es' , {
MENU : 'MENU' ,
SIGNUP _TAB : 'Registrarse' ,
SIGNIN _TAB : 'Entrar' ,
SIGNOUT _TAB : 'Salir' ,
EDIT _PROFILE : 'Editar Perfil' ,
MY _FORMS : 'Mis formularios' ,
MY _SETTINGS : 'Mis configuraciones' ,
CHANGE _PASSWORD : 'Cambiar contraseña'
} ) ;
} ] ) ;
'use strict' ;
2016-06-08 23:12:48 +00:00
// Forms controller
2017-09-30 00:33:55 +00:00
angular . module ( 'forms' ) . controller ( 'AdminFormController' , [ '$rootScope' , '$window' , '$scope' , '$stateParams' , '$state' , 'Forms' , 'CurrentForm' , '$http' , '$uibModal' , 'myForm' , '$filter' ,
function ( $rootScope , $window , $scope , $stateParams , $state , Forms , CurrentForm , $http , $uibModal , myForm , $filter ) {
2016-05-20 20:35:50 +00:00
2017-07-28 21:47:09 +00:00
//Set active tab to Create
$scope . activePill = 0 ;
2016-06-07 21:30:15 +00:00
2017-07-28 21:47:09 +00:00
$scope . copied = false ;
$scope . onCopySuccess = function ( e ) {
$scope . copied = true ;
} ;
2016-06-20 22:06:41 +00:00
2017-07-28 21:47:09 +00:00
$scope = $rootScope ;
$scope . animationsEnabled = true ;
$scope . myform = myForm ;
$rootScope . saveInProgress = false ;
2017-10-07 08:34:01 +00:00
$scope . oldForm = _ . cloneDeep ( $scope . myform ) ;
2017-07-28 21:47:09 +00:00
CurrentForm . setForm ( $scope . myform ) ;
$scope . formURL = '/#!/forms/' + $scope . myform . _id ;
if ( $scope . myform . isLive ) {
if ( $window . subdomainsDisabled === true ) {
$scope . actualFormURL = window . location . protocol + '//' + window . location . host + '/view' + $scope . formURL ;
} else {
if ( window . location . host . split ( '.' ) . length < 3 ) {
$scope . actualFormURL = window . location . protocol + '//' + $scope . myform . admin . username + '.' + window . location . host + $scope . formURL ;
} else {
$scope . actualFormURL = window . location . protocol + '//' + $scope . myform . admin . username + '.' + window . location . host . split ( '.' ) . slice ( 1 , 3 ) . join ( '.' ) + $scope . formURL ;
}
}
} else {
$scope . actualFormURL = window . location . protocol + '//' + window . location . host + $scope . formURL ;
}
2016-10-07 15:31:15 +00:00
2017-04-11 00:36:24 +00:00
2017-07-28 21:47:09 +00:00
var refreshFrame = $scope . refreshFrame = function ( ) {
if ( document . getElementById ( 'iframe' ) ) {
document . getElementById ( 'iframe' ) . contentWindow . location . reload ( ) ;
}
} ;
2016-10-07 15:31:15 +00:00
2017-10-07 08:34:01 +00:00
$scope . tabData = [
2016-06-08 23:12:48 +00:00
{
2016-06-18 21:01:02 +00:00
heading : $filter ( 'translate' ) ( 'CONFIGURE_TAB' ) ,
2017-07-28 21:47:09 +00:00
templateName : 'configure'
2017-10-02 10:18:47 +00:00
}
2016-06-08 23:12:48 +00:00
] ;
2016-06-07 21:30:15 +00:00
2017-10-07 08:34:01 +00:00
$scope . designTabActive = false
$scope . deactivateDesignTab = function ( ) {
$scope . designTabActive = false
}
$scope . activateDesignTab = function ( ) {
$scope . designTabActive = true
}
2016-06-08 23:12:48 +00:00
$scope . setForm = function ( form ) {
$scope . myform = form ;
} ;
2017-03-10 18:25:35 +00:00
2016-06-08 23:12:48 +00:00
$rootScope . resetForm = function ( ) {
$scope . myform = Forms . get ( {
formId : $stateParams . formId
} ) ;
} ;
2016-06-07 21:30:15 +00:00
2016-06-08 23:12:48 +00:00
/ *
* * DeleteModal Functions
* /
$scope . openDeleteModal = function ( ) {
$scope . deleteModal = $uibModal . open ( {
2017-07-28 21:47:09 +00:00
animation : $scope . animationsEnabled ,
templateUrl : 'formDeleteModal.html' ,
controller : 'AdminFormController' ,
resolve : {
myForm : function ( ) {
return $scope . myform ;
}
}
2016-06-08 23:12:48 +00:00
} ) ;
$scope . deleteModal . result . then ( function ( selectedItem ) {
2017-07-28 21:47:09 +00:00
$scope . selected = selectedItem ;
2016-06-08 23:12:48 +00:00
} ) ;
} ;
2016-06-07 21:30:15 +00:00
2016-06-08 23:12:48 +00:00
$scope . cancelDeleteModal = function ( ) {
if ( $scope . deleteModal ) {
$scope . deleteModal . dismiss ( 'cancel' ) ;
2016-05-20 20:35:50 +00:00
}
2016-06-08 23:12:48 +00:00
} ;
2016-05-20 20:35:50 +00:00
2016-06-08 23:12:48 +00:00
// Remove existing Form
$scope . removeCurrentForm = function ( ) {
if ( $scope . deleteModal && $scope . deleteModal . opened ) {
2016-05-20 20:35:50 +00:00
2016-06-08 23:12:48 +00:00
$scope . deleteModal . close ( ) ;
2016-05-20 20:35:50 +00:00
2016-06-08 23:12:48 +00:00
var form _id = $scope . myform . _id ;
if ( ! form _id ) throw new Error ( 'Error - removeCurrentForm(): $scope.myform._id does not exist' ) ;
2016-05-20 20:35:50 +00:00
2016-06-08 23:12:48 +00:00
$http . delete ( '/forms/' + form _id )
2017-03-27 20:32:06 +00:00
. then ( function ( response ) {
2017-10-02 10:18:47 +00:00
$state . go ( 'listForms' , { } , { reload : true } )
2017-03-27 20:32:06 +00:00
} , function ( error ) {
2016-06-08 23:12:48 +00:00
console . error ( error ) ;
} ) ;
}
2016-06-07 21:30:15 +00:00
} ;
2016-06-07 20:01:00 +00:00
2017-10-07 08:34:01 +00:00
$scope . updateDesign = function ( updateImmediately , data , shouldDiff , refreshAfterUpdate ) {
$scope . update ( updateImmediately , data , shouldDiff , refreshAfterUpdate , function ( ) {
refreshFrame ( ) ;
} ) ;
}
2016-06-07 20:01:00 +00:00
2017-10-07 08:34:01 +00:00
// Update existing Form
$scope . update = $rootScope . update = function ( updateImmediately , data , shouldDiff , refreshAfterUpdate , cb ) {
2016-06-08 23:12:48 +00:00
var continueUpdate = true ;
if ( ! updateImmediately ) {
continueUpdate = ! $rootScope . saveInProgress ;
}
2016-05-20 20:35:50 +00:00
2017-10-07 08:34:01 +00:00
//Update form **if we are not in the middle of an update** or if **shouldUpdateNow flag is set**
2017-03-10 19:26:07 +00:00
if ( continueUpdate ) {
2017-07-28 21:47:09 +00:00
var err = null ;
if ( ! updateImmediately ) {
$rootScope . saveInProgress = true ;
}
2017-10-07 08:34:01 +00:00
if ( shouldDiff ) {
//Do this so we can create duplicate fields
var checkForValidId = new RegExp ( '^[0-9a-fA-F]{24}$' ) ;
for ( var i = 0 ; i < $scope . myform . form _fields . length ; i ++ ) {
var field = $scope . myform . form _fields [ i ] ;
if ( ! checkForValidId . exec ( field . _id + '' ) ) {
delete $scope . myform . form _fields [ i ] . _id ;
delete $scope . myform . form _fields [ i ] . id ;
}
}
var data = DeepDiff . diff ( $scope . oldForm , $scope . myform ) ;
2017-07-28 21:47:09 +00:00
$scope . updatePromise = $http . put ( '/forms/' + $scope . myform . _id , { changes : data } )
. then ( function ( response ) {
2017-10-02 10:18:47 +00:00
if ( refreshAfterUpdate ) {
$rootScope . myform = $scope . myform = response . data ;
2017-10-07 08:34:01 +00:00
$scope . oldForm = _ . cloneDeep ( $scope . myform ) ;
2017-10-02 10:18:47 +00:00
}
2017-07-28 21:47:09 +00:00
} ) . catch ( function ( response ) {
err = response . data ;
2017-10-02 10:18:47 +00:00
console . error ( err ) ;
2017-07-28 21:47:09 +00:00
} ) . finally ( function ( ) {
if ( ! updateImmediately ) {
$rootScope . saveInProgress = false ;
}
2017-03-10 19:26:07 +00:00
2017-07-28 21:47:09 +00:00
if ( ( typeof cb ) === 'function' ) {
return cb ( err ) ;
}
} ) ;
} else {
var dataToSend = data ;
if ( dataToSend . analytics && dataToSend . analytics . visitors ) {
delete dataToSend . analytics . visitors ;
}
if ( dataToSend . submissions ) {
delete dataToSend . submissions ;
}
2017-03-10 19:26:07 +00:00
2017-10-07 08:34:01 +00:00
if ( dataToSend . visible _form _fields ) {
delete dataToSend . visible _form _fields ;
}
if ( dataToSend . analytics ) {
delete dataToSend . analytics . visitors ;
delete dataToSend . analytics . fields ;
delete dataToSend . analytics . submissions ;
delete dataToSend . analytics . views ;
delete dataToSend . analytics . conversionRate ;
}
delete dataToSend . created ;
delete dataToSend . lastModified ;
delete dataToSend . _ _v ;
2017-07-28 21:47:09 +00:00
$scope . updatePromise = $http . put ( '/forms/' + $scope . myform . _id , { form : dataToSend } )
. then ( function ( response ) {
2017-10-02 10:18:47 +00:00
if ( refreshAfterUpdate ) {
$rootScope . myform = $scope . myform = response . data ;
}
2017-03-10 19:26:07 +00:00
2017-07-28 21:47:09 +00:00
} ) . catch ( function ( response ) {
err = response . data ;
2017-10-02 10:18:47 +00:00
console . error ( err ) ;
2017-07-28 21:47:09 +00:00
} ) . finally ( function ( ) {
if ( ! updateImmediately ) {
$rootScope . saveInProgress = false ;
}
2017-03-10 19:26:07 +00:00
2017-07-28 21:47:09 +00:00
if ( ( typeof cb ) === 'function' ) {
return cb ( err ) ;
}
} ) ;
}
2016-06-08 23:12:48 +00:00
}
} ;
2016-05-20 20:35:50 +00:00
2017-07-28 21:47:09 +00:00
}
2016-06-08 23:12:48 +00:00
] ) ;
'use strict' ;
2016-05-20 20:35:50 +00:00
2016-06-08 23:12:48 +00:00
// Forms controller
2017-10-19 00:27:07 +00:00
angular . module ( 'forms' ) . controller ( 'ListFormsController' , [ '$rootScope' , '$scope' , '$stateParams' , '$state' , 'GetForms' , 'CurrentForm' , '$http' , '$uibModal' , 'myForms' ,
function ( $rootScope , $scope , $stateParams , $state , GetForms , CurrentForm , $http , $uibModal , myForms ) {
2016-06-08 23:56:06 +00:00
2016-06-08 23:12:48 +00:00
$scope = $rootScope ;
$scope . forms = { } ;
$scope . showCreateModal = false ;
2017-10-19 00:27:07 +00:00
$scope . myforms = myForms
2016-06-07 21:30:15 +00:00
2016-07-04 21:31:33 +00:00
$rootScope . languageRegExp = {
2016-06-16 00:38:22 +00:00
regExp : /[@!#$%^&*()\-+={}\[\]|\\/'";:`.,~№?<>]+/i ,
test : function ( val ) {
return ! this . regExp . test ( val ) ;
}
} ;
2016-11-14 20:07:36 +00:00
/ *
* * DeleteModal Functions
* /
$scope . openDeleteModal = function ( index ) {
$scope . deleteModal = $uibModal . open ( {
animation : $scope . animationsEnabled ,
templateUrl : 'deleteModalListForms.html' ,
controller : [ "$uibModalInstance" , "items" , "$scope" , function ( $uibModalInstance , items , $scope ) {
$scope . content = items ;
$scope . cancel = $scope . cancelDeleteModal ;
$scope . deleteForm = function ( ) {
2017-03-06 21:45:11 +00:00
$scope . $parent . removeForm ( items . formIndex ) ;
2017-07-20 23:09:21 +00:00
} ;
2016-11-14 20:07:36 +00:00
} ] ,
resolve : {
items : function ( ) {
return {
currFormTitle : $scope . myforms [ index ] . title ,
formIndex : index
} ;
}
}
} ) ;
} ;
$scope . cancelDeleteModal = function ( ) {
if ( $scope . deleteModal ) {
$scope . deleteModal . dismiss ( 'cancel' ) ;
}
} ;
2016-06-08 23:12:48 +00:00
//Modal functions
$scope . openCreateModal = function ( ) {
if ( ! $scope . showCreateModal ) {
$scope . showCreateModal = true ;
}
} ;
$scope . closeCreateModal = function ( ) {
if ( $scope . showCreateModal ) {
$scope . showCreateModal = false ;
}
} ;
2016-05-20 20:35:50 +00:00
2016-06-08 23:12:48 +00:00
$scope . setForm = function ( form ) {
$scope . myform = form ;
} ;
$scope . goToWithId = function ( route , id ) {
$state . go ( route , { 'formId' : id } , { reload : true } ) ;
} ;
2016-06-07 20:01:00 +00:00
2016-06-08 23:12:48 +00:00
$scope . duplicateForm = function ( form _index ) {
var form = _ . cloneDeep ( $scope . myforms [ form _index ] ) ;
delete form . _id ;
2016-06-08 23:56:06 +00:00
2016-06-08 23:12:48 +00:00
$http . post ( '/forms' , { form : form } )
. success ( function ( data , status , headers ) {
$scope . myforms . splice ( form _index + 1 , 0 , data ) ;
} ) . error ( function ( errorResponse ) {
console . error ( errorResponse ) ;
if ( errorResponse === null ) {
2016-06-08 23:56:06 +00:00
$scope . error = errorResponse . data . message ;
}
2016-06-08 23:12:48 +00:00
} ) ;
} ;
2016-06-07 20:01:00 +00:00
2016-06-08 23:12:48 +00:00
// Create new Form
$scope . createNewForm = function ( ) {
2016-06-07 20:01:00 +00:00
2016-06-08 23:12:48 +00:00
var form = { } ;
form . title = $scope . forms . createForm . title . $modelValue ;
form . language = $scope . forms . createForm . language . $modelValue ;
2016-05-20 20:35:50 +00:00
2016-06-08 23:12:48 +00:00
if ( $scope . forms . createForm . $valid && $scope . forms . createForm . $dirty ) {
$http . post ( '/forms' , { form : form } )
. success ( function ( data , status , headers ) {
2016-06-08 23:56:06 +00:00
// Redirect after save
2016-06-08 23:12:48 +00:00
$scope . goToWithId ( 'viewForm.create' , data . _id + '' ) ;
} ) . error ( function ( errorResponse ) {
console . error ( errorResponse ) ;
$scope . error = errorResponse . data . message ;
} ) ;
}
} ;
2016-05-20 20:35:50 +00:00
2016-06-08 23:12:48 +00:00
$scope . removeForm = function ( form _index ) {
if ( form _index >= $scope . myforms . length || form _index < 0 ) {
throw new Error ( 'Error: form_index in removeForm() must be between 0 and ' + $scope . myforms . length - 1 ) ;
}
2016-06-07 20:01:00 +00:00
2016-06-08 23:12:48 +00:00
$http . delete ( '/forms/' + $scope . myforms [ form _index ] . _id )
. success ( function ( data , status , headers ) {
$scope . myforms . splice ( form _index , 1 ) ;
2016-11-14 20:07:36 +00:00
$scope . cancelDeleteModal ( ) ;
2016-06-08 23:12:48 +00:00
} ) . error ( function ( error ) {
console . error ( error ) ;
} ) ;
} ;
}
] ) ;
2016-06-16 00:38:22 +00:00
2016-06-08 23:12:48 +00:00
'use strict' ;
2016-05-20 20:35:50 +00:00
2016-06-08 23:12:48 +00:00
angular . module ( 'forms' ) . directive ( 'configureFormDirective' , [ '$rootScope' , '$http' , 'Upload' , 'CurrentForm' ,
function ( $rootScope , $http , Upload , CurrentForm ) {
return {
templateUrl : 'modules/forms/admin/views/directiveViews/form/configure-form.client.view.html' ,
restrict : 'E' ,
scope : {
myform : '=' ,
user : '=' ,
pdfFields : '@' ,
formFields : '@'
2016-06-07 21:30:15 +00:00
} ,
2016-06-08 23:12:48 +00:00
controller : [ "$scope" , function ( $scope ) {
$scope . log = '' ;
$scope . languages = $rootScope . languages ;
2016-06-07 21:30:15 +00:00
2016-06-08 23:12:48 +00:00
$scope . resetForm = $rootScope . resetForm ;
$scope . update = $rootScope . update ;
2016-06-07 21:30:15 +00:00
2016-06-08 23:12:48 +00:00
} ]
2016-06-07 21:30:15 +00:00
} ;
2016-06-08 23:12:48 +00:00
}
] ) ;
2016-06-07 21:30:15 +00:00
2017-10-07 08:34:01 +00:00
2016-06-08 23:12:48 +00:00
'use strict' ;
2016-06-07 21:30:15 +00:00
2017-03-10 18:25:35 +00:00
angular . module ( 'forms' ) . directive ( 'editFormDirective' , [ '$rootScope' , 'FormFields' , '$uibModal' ,
function ( $rootScope , FormFields , $uibModal ) {
2016-06-08 23:12:48 +00:00
return {
templateUrl : 'modules/forms/admin/views/directiveViews/form/edit-form.client.view.html' ,
restrict : 'E' ,
2016-11-02 20:32:08 +00:00
transclude : true ,
2016-06-08 23:12:48 +00:00
scope : {
2016-11-02 20:32:08 +00:00
myform : '='
2016-06-07 21:30:15 +00:00
} ,
2016-06-08 23:12:48 +00:00
controller : [ "$scope" , function ( $scope ) {
2016-06-07 21:30:15 +00:00
2016-06-08 23:12:48 +00:00
/ *
* * Initialize scope with variables
* /
2017-07-31 21:30:55 +00:00
var newField ;
2017-07-20 23:09:21 +00:00
2016-06-08 23:12:48 +00:00
//Setup UI-Sortable
$scope . sortableOptions = {
appendTo : '.dropzone' ,
2017-08-02 20:19:33 +00:00
//helper: 'clone',
2017-03-10 20:19:46 +00:00
forceHelperSize : true ,
forcePlaceholderSize : true ,
2017-03-10 19:55:30 +00:00
update : function ( e , ui ) {
2017-10-07 08:34:01 +00:00
$scope . update ( false , $scope . myform , true , false , function ( err ) {
2017-03-10 20:50:17 +00:00
} ) ;
2017-03-10 20:19:46 +00:00
} ,
2016-06-08 23:12:48 +00:00
} ;
2016-05-20 20:35:50 +00:00
2017-03-10 18:25:35 +00:00
/ *
* * EditModal Functions
* /
2017-10-19 00:27:07 +00:00
$scope . openEditModal = function ( curr _field , isEdit , field _index ) {
2017-03-10 18:25:35 +00:00
$scope . editFieldModal = $uibModal . open ( {
animation : true ,
templateUrl : 'editFieldModal.html' ,
2017-03-13 19:08:21 +00:00
windowClass : 'edit-modal-window' ,
2017-03-10 18:25:35 +00:00
controller : [ "$uibModalInstance" , "$scope" , function ( $uibModalInstance , $scope ) {
$scope . field = curr _field ;
$scope . showLogicJump = false ;
2017-10-19 00:27:07 +00:00
$scope . isEdit = isEdit ;
2017-03-13 04:18:55 +00:00
// decides whether field options block will be shown (true for dropdown and radio fields)
$scope . showAddOptions = function ( field ) {
2017-10-26 15:36:15 +00:00
if ( $scope . field . fieldType === 'dropdown' || $scope . field . fieldType === 'checkbox' || $scope . field . fieldType === 'radio' ) {
2017-03-13 04:18:55 +00:00
return true ;
} else {
return false ;
}
} ;
2017-03-13 05:09:47 +00:00
$scope . validShapes = [
'Heart' ,
'Star' ,
'thumbs-up' ,
'thumbs-down' ,
'Circle' ,
'Square' ,
'Check Circle' ,
'Smile Outlined' ,
'Hourglass' ,
'bell' ,
'Paper Plane' ,
'Comment' ,
'Trash'
] ;
// add new option to the field
2017-10-19 00:27:07 +00:00
$scope . addOption = function ( ) {
if ( $scope . field . fieldType === 'checkbox' || $scope . field . fieldType === 'dropdown' || $scope . field . fieldType === 'radio' ) {
if ( ! $scope . field . fieldOptions ) {
$scope . field . fieldOptions = [ ] ;
2017-03-13 05:09:47 +00:00
}
2017-10-19 00:27:07 +00:00
var lastOptionID = $scope . field . fieldOptions . length + 1 ;
2017-03-13 05:09:47 +00:00
// new option's id
var newOption = {
'option_id' : Math . floor ( 100000 * Math . random ( ) ) ,
'option_title' : 'Option ' + lastOptionID ,
'option_value' : 'Option ' + lastOptionID
} ;
// put new option into fieldOptions array
2017-10-19 00:27:07 +00:00
$scope . field . fieldOptions . push ( newOption ) ;
2017-03-13 05:09:47 +00:00
}
} ;
// delete particular option
2017-10-19 00:27:07 +00:00
$scope . deleteOption = function ( option ) {
if ( $scope . field . fieldType === 'checkbox' || $scope . field . fieldType === 'dropdown' || $scope . field . fieldType === 'radio' ) {
for ( var i = 0 ; i < $scope . field . fieldOptions . length ; i ++ ) {
if ( $scope . field . fieldOptions [ i ] . option _id === option . option _id ) {
2017-03-13 05:09:47 +00:00
2017-10-19 00:27:07 +00:00
$scope . field . fieldOptions . splice ( i , 1 ) ;
2017-03-13 05:09:47 +00:00
break ;
}
}
}
} ;
//Populate Name to Font-awesomeName Conversion Map
$scope . select2FA = {
'Heart' : 'Heart' ,
'Star' : 'Star' ,
'thumbs-up' : 'Thumbs Up' ,
'thumbs-down' : 'Thumbs Down' ,
'Circle' : 'Circle' ,
'Square' : 'Square' ,
'Check Circle' : 'Checkmark' ,
'Smile Outlined' : 'Smile' ,
'Hourglass' : 'Hourglass' ,
'bell' : 'Bell' ,
'Paper Plane' : 'Paper Plane' ,
'Comment' : 'Chat Bubble' ,
'Trash' : 'Trash Can'
} ;
2017-03-13 04:18:55 +00:00
// decides whether field options block will be shown (true for dropdown and radio fields)
2017-10-19 00:27:07 +00:00
$scope . showRatingOptions = function ( ) {
if ( $scope . field . fieldType === 'rating' ) {
2017-03-13 04:18:55 +00:00
return true ;
} else {
return false ;
}
} ;
2017-03-10 19:26:07 +00:00
$scope . saveField = function ( ) {
2017-10-19 00:27:07 +00:00
if ( $scope . isEdit ) {
$scope . myform . form _fields [ field _index ] = $scope . field ;
} else {
$scope . myform . form _fields . push ( curr _field ) ;
}
2017-03-10 18:25:35 +00:00
2017-10-07 08:34:01 +00:00
$scope . $parent . update ( false , $scope . $parent . myform , true , true , function ( ) {
2017-03-10 19:26:07 +00:00
$uibModalInstance . close ( ) ;
} ) ;
2017-10-19 00:27:07 +00:00
2017-03-10 19:26:07 +00:00
} ;
2017-03-10 18:25:35 +00:00
$scope . cancel = function ( ) {
2017-03-10 19:26:07 +00:00
$uibModalInstance . close ( ) ;
2017-03-10 18:25:35 +00:00
} ;
} ]
} ) ;
} ;
2016-06-08 23:12:48 +00:00
/ *
2017-03-13 19:08:21 +00:00
* * EditStartPageModal Functions
* /
$scope . openEditStartPageModal = function ( ) {
$scope . editStartPageModal = $uibModal . open ( {
animation : true ,
templateUrl : 'editStartPageModal.html' ,
windowClass : 'edit-modal-window' ,
controller : [ "$uibModalInstance" , "$scope" , function ( $uibModalInstance , $scope ) {
/ *
* * startPage Button Methods
* /
$scope . showButtons = false ;
$scope . lastButtonID = 0 ;
// add new Button to the startPage
$scope . addButton = function ( ) {
var newButton = { } ;
newButton . bgColor = '#ddd' ;
newButton . color = '#ffffff' ;
newButton . text = 'Button' ;
newButton . _id = Math . floor ( 100000 * Math . random ( ) ) ;
$scope . myform . startPage . buttons . push ( newButton ) ;
} ;
// delete particular Button from startPage
$scope . deleteButton = function ( button ) {
var currID ;
for ( var i = 0 ; i < $scope . myform . startPage . buttons . length ; i ++ ) {
currID = $scope . myform . startPage . buttons [ i ] . _id ;
if ( currID === button . _id ) {
$scope . myform . startPage . buttons . splice ( i , 1 ) ;
break ;
}
}
} ;
$scope . saveStartPage = function ( ) {
2017-10-07 08:34:01 +00:00
$scope . $parent . update ( false , $scope . $parent . myform , true , true , function ( ) {
2017-03-13 19:08:21 +00:00
$uibModalInstance . close ( ) ;
} ) ;
} ;
$scope . cancel = function ( ) {
$uibModalInstance . close ( ) ;
} ;
} ]
} ) ;
} ;
/ *
2017-10-07 08:34:01 +00:00
* * EditEndPageModal Functions
2016-06-08 23:12:48 +00:00
* /
2017-03-13 19:08:21 +00:00
$scope . openEditEndPageModal = function ( ) {
$scope . editEndPageModal = $uibModal . open ( {
animation : true ,
templateUrl : 'editEndPageModal.html' ,
windowClass : 'edit-modal-window' ,
controller : [ "$uibModalInstance" , "$scope" , function ( $uibModalInstance , $scope ) {
/ *
* * startPage Button Methods
* /
$scope . showButtons = false ;
$scope . lastButtonID = 0 ;
2016-05-20 20:35:50 +00:00
2017-03-13 19:08:21 +00:00
// add new Button to the startPage
$scope . addButton = function ( ) {
2016-05-20 20:35:50 +00:00
2017-03-13 19:08:21 +00:00
var newButton = { } ;
newButton . bgColor = '#ddd' ;
newButton . color = '#ffffff' ;
newButton . text = 'Button' ;
newButton . _id = Math . floor ( 100000 * Math . random ( ) ) ;
$scope . myform . endPage . buttons . push ( newButton ) ;
} ;
// delete particular Button from startPage
$scope . deleteButton = function ( button ) {
var currID ;
for ( var i = 0 ; i < $scope . myform . endPage . buttons . length ; i ++ ) {
currID = $scope . myform . endPage . buttons [ i ] . _id ;
if ( currID === button . _id ) {
$scope . myform . endPage . buttons . splice ( i , 1 ) ;
break ;
}
}
} ;
2016-05-20 20:35:50 +00:00
2017-03-13 19:08:21 +00:00
$scope . saveEndPage = function ( ) {
2017-10-07 08:34:01 +00:00
$scope . $parent . update ( false , $scope . $parent . myform , true , true , function ( ) {
2017-03-13 19:08:21 +00:00
$uibModalInstance . close ( ) ;
} ) ;
} ;
$scope . cancel = function ( ) {
$uibModalInstance . close ( ) ;
} ;
} ]
} ) ;
} ;
2016-05-20 20:35:50 +00:00
2016-06-08 23:12:48 +00:00
//Populate local scope with rootScope methods/variables
$scope . update = $rootScope . update ;
2016-05-20 20:35:50 +00:00
2016-06-08 23:12:48 +00:00
/ *
* * FormFields ( ui - sortable ) drag - and - drop configuration
* /
$scope . dropzone = {
handle : '.handle' ,
containment : '.dropzoneContainer' ,
cursor : 'grabbing'
} ;
2016-05-20 20:35:50 +00:00
2016-06-08 23:12:48 +00:00
/ *
* * Field CRUD Methods
* /
// Add a new field
2017-10-19 00:27:07 +00:00
$scope . addNewField = function ( fieldType ) {
2016-06-08 23:12:48 +00:00
// increment lastAddedID counter
$scope . addField . lastAddedID ++ ;
2017-03-07 00:38:57 +00:00
var fieldTitle = fieldType ;
2016-06-07 21:30:15 +00:00
2016-06-08 23:12:48 +00:00
for ( var i = 0 ; i < $scope . addField . types . length ; i ++ ) {
if ( $scope . addField . types [ i ] . name === fieldType ) {
$scope . addField . types [ i ] . lastAddedID ++ ;
fieldTitle = $scope . addField . types [ i ] . value + $scope . addField . types [ i ] . lastAddedID ;
break ;
}
}
2017-07-20 23:09:21 +00:00
newField = {
2017-03-27 20:32:06 +00:00
title : fieldTitle ,
2016-06-08 23:12:48 +00:00
fieldType : fieldType ,
2017-03-27 20:32:06 +00:00
fieldValue : '' ,
2016-06-08 23:12:48 +00:00
required : true ,
disabled : false ,
2016-08-23 21:45:59 +00:00
deletePreserved : false ,
logicJump : { }
2016-06-08 23:12:48 +00:00
} ;
2016-06-07 21:30:15 +00:00
2017-03-07 00:38:57 +00:00
if ( fieldType === 'rating' ) {
newField . ratingOptions = {
2017-08-02 21:13:10 +00:00
steps : 5 ,
2017-03-07 00:38:57 +00:00
shape : 'Heart'
2017-03-27 20:32:06 +00:00
} ;
2017-08-02 21:13:10 +00:00
newField . fieldValue = 0 ;
2017-03-07 00:38:57 +00:00
}
2017-03-10 18:25:35 +00:00
2016-06-08 23:12:48 +00:00
if ( $scope . showAddOptions ( newField ) ) {
newField . fieldOptions = [ ] ;
newField . fieldOptions . push ( {
'option_id' : Math . floor ( 100000 * Math . random ( ) ) , //Generate pseudo-random option id
'option_title' : 'Option 0' ,
'option_value' : 'Option 0'
} ) ;
}
2016-06-07 21:30:15 +00:00
2017-10-19 00:27:07 +00:00
$scope . openEditModal ( newField , false , $scope . myform . form _fields . length ) ;
2016-06-08 23:12:48 +00:00
} ;
2016-06-07 21:30:15 +00:00
2017-03-13 04:18:55 +00:00
// decides whether field options block will be shown (true for dropdown and radio fields)
$scope . showAddOptions = function ( field ) {
if ( field . fieldType === 'dropdown' || field . fieldType === 'checkbox' || field . fieldType === 'radio' ) {
return true ;
} else {
return false ;
}
} ;
// decides whether field options block will be shown (true for dropdown and radio fields)
$scope . showRatingOptions = function ( field ) {
if ( field . fieldType === 'rating' ) {
return true ;
} else {
return false ;
}
} ;
2016-06-08 23:12:48 +00:00
// Delete particular field on button click
2016-11-02 20:32:08 +00:00
$scope . deleteField = function ( field _index ) {
2016-06-08 23:12:48 +00:00
$scope . myform . form _fields . splice ( field _index , 1 ) ;
2017-03-13 19:08:21 +00:00
$scope . update ( false , $scope . myform , false , true , null ) ;
2016-06-08 23:12:48 +00:00
} ;
2016-11-02 20:32:08 +00:00
2017-03-27 20:32:06 +00:00
$scope . duplicateField = function ( field _index ) {
2017-09-30 00:33:55 +00:00
var currField = angular . copy ( $scope . myform . form _fields [ field _index ] ) ;
2016-06-08 23:12:48 +00:00
currField . _id = 'cloned' + _ . uniqueId ( ) ;
currField . title += ' copy' ;
2016-06-07 21:30:15 +00:00
2016-06-08 23:12:48 +00:00
//Insert field at selected index
2017-09-30 00:33:55 +00:00
$scope . myform . form _fields . push ( currField ) ;
2017-03-13 19:08:21 +00:00
$scope . update ( false , $scope . myform , false , true , null ) ;
2016-06-08 23:12:48 +00:00
} ;
2016-06-07 20:01:00 +00:00
2017-03-13 19:08:21 +00:00
//Populate AddField with all available form field types
$scope . addField = { } ;
$scope . addField . types = FormFields . types ;
2016-06-07 21:30:15 +00:00
2017-03-13 19:08:21 +00:00
$scope . addField . types . forEach ( function ( type ) {
type . lastAddedID = 1 ;
return type ;
} ) ;
2016-05-20 20:35:50 +00:00
2016-06-08 23:12:48 +00:00
} ]
} ;
}
] ) ;
2016-05-20 20:35:50 +00:00
2016-06-08 23:12:48 +00:00
'use strict' ;
2016-05-20 20:35:50 +00:00
2016-11-09 19:04:47 +00:00
angular . module ( 'forms' ) . directive ( 'editSubmissionsFormDirective' , [ '$rootScope' , '$http' , 'Forms' , '$stateParams' , '$interval' ,
function ( $rootScope , $http , Forms , $stateParams , $interval ) {
2016-06-08 23:12:48 +00:00
return {
templateUrl : 'modules/forms/admin/views/directiveViews/form/edit-submissions-form.client.view.html' ,
restrict : 'E' ,
scope : {
2016-11-09 19:04:47 +00:00
user : '=' ,
2017-07-28 21:47:09 +00:00
myform : '='
2016-06-08 23:12:48 +00:00
} ,
controller : [ "$scope" , function ( $scope ) {
2016-11-09 19:04:47 +00:00
2016-06-08 23:12:48 +00:00
$scope . table = {
masterChecker : false ,
2017-08-02 22:30:12 +00:00
rows : [ ]
2016-06-08 23:12:48 +00:00
} ;
2016-05-20 20:35:50 +00:00
2017-09-30 00:33:55 +00:00
var initController = function ( ) {
$http ( {
method : 'GET' ,
2017-10-19 00:18:18 +00:00
url : '/forms' + $scope . myform . _id + '/submissions'
2017-09-30 00:33:55 +00:00
} ) . then ( function successCallback ( response ) {
var defaultFormFields = _ . cloneDeep ( $scope . myform . form _fields ) ;
var submissions = response . data || [ ] ;
2017-08-02 22:30:12 +00:00
//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 ;
}
2017-09-30 00:33:55 +00:00
$scope . table . rows = submissions ;
} ) ;
} ;
2017-08-02 22:30:12 +00:00
2017-10-19 00:18:18 +00:00
initController ( ) ;
2017-07-28 21:47:09 +00:00
2017-09-30 00:33:55 +00:00
/ *
* * Analytics Functions
* /
$scope . AverageTimeElapsed = ( function ( ) {
var totalTime = 0 ;
var numSubmissions = $scope . table . rows . length ;
for ( var i = 0 ; i < $scope . table . rows . length ; i ++ ) {
totalTime += $scope . table . rows [ i ] . timeElapsed ;
}
if ( numSubmissions === 0 ) {
return 0 ;
}
return ( totalTime / numSubmissions ) . toFixed ( 0 ) ;
} ) ( ) ;
$scope . DeviceStatistics = ( function ( ) {
var newStatItem = function ( ) {
return {
visits : 0 ,
responses : 0 ,
completion : 0 ,
average _time : 0 ,
total _time : 0
} ;
} ;
var stats = {
desktop : newStatItem ( ) ,
tablet : newStatItem ( ) ,
phone : newStatItem ( ) ,
other : newStatItem ( )
} ;
if ( $scope . myform . analytics && $scope . myform . analytics . visitors ) {
var visitors = $scope . myform . analytics . visitors ;
for ( var i = 0 ; i < visitors . length ; i ++ ) {
var visitor = visitors [ i ] ;
var deviceType = visitor . deviceType ;
stats [ deviceType ] . visits ++ ;
if ( visitor . isSubmitted ) {
stats [ deviceType ] . total _time = stats [ deviceType ] . total _time + visitor . timeElapsed ;
stats [ deviceType ] . responses ++ ;
}
if ( stats [ deviceType ] . visits ) {
stats [ deviceType ] . completion = 100 * ( stats [ deviceType ] . responses / stats [ deviceType ] . visits ) . toFixed ( 2 ) ;
}
if ( stats [ deviceType ] . responses ) {
stats [ deviceType ] . average _time = ( stats [ deviceType ] . total _time / stats [ deviceType ] . responses ) . toFixed ( 0 ) ;
}
}
}
return stats ;
} ) ( ) ;
var updateFields = $interval ( initController , 1000000 ) ;
$scope . $on ( '$destroy' , function ( ) {
if ( updateFields ) {
$interval . cancel ( $scope . updateFields ) ;
}
} ) ;
/ *
* * Table Functions
* /
$scope . isAtLeastOneChecked = function ( ) {
for ( var i = 0 ; i < $scope . table . rows . length ; i ++ ) {
if ( $scope . table . rows [ i ] . selected ) return true ;
}
return false ;
} ;
$scope . toggleAllCheckers = function ( ) {
for ( var i = 0 ; i < $scope . table . rows . length ; i ++ ) {
$scope . table . rows [ i ] . selected = $scope . table . masterChecker ;
}
} ;
$scope . toggleObjSelection = function ( $event ) {
$event . stopPropagation ( ) ;
} ;
$scope . rowClicked = function ( row _index ) {
$scope . table . rows [ row _index ] . selected = ! $scope . table . rows [ row _index ] . selected ;
} ;
/ *
* Form Submission Methods
* /
//Delete selected submissions of Form
$scope . deleteSelectedSubmissions = function ( ) {
var delete _ids = _ . chain ( $scope . table . rows ) . filter ( function ( row ) {
return ! ! row . selected ;
} ) . pluck ( '_id' ) . value ( ) ;
$http ( { url : '/forms/' + $scope . myform . _id + '/submissions' ,
method : 'DELETE' ,
data : { deleted _submissions : delete _ids } ,
headers : { 'Content-Type' : 'application/json;charset=utf-8' }
} ) . success ( function ( data , status ) {
//Remove deleted ids from table
var tmpArray = [ ] ;
for ( var i = 0 ; i < $scope . table . rows . length ; i ++ ) {
if ( ! $scope . table . rows [ i ] . selected ) {
tmpArray . push ( $scope . table . rows [ i ] ) ;
}
}
$scope . table . rows = tmpArray ;
} )
. error ( function ( err ) {
2017-10-02 10:18:47 +00:00
console . error ( err ) ;
2017-09-30 00:33:55 +00:00
} ) ;
} ;
//Export selected submissions of Form
$scope . exportSubmissions = function ( type ) {
2017-10-05 01:42:55 +00:00
angular . element ( '#table-submission-data' ) . tableExport ( { type : type , escape : false , ignoreColumn : [ 0 ] } ) ;
2017-09-30 00:33:55 +00:00
} ;
} ]
} ;
}
] ) ;
'use strict' ;
//TODO: DAVID: URGENT: Make this a $resource that fetches valid field types from server
angular . module ( 'forms' ) . service ( 'FormFields' , [ '$filter' ,
function ( $filter ) {
this . types = [
{
name : 'textfield' ,
value : $filter ( 'translate' ) ( 'SHORT_TEXT' ) ,
} ,
{
name : 'email' ,
value : $filter ( 'translate' ) ( 'EMAIL' ) ,
} ,
{
name : 'radio' ,
value : $filter ( 'translate' ) ( 'MULTIPLE_CHOICE' ) ,
} ,
{
name : 'dropdown' ,
value : $filter ( 'translate' ) ( 'DROPDOWN' ) ,
} ,
{
name : 'date' ,
value : $filter ( 'translate' ) ( 'DATE' ) ,
} ,
{
name : 'textarea' ,
value : $filter ( 'translate' ) ( 'PARAGRAPH' ) ,
} ,
{
name : 'yes_no' ,
value : $filter ( 'translate' ) ( 'YES_NO' ) ,
} ,
{
name : 'legal' ,
value : $filter ( 'translate' ) ( 'LEGAL' ) ,
} ,
// {
// name : 'sig',
// value : $filter('translate')('SIGNATURE'),
// },
// {
// name : 'file',
// value : $filter('translate')('FILE_UPLOAD'),
// },
{
name : 'rating' ,
value : $filter ( 'translate' ) ( 'RATING' ) ,
} ,
{
name : 'link' ,
value : $filter ( 'translate' ) ( 'LINK' ) ,
} ,
{
name : 'number' ,
value : $filter ( 'translate' ) ( 'NUMBERS' ) ,
} ,
// {
// name : 'scale',
// value : $filter('translate')('OPINION SCALE'),
// },
// {
// name : 'stripe',
// value : $filter('translate')('PAYMENT'),
// },
{
name : 'statement' ,
value : $filter ( 'translate' ) ( 'STATEMENT' )
}
] ;
}
] ) ;
'use strict' ;
//Submissions service used for communicating with the forms REST endpoints
angular . module ( 'forms' ) . factory ( 'Submissions' , [ '$resource' ,
function ( $resource ) {
return $resource ( 'forms/:formID/submissions/:submissionId' , {
submissionId : '@_id' ,
formId : '@_id'
} , {
'query' : {
method : 'GET' ,
isArray : true ,
} ,
'update' : {
method : 'PUT'
} ,
'save' : {
method : 'POST'
}
} ) ;
}
] ) ;
'use strict' ;
angular . module ( 'users' ) . config ( [ '$translateProvider' , function ( $translateProvider ) {
$translateProvider . translations ( 'en' , {
ACCESS _DENIED _TEXT : 'You need to be logged in to access this page' ,
USERNAME _OR _EMAIL _LABEL : 'Username or Email' ,
USERNAME _LABEL : 'Username' ,
PASSWORD _LABEL : 'Password' ,
CURRENT _PASSWORD _LABEL : 'Current Password' ,
NEW _PASSWORD _LABEL : 'New Password' ,
VERIFY _PASSWORD _LABEL : 'Verify Password' ,
UPDATE _PASSWORD _LABEL : 'Update Password' ,
FIRST _NAME _LABEL : 'First Name' ,
LAST _NAME _LABEL : 'Last Name' ,
LANGUAGE _LABEL : 'Language' ,
EMAIL _LABEL : 'Email' ,
SIGNUP _ACCOUNT _LINK : 'Don\'t have an account? Sign up here' ,
SIGN _IN _ACCOUNT _LINK : 'Already have an account? Sign in here' ,
SIGNUP _HEADER _TEXT : 'Sign up' ,
SIGNIN _HEADER _TEXT : 'Sign in' ,
SIGNUP _ERROR _TEXT : 'Couldn\'t complete registration due to errors' ,
ENTER _ACCOUNT _EMAIL : 'Enter your account email.' ,
RESEND _VERIFICATION _EMAIL : 'Resend Verification Email' ,
SAVE _CHANGES : 'Save Changes' ,
CANCEL _BTN : 'Cancel' ,
EDIT _PROFILE : 'Edit your profile' ,
UPDATE _PROFILE _BTN : 'Update Profile' ,
PROFILE _SAVE _SUCCESS : 'Profile saved successfully' ,
PROFILE _SAVE _ERROR : 'Could\'t Save Your Profile.' ,
CONNECTED _SOCIAL _ACCOUNTS : 'Connected social accounts' ,
CONNECT _OTHER _SOCIAL _ACCOUNTS : 'Connect other social accounts' ,
FORGOT _PASSWORD _LINK : 'Forgot your password?' ,
REVERIFY _ACCOUNT _LINK : 'Resend your verification email' ,
SIGNIN _BTN : 'Sign in' ,
SIGNUP _BTN : 'Sign up' ,
SAVE _PASSWORD _BTN : 'Save Password' ,
SUCCESS _HEADER : 'Signup Successful' ,
SUCCESS _TEXT : 'You’ ve successfully registered an account at TellForm.' ,
VERIFICATION _EMAIL _SENT : 'Verification Email has been Sent' ,
VERIFICATION _EMAIL _SENT _TO : 'A verification email has been sent to' ,
NOT _ACTIVATED _YET : 'But your account is not activated yet' ,
BEFORE _YOU _CONTINUE : 'Before you continue, make sure to check your email for our verification. If you don’ t receive it within 24h drop us a line at ' ,
CHECK _YOUR _EMAIL : 'Check your email and click on the activation link to activate your account. If you have any questions drop us a line at' ,
CONTINUE : 'Continue' ,
PASSWORD _RESTORE _HEADER : 'Restore your password' ,
ENTER _YOUR _EMAIL : 'Enter your account email.' ,
SUBMIT _BTN : 'Submit' ,
ASK _FOR _NEW _PASSWORD : 'Ask for new password reset' ,
PASSWORD _RESET _INVALID : 'Password reset is invalid' ,
PASSWORD _RESET _SUCCESS : 'Passport successfully reset' ,
PASSWORD _CHANGE _SUCCESS : 'Passport successfully changed' ,
RESET _PASSWORD : 'Reset your password' ,
CHANGE _PASSWORD : 'Change your password' ,
CONTINUE _TO _LOGIN : 'Continue to login page' ,
VERIFY _SUCCESS : 'Account successfully activated' ,
VERIFY _ERROR : 'Verification link is invalid or has expired'
} ) ;
$translateProvider . preferredLanguage ( 'en' )
. fallbackLanguage ( 'en' )
. useSanitizeValueStrategy ( 'escape' ) ;
} ] ) ;
'use strict' ;
angular . module ( 'users' ) . config ( [ '$translateProvider' , function ( $translateProvider ) {
$translateProvider . translations ( 'fr' , {
ACCESS _DENIED _TEXT : 'Vouz n’ êtes pas autorisé à accéder à cette page.' ,
USERNAME _LABEL : 'Nom d’ utilisateur' ,
PASSWORD _LABEL : 'Mot de Passe' ,
CURRENT _PASSWORD _LABEL : 'Mot de passe actuel' ,
NEW _PASSWORD _LABEL : 'Nouveau Mot de Passe' ,
VERIFY _PASSWORD _LABEL : 'Vérifier le mot de passe' ,
UPDATE _PASSWORD _LABEL : 'Mettre à jour le mot de passe' ,
FIRST _NAME _LABEL : 'Prénom' ,
LAST _NAME _LABEL : 'Nom' ,
LANGUAGE _LABEL : 'Langue' ,
EMAIL _LABEL : 'Email' ,
UPDATE _PROFILE _BTN : 'Modifier le Profil' ,
PROFILE _SAVE _SUCCESS : 'Profil enregistré avec succès' ,
PROFILE _SAVE _ERROR : 'Erreur: impossible d’ enregistrer votre Profile.' ,
FORGOT _PASSWORD _LINK : 'Mot de passe oublié ?' ,
REVERIFY _ACCOUNT _LINK : 'Re-envoyez un email de vérification' ,
SIGNIN _BTN : 'Connexion' ,
SIGNUP _BTN : 'Créer un compte' ,
SAVE _PASSWORD _BTN : 'Enregistrer votre nouveau Mot de Passe' ,
SUCCESS _HEADER : 'Votre Compte a été enregistré !' ,
SUCCESS _TEXT : 'Votre compte Tellform a été crée avec succès.' ,
VERIFICATION _EMAIL _SENT : 'Un email de verification a été envoyer à' ,
NOT _ACTIVATED _YET : 'Mais votre compte n\'est pas activé' ,
BEFORE _YOU _CONTINUE : 'Avant de continuer, vous devez valider votre adresse mail. Merci de vérifier votre boite mail. Si vous ne l’ avez pas reçu dans les prochaines 24h, contactez-nous a ' ,
CHECK _YOUR _EMAIL : 'Vérifiez vos emails, et cliquez sur le lien de validation pour activer votre compte. Si vous avez une question contactez-nous à' ,
PASSWORD _RESTORE _HEADER : 'Mot de passe perdu' ,
ENTER _YOUR _EMAIL : 'Entrer votre email' ,
SUBMIT _BTN : 'Enregistrer' ,
ASK _FOR _NEW _PASSWORD : 'Demander un nouveau mot de pass ' ,
PASSWORD _RESET _INVALID : 'Le nouveau mot de passe est invalid' ,
PASSWORD _RESET _SUCCESS : 'Mot de passe réinitialisé avec succès' ,
PASSWORD _CHANGE _SUCCESS : 'Mot de passe enregistré avec succès' ,
CONTINUE _TO _LOGIN : 'Allez à la page de connexion' ,
VERIFY _SUCCESS : 'Votre compte est activé !' ,
VERIFY _ERROR : 'Le lien de vérification est invalide ou à expiré'
} ) ;
} ] ) ;
'use strict' ;
angular . module ( 'users' ) . config ( [ '$translateProvider' , function ( $translateProvider ) {
$translateProvider . translations ( 'es' , {
ACCESS _DENIED _TEXT : 'Tenés que estar logueado para acceder a esta página' ,
USERNAME _OR _EMAIL _LABEL : 'Usuario o Email' ,
USERNAME _LABEL : 'Usuario' ,
PASSWORD _LABEL : 'Contraseña' ,
CURRENT _PASSWORD _LABEL : 'Contraseña actual' ,
NEW _PASSWORD _LABEL : 'Nueva contraseña' ,
VERIFY _PASSWORD _LABEL : 'Verificar contraseña' ,
UPDATE _PASSWORD _LABEL : 'Actualizar contraseña' ,
FIRST _NAME _LABEL : 'Nombre' ,
LAST _NAME _LABEL : 'Apellido' ,
LANGUAGE _LABEL : 'Idioma' ,
EMAIL _LABEL : 'Email' ,
SIGNUP _ACCOUNT _LINK : '¿No tenés cuenta? Resgistrate acá' ,
SIGN _IN _ACCOUNT _LINK : '¿Ya tenés cuenta? Entra acá' ,
SIGNUP _HEADER _TEXT : 'Registrar' ,
SIGNIN _HEADER _TEXT : 'Entrar' ,
SIGNUP _ERROR _TEXT : 'No se pudo terminar la registración por errores' ,
ENTER _ACCOUNT _EMAIL : 'Ingresá tu correo electrónico.' ,
RESEND _VERIFICATION _EMAIL : 'Reenviar email de verificación' ,
SAVE _CHANGES : 'Grabar cambios' ,
CANCEL _BTN : 'Cancelar' ,
EDIT _PROFILE : 'Editar perfil' ,
UPDATE _PROFILE _BTN : 'Actualizar perfil' ,
PROFILE _SAVE _SUCCESS : 'Perfil actualizado satisfactoriamente' ,
PROFILE _SAVE _ERROR : 'No se pudo grabar el perfil.' ,
CONNECTED _SOCIAL _ACCOUNTS : 'Redes sociales conectadas' ,
CONNECT _OTHER _SOCIAL _ACCOUNTS : 'Conectar otras redes sociales' ,
FORGOT _PASSWORD _LINK : '¿Olvidaste la contraseña?' ,
REVERIFY _ACCOUNT _LINK : 'Reenviar email de verificación' ,
SIGNIN _BTN : 'Entrar' ,
SIGNUP _BTN : 'Registrarse' ,
SAVE _PASSWORD _BTN : 'Grabar contraseña' ,
SUCCESS _HEADER : 'Ingresaste exitosamente' ,
SUCCESS _TEXT : 'Registraste exitosamente una cuenta en TellForm.' ,
VERIFICATION _EMAIL _SENT : 'El email de verificación fue enviado exitosamente' ,
VERIFICATION _EMAIL _SENT _TO : 'Un email de verificación fue enviado a' ,
NOT _ACTIVATED _YET : 'Tu cuenta aún no está activa' ,
BEFORE _YOU _CONTINUE : 'Antes de continuar asegurate de leer el email de verificación que te enviamos. Si no lo recibís en 24hs escribinos a ' ,
CHECK _YOUR _EMAIL : 'Leé el email y hacé click en el link de activación para activar la cuenta. Si tenés alguna pregunta escribinos a ' ,
CONTINUE : 'Continuar' ,
PASSWORD _RESTORE _HEADER : 'Restaurar la contraseña' ,
ENTER _YOUR _EMAIL : 'Ingresá el email de tu cuenta.' ,
SUBMIT _BTN : 'Enviar' ,
ASK _FOR _NEW _PASSWORD : 'Pedir reseteo de contraseña' ,
PASSWORD _RESET _INVALID : 'El reseteo de la contraseña es inválido' ,
PASSWORD _RESET _SUCCESS : 'Contraseña exitosamente reseteada' ,
PASSWORD _CHANGE _SUCCESS : 'Contraseña exitosamente cambiada' ,
RESET _PASSWORD : 'Resetear contraseña' ,
CHANGE _PASSWORD : 'Cambiar contraseña' ,
CONTINUE _TO _LOGIN : 'Ir a la página de ingreso' ,
VERIFY _SUCCESS : 'Cuenta activada exitosamente' ,
VERIFY _ERROR : 'El link de verificación es inválido o inexistente'
} ) ;
} ] ) ;
'use strict' ;
angular . module ( 'forms' ) . config ( [ '$translateProvider' , function ( $translateProvider ) {
$translateProvider . translations ( 'en' , {
//Configure Form Tab View
ADVANCED _SETTINGS : 'Advanced Settings' ,
FORM _NAME : 'Form Name' ,
FORM _STATUS : 'Form Status' ,
PUBLIC : 'Public' ,
PRIVATE : 'Private' ,
GA _TRACKING _CODE : 'Google Analytics Tracking Code' ,
DISPLAY _FOOTER : 'Display Form Footer?' ,
SAVE _CHANGES : 'Save Changes' ,
CANCEL : 'Cancel' ,
DISPLAY _START _PAGE : 'Display Start Page?' ,
DISPLAY _END _PAGE : 'Display Custom End Page?' ,
//List Forms View
CREATE _A _NEW _FORM : 'Create a new form' ,
CREATE _FORM : 'Create form' ,
CREATED _ON : 'Created on' ,
MY _FORMS : 'My forms' ,
NAME : 'Name' ,
LANGUAGE : 'Language' ,
FORM _PAUSED : 'Form paused' ,
//Edit Field Modal
EDIT _FIELD : 'Edit this Field' ,
SAVE _FIELD : 'Save' ,
ON : 'ON' ,
OFF : 'OFF' ,
REQUIRED _FIELD : 'Required' ,
LOGIC _JUMP : 'Logic Jump' ,
SHOW _BUTTONS : 'Additional Buttons' ,
SAVE _START _PAGE : 'Save' ,
//Admin Form View
ARE _YOU _SURE : 'Are you ABSOLUTELY sure?' ,
READ _WARNING : 'Unexpected bad things will happen if you don’ t read this!' ,
DELETE _WARNING1 : 'This action CANNOT be undone. This will permanently delete the "' ,
DELETE _WARNING2 : '" form and remove all associated form submissions.' ,
DELETE _CONFIRM : 'Please type in the name of the form to confirm.' ,
I _UNDERSTAND : 'I understand the consequences, delete this form.' ,
DELETE _FORM _SM : 'Delete' ,
DELETE _FORM _MD : 'Delete Form' ,
DELETE : 'Delete' ,
FORM : 'Form' ,
VIEW : 'View' ,
LIVE : 'Live' ,
PREVIEW : 'Preview' ,
COPY : 'Copy' ,
COPY _AND _PASTE : 'Copy and Paste this to add your TellForm to your website' ,
CHANGE _WIDTH _AND _HEIGHT : 'Change the width and height values to suit you best' ,
POWERED _BY : 'Powered by' ,
TELLFORM _URL : 'Your TellForm is permanently at this URL' ,
//Edit Form View
DISABLED : 'Disabled' ,
YES : 'YES' ,
NO : 'NO' ,
ADD _LOGIC _JUMP : 'Add Logic Jump' ,
ADD _FIELD _LG : 'Click to Add New Field' ,
ADD _FIELD _MD : 'Add New Field' ,
ADD _FIELD _SM : 'Add Field' ,
EDIT _START _PAGE : 'Edit Start Page' ,
EDIT _END _PAGE : 'Edit End Page' ,
WELCOME _SCREEN : 'Start Page' ,
END _SCREEN : 'End Page' ,
INTRO _TITLE : 'Title' ,
INTRO _PARAGRAPH : 'Paragraph' ,
INTRO _BTN : 'Start Button' ,
TITLE : 'Title' ,
PARAGRAPH : 'Paragraph' ,
BTN _TEXT : 'Go Back Button' ,
BUTTONS : 'Buttons' ,
BUTTON _TEXT : 'Text' ,
BUTTON _LINK : 'Link' ,
ADD _BUTTON : 'Add Button' ,
PREVIEW _FIELD : 'Preview Question' ,
QUESTION _TITLE : 'Title' ,
QUESTION _DESCRIPTION : 'Description' ,
OPTIONS : 'Options' ,
ADD _OPTION : 'Add Option' ,
NUM _OF _STEPS : 'Number of Steps' ,
CLICK _FIELDS _FOOTER : 'Click on fields to add them here' ,
SHAPE : 'Shape' ,
IF _THIS _FIELD : 'If this field' ,
IS _EQUAL _TO : 'is equal to' ,
IS _NOT _EQUAL _TO : 'is not equal to' ,
IS _GREATER _THAN : 'is greater than' ,
IS _GREATER _OR _EQUAL _THAN : 'is greater or equal than' ,
IS _SMALLER _THAN : 'is_smaller_than' ,
IS _SMALLER _OR _EQUAL _THAN : 'is smaller or equal than' ,
CONTAINS : 'contains' ,
DOES _NOT _CONTAINS : 'does not contain' ,
ENDS _WITH : 'ends with' ,
DOES _NOT _END _WITH : 'does not end with' ,
STARTS _WITH : 'starts with' ,
DOES _NOT _START _WITH : 'does not start with' ,
THEN _JUMP _TO : 'then jump to' ,
//Edit Submissions View
TOTAL _VIEWS : 'total unique visits' ,
RESPONSES : 'responses' ,
COMPLETION _RATE : 'completion rate' ,
AVERAGE _TIME _TO _COMPLETE : 'avg. completion time' ,
DESKTOP _AND _LAPTOP : 'Desktops' ,
TABLETS : 'Tablets' ,
PHONES : 'Phones' ,
OTHER : 'Other' ,
UNIQUE _VISITS : 'Unique Visits' ,
FIELD _TITLE : 'Field Title' ,
FIELD _VIEWS : 'Field Views' ,
FIELD _DROPOFF : 'Field Completion' ,
FIELD _RESPONSES : 'Field Responses' ,
DELETE _SELECTED : 'Delete Selected' ,
EXPORT _TO _EXCEL : 'Export to Excel' ,
EXPORT _TO _CSV : 'Export to CSV' ,
EXPORT _TO _JSON : 'Export to JSON' ,
PERCENTAGE _COMPLETE : 'Percentage Complete' ,
TIME _ELAPSED : 'Time Elapsed' ,
DEVICE : 'Device' ,
LOCATION : 'Location' ,
IP _ADDRESS : 'IP Address' ,
DATE _SUBMITTED : 'Date Submitted' ,
GENERATED _PDF : 'Generated PDF' ,
//Design View
BACKGROUND _COLOR : 'Background Color' ,
DESIGN _HEADER : 'Change how your Form Looks' ,
QUESTION _TEXT _COLOR : 'Question Text Color' ,
ANSWER _TEXT _COLOR : 'Answer Text Color' ,
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' ,
//Admin Tabs
CREATE _TAB : 'Create' ,
DESIGN _TAB : 'Design' ,
CONFIGURE _TAB : 'Configure' ,
ANALYZE _TAB : 'Analyze' ,
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' ,
//Form Preview
FORM _SUCCESS : 'Form entry successfully submitted!' ,
REVIEW : 'Review' ,
BACK _TO _FORM : 'Go back to Form' ,
EDIT _FORM : 'Edit 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' ,
NEWLINE : 'press SHIFT+ENTER to create a newline' ,
CONTINUE : 'Continue' ,
LEGAL _ACCEPT : 'I accept' ,
LEGAL _NO _ACCEPT : 'I don’ t accept' ,
SUBMIT : 'Submit' ,
UPLOAD _FILE : 'Upload your File'
} ) ;
} ] ) ;
'use strict' ;
angular . module ( 'forms' ) . config ( [ '$translateProvider' , function ( $translateProvider ) {
$translateProvider . translations ( 'french' , {
FORM _SUCCESS : 'Votre formulaire a été enregistré!' ,
REVIEW : 'Incomplet' ,
BACK _TO _FORM : 'Retourner au formulaire' ,
EDIT _FORM : 'Éditer le Tellform' ,
CREATE _FORM : 'Créer un TellForm' ,
ADVANCEMENT : '{{done}} complétés sur {{total}}' ,
CONTINUE _FORM : 'Aller au formulaire' ,
REQUIRED : 'obligatoire' ,
COMPLETING _NEEDED : '{{answers_not_completed}} réponse(s) doive(nt) être complétée(s)' ,
OPTIONAL : 'facultatif' ,
ERROR _EMAIL _INVALID : 'Merci de rentrer une adresse mail valide' ,
ERROR _NOT _A _NUMBER : 'Merce de ne rentrer que des nombres' ,
ERROR _URL _INVALID : 'Merci de rentrer une url valide' ,
OK : 'OK' ,
ENTER : 'presser ENTRÉE' ,
YES : 'Oui' ,
NO : 'Non' ,
NEWLINE : 'presser SHIFT+ENTER pour créer une nouvelle ligne' ,
CONTINUE : 'Continuer' ,
LEGAL _ACCEPT : 'J’ accepte' ,
LEGAL _NO _ACCEPT : 'Je n’ accepte pas' ,
DELETE : 'Supprimer' ,
CANCEL : 'Réinitialiser' ,
SUBMIT : 'Enregistrer' ,
UPLOAD _FILE : 'Envoyer un fichier' ,
Y : 'O' ,
N : 'N' ,
} ) ;
} ] ) ;
'use strict' ;
angular . module ( 'forms' ) . config ( [ '$translateProvider' , function ( $translateProvider ) {
$translateProvider . translations ( 'german' , {
FORM _SUCCESS : 'Ihre Angaben wurden gespeichert.' ,
REVIEW : 'Unvollständig' ,
BACK _TO _FORM : 'Zurück zum Formular' ,
EDIT _FORM : '' ,
CREATE _FORM : '' ,
ADVANCEMENT : '{{done}} von {{total}} beantwortet' ,
CONTINUE _FORM : 'Zum Formular' ,
REQUIRED : 'verpflichtend' ,
COMPLETING _NEEDED : 'Es fehlen/fehtl noch {{answers_not_completed}} Antwort(en)' ,
OPTIONAL : 'fakultativ' ,
ERROR _EMAIL _INVALID : 'Bitte gültige Mailadresse eingeben' ,
ERROR _NOT _A _NUMBER : 'Bitte nur Zahlen eingeben' ,
ERROR _URL _INVALID : 'Bitte eine gültige URL eingeben' ,
OK : 'Okay' ,
ENTER : 'Eingabetaste drücken' ,
YES : 'Ja' ,
NO : 'Nein' ,
NEWLINE : 'Für eine neue Zeile SHIFT+ENTER drücken' ,
CONTINUE : 'Weiter' ,
LEGAL _ACCEPT : 'I accept' ,
LEGAL _NO _ACCEPT : 'I don’ t accept' ,
DELETE : 'Entfernen' ,
CANCEL : 'Canceln' ,
SUBMIT : 'Speichern' ,
UPLOAD _FILE : 'Datei versenden' ,
Y : 'J' ,
N : 'N' ,
} ) ;
} ] ) ;
'use strict' ;
angular . module ( 'forms' ) . config ( [ '$translateProvider' , function ( $translateProvider ) {
$translateProvider . translations ( 'italian' , {
FORM _SUCCESS : 'Il formulario è stato inviato con successo!' ,
REVIEW : 'Incompleto' ,
BACK _TO _FORM : 'Ritorna al formulario' ,
EDIT _FORM : '' ,
CREATE _FORM : '' ,
ADVANCEMENT : '{{done}} su {{total}} completate' ,
CONTINUE _FORM : 'Vai al formulario' ,
REQUIRED : 'obbligatorio' ,
COMPLETING _NEEDED : '{{answers_not_completed}} risposta/e deve/ono essere completata/e' ,
OPTIONAL : 'opzionale' ,
ERROR _EMAIL _INVALID : 'Si prega di inserire un indirizzo email valido' ,
ERROR _NOT _A _NUMBER : 'Si prega di inserire solo numeri' ,
ERROR _URL _INVALID : 'Grazie per inserire un URL valido' ,
OK : 'OK' ,
ENTER : 'premere INVIO' ,
YES : 'Sì' ,
NO : 'No' ,
NEWLINE : 'premere SHIFT+INVIO per creare una nuova linea' ,
CONTINUE : 'Continua' ,
LEGAL _ACCEPT : 'I accept' ,
LEGAL _NO _ACCEPT : 'I don’ t accept' ,
DELETE : 'Cancella' ,
CANCEL : 'Reset' ,
SUBMIT : 'Registra' ,
UPLOAD _FILE : 'Invia un file' ,
Y : 'S' ,
N : 'N' ,
} ) ;
} ] ) ;
'use strict' ;
angular . module ( 'forms' ) . config ( [ '$translateProvider' , function ( $translateProvider ) {
$translateProvider . translations ( 'es' , {
//Configure Form Tab View
ADVANCED _SETTINGS : 'Configuraciones avanzadas' ,
FORM _NAME : 'Nombre del formulario' ,
FORM _STATUS : 'Estado del formulario' ,
PUBLIC : 'Público' ,
PRIVATE : 'Privado' ,
GA _TRACKING _CODE : 'Código de Google Analytics' ,
DISPLAY _FOOTER : '¿Mostrar pie de página?' ,
SAVE _CHANGES : 'Grabar' ,
CANCEL : 'Cancelar' ,
DISPLAY _START _PAGE : '¿Mostrar página de inicio?' ,
DISPLAY _END _PAGE : '¿Mostrar paǵina de fin?' ,
//List Forms View
CREATE _A _NEW _FORM : 'Crear formulario' ,
CREATE _FORM : 'Crear formulario' ,
CREATED _ON : 'Creado en' ,
MY _FORMS : 'Mis formularios' ,
NAME : 'Nombre' ,
LANGUAGE : 'Idioma' ,
FORM _PAUSED : 'Formulario pausado' ,
//Edit Field Modal
EDIT _FIELD : 'Editar este campo' ,
SAVE _FIELD : 'Grabar' ,
ON : 'ON' ,
OFF : 'OFF' ,
REQUIRED _FIELD : 'Requerido' ,
LOGIC _JUMP : 'Salto lógico' ,
SHOW _BUTTONS : 'Botones adicionales' ,
SAVE _START _PAGE : 'Grabar' ,
//Admin Form View
ARE _YOU _SURE : '¿Estás absolutamente seguro?' ,
READ _WARNING : '¡Algo malo ocurrirá si no lees esto!' ,
DELETE _WARNING1 : 'Esta acción no tiene vuelta atrás. Esto borrará permanentemente el "' ,
DELETE _WARNING2 : '" formulario y todos los datos asociados.' ,
DELETE _CONFIRM : 'Por favor escribí el nombre del formulario para confirmar.' ,
I _UNDERSTAND : 'Entiendo las consecuencias y quiero borrarlo.' ,
DELETE _FORM _SM : 'Borrar' ,
DELETE _FORM _MD : 'Borrar formulario' ,
DELETE : 'Borrar' ,
FORM : 'Formulario' ,
VIEW : 'Vista' ,
LIVE : 'Online' ,
PREVIEW : 'Vista previa' ,
COPY : 'Copiar' ,
COPY _AND _PASTE : 'Copiar y pegar esto para agregar su TellForm a su sitio web' ,
CHANGE _WIDTH _AND _HEIGHT : 'Cambie los valores de ancho y altura para adaptar el formulario a sus necesidades' ,
POWERED _BY : 'Con la tecnlogía de' ,
TELLFORM _URL : 'Tu TellForm está en esta URL permanente' ,
//Edit Form View
DISABLED : 'Deshabilitado' ,
YES : 'SI' ,
NO : 'NO' ,
ADD _LOGIC _JUMP : 'Agregar salto lógico' ,
ADD _FIELD _LG : 'Click para agregar campo' ,
ADD _FIELD _MD : 'Agregar nuevo campo' ,
ADD _FIELD _SM : 'Agregar campo' ,
EDIT _START _PAGE : 'Editar paǵina de inicio' ,
EDIT _END _PAGE : 'Editar página de finalización' ,
WELCOME _SCREEN : 'Comienzo' ,
END _SCREEN : 'Fin' ,
INTRO _TITLE : 'Título' ,
INTRO _PARAGRAPH : 'Parágrafo' ,
INTRO _BTN : 'Botón de comienzo' ,
TITLE : 'Título' ,
PARAGRAPH : 'Paragrafo' ,
BTN _TEXT : 'Botón para volver atrás' ,
BUTTONS : 'Botones' ,
BUTTON _TEXT : 'Texto' ,
BUTTON _LINK : 'Link' ,
ADD _BUTTON : 'Agregar Botón' ,
PREVIEW _FIELD : 'Vista previa Pregunta' ,
QUESTION _TITLE : 'Título' ,
QUESTION _DESCRIPTION : 'Descripción' ,
OPTIONS : 'Opciones' ,
ADD _OPTION : 'Agregar Opciones' ,
NUM _OF _STEPS : 'Cantidad de pasos' ,
CLICK _FIELDS _FOOTER : 'Click en los campos para agregar' ,
SHAPE : 'Forma' ,
IF _THIS _FIELD : 'Si este campo' ,
IS _EQUAL _TO : 'es igual a' ,
IS _NOT _EQUAL _TO : 'no es igual a' ,
IS _GREATER _THAN : 'es mayor que' ,
IS _GREATER _OR _EQUAL _THAN : 'es mayor o igual que' ,
IS _SMALLER _THAN : 'es menor que' ,
IS _SMALLER _OR _EQUAL _THAN : 'is menor o igual que' ,
CONTAINS : 'contiene' ,
DOES _NOT _CONTAINS : 'no contiene' ,
ENDS _WITH : 'termina con' ,
DOES _NOT _END _WITH : 'no termina con' ,
STARTS _WITH : 'comienza con' ,
DOES _NOT _START _WITH : 'no comienza con' ,
THEN _JUMP _TO : 'luego salta a' ,
//Edit Submissions View
TOTAL _VIEWS : 'Total de visitas únicas' ,
RESPONSES : 'respuestas' ,
COMPLETION _RATE : 'Taza de terminación' ,
AVERAGE _TIME _TO _COMPLETE : 'Promedio de tiempo de rellenado' ,
DESKTOP _AND _LAPTOP : 'Computadora' ,
TABLETS : 'Tablets' ,
PHONES : 'Móviles' ,
OTHER : 'Otros' ,
UNIQUE _VISITS : 'Visitas únicas' ,
FIELD _TITLE : 'Título de campo' ,
FIELD _VIEWS : 'Vistas de campo' ,
FIELD _DROPOFF : 'Finalización de campo' ,
FIELD _RESPONSES : 'Respuestas de campo' ,
DELETE _SELECTED : 'Borrar selección' ,
EXPORT _TO _EXCEL : 'Exportar a Excel' ,
EXPORT _TO _CSV : 'Exportar a CSV' ,
EXPORT _TO _JSON : 'Exportar a JSON' ,
PERCENTAGE _COMPLETE : 'Porcentaje de completitud' ,
TIME _ELAPSED : 'Tiempo usado' ,
DEVICE : 'Dispositivo' ,
LOCATION : 'Lugar' ,
IP _ADDRESS : 'Dirección IP' ,
DATE _SUBMITTED : 'Fecha de envío' ,
GENERATED _PDF : 'PDF generado' ,
//Design View
BACKGROUND _COLOR : 'Color de fondo' ,
DESIGN _HEADER : 'Cambiar diseño de formulario' ,
QUESTION _TEXT _COLOR : 'Color de la pregunta' ,
ANSWER _TEXT _COLOR : 'Color de la respuesta' ,
BTN _BACKGROUND _COLOR : 'Color de fondo del botón' ,
BTN _TEXT _COLOR : 'Color del texto del botón' ,
//Share View
EMBED _YOUR _FORM : 'Pone tu formulario' ,
SHARE _YOUR _FORM : 'Compartí tu formulario' ,
//Admin Tabs
CREATE _TAB : 'Crear' ,
DESIGN _TAB : 'Diseño' ,
CONFIGURE _TAB : 'Configuración' ,
ANALYZE _TAB : 'Análisis' ,
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' ,
FORM _SUCCESS : '¡El formulario ha sido enviado con éxito!' ,
REVIEW : 'Revisar' ,
BACK _TO _FORM : 'Regresar al formulario' ,
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' ,
NEWLINE : 'presione SHIFT+INTRO para crear una nueva línea' ,
CONTINUE : 'Continuar' ,
LEGAL _ACCEPT : 'Yo acepto' ,
LEGAL _NO _ACCEPT : 'Yo no acepto' ,
SUBMIT : 'Registrar' ,
UPLOAD _FILE : 'Cargar el archivo' ,
Y : 'S' ,
N : 'N'
} ) ;
} ] ) ;
2017-07-28 21:47:09 +00:00
2017-09-30 00:33:55 +00:00
'use strict' ;
2017-03-06 21:45:11 +00:00
2017-09-30 00:33:55 +00:00
// Use Application configuration module to register a new module
ApplicationConfiguration . registerModule ( 'view-form' , [
'ngFileUpload' , 'ui.date' , 'angular-input-stars'
] ) ;
2016-06-18 21:01:02 +00:00
2017-09-30 00:33:55 +00:00
( function ( ) {
'use strict' ;
2017-03-06 21:45:11 +00:00
2017-09-30 00:33:55 +00:00
// Create the SendVisitorData service
angular
. module ( 'view-form' )
. factory ( 'SendVisitorData' , SendVisitorData ) ;
2016-11-09 19:04:47 +00:00
2017-09-30 00:33:55 +00:00
SendVisitorData . $inject = [ 'Socket' , '$state' ] ;
2016-11-09 19:04:47 +00:00
2017-09-30 00:33:55 +00:00
function SendVisitorData ( Socket , $state ) {
2017-07-28 21:47:09 +00:00
2017-09-30 00:33:55 +00:00
// Create a controller method for sending visitor data
function send ( form , lastActiveIndex , timeElapsed ) {
2016-11-09 19:04:47 +00:00
2017-09-30 00:33:55 +00:00
var lang = window . navigator . userLanguage || window . navigator . language ;
lang = lang . slice ( 0 , 2 ) ;
2016-11-09 19:04:47 +00:00
2017-09-30 00:33:55 +00:00
var userAgentString = navigator . userAgent ;
var md = new MobileDetect ( userAgentString ) ;
var deviceType = 'other' ;
2016-11-09 19:04:47 +00:00
2017-09-30 00:33:55 +00:00
if ( md . tablet ( ) ) {
deviceType = 'tablet' ;
} else if ( md . mobile ( ) ) {
deviceType = 'mobile' ;
} else if ( ! md . is ( 'bot' ) ) {
deviceType = 'desktop' ;
}
2017-07-27 04:53:31 +00:00
2017-09-30 00:33:55 +00:00
// Create a new message object
var visitorData = {
referrer : document . referrer ,
isSubmitted : form . submitted ,
formId : form . _id ,
lastActiveField : form . form _fields [ lastActiveIndex ] . _id ,
timeElapsed : timeElapsed ,
language : lang ,
deviceType : deviceType ,
2017-10-07 08:34:01 +00:00
ipAddr : null ,
geoLocation : null
2017-09-30 00:33:55 +00:00
} ;
2017-10-02 10:18:47 +00:00
2017-09-30 00:33:55 +00:00
Socket . emit ( 'form-visitor-data' , visitorData ) ;
}
2016-06-18 21:01:02 +00:00
2017-09-30 00:33:55 +00:00
function init ( ) {
// Make sure the Socket is connected
if ( ! Socket . socket ) {
Socket . connect ( ) ;
}
2017-10-02 10:18:47 +00:00
Socket . on ( 'disconnect' , function ( ) {
Socket . connect ( ) ;
} ) ;
2017-09-30 00:33:55 +00:00
}
2016-06-18 21:01:02 +00:00
2017-09-30 00:33:55 +00:00
var service = {
send : send
} ;
2016-06-18 21:01:02 +00:00
2017-09-30 00:33:55 +00:00
init ( ) ;
return service ;
2016-05-20 20:35:50 +00:00
2017-09-30 00:33:55 +00:00
}
} ( ) ) ;
2016-05-20 20:35:50 +00:00
2017-09-30 00:33:55 +00:00
'use strict' ;
2016-05-20 20:35:50 +00:00
2017-09-30 00:33:55 +00:00
angular . module ( 'view-form' ) . directive ( 'keyToOption' , function ( ) {
return {
restrict : 'A' ,
scope : {
field : '='
} ,
link : function ( $scope , $element , $attrs , $select ) {
$element . bind ( 'keydown keypress' , function ( event ) {
2016-05-20 20:35:50 +00:00
2017-09-30 00:33:55 +00:00
var keyCode = event . which || event . keyCode ;
var index = parseInt ( String . fromCharCode ( keyCode ) ) - 1 ;
2016-05-20 20:35:50 +00:00
2017-09-30 00:33:55 +00:00
if ( index < $scope . field . fieldOptions . length ) {
event . preventDefault ( ) ;
$scope . $apply ( function ( ) {
$scope . field . fieldValue = $scope . field . fieldOptions [ index ] . option _value ;
} ) ;
}
2016-05-20 20:35:50 +00:00
2017-09-30 00:33:55 +00:00
} ) ;
}
} ;
} ) ;
2016-05-20 20:35:50 +00:00
2016-06-08 23:12:48 +00:00
'use strict' ;
2016-05-20 20:35:50 +00:00
2017-09-30 00:33:55 +00:00
angular . module ( 'view-form' ) . directive ( 'keyToTruthy' , [ '$rootScope' , function ( $rootScope ) {
return {
restrict : 'A' ,
scope : {
field : '=' ,
nextField : '&'
} ,
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 ;
2017-10-02 10:18:47 +00:00
2017-09-30 00:33:55 +00:00
if ( keyCode === truthyKeyCode ) {
event . preventDefault ( ) ;
$scope . $apply ( function ( ) {
$scope . field . fieldValue = 'true' ;
if ( $attrs . onValidKey ) {
$scope . $root . $eval ( $attrs . onValidKey ) ;
}
} ) ;
} else if ( keyCode === falseyKeyCode ) {
event . preventDefault ( ) ;
$scope . $apply ( function ( ) {
$scope . field . fieldValue = 'false' ;
if ( $attrs . onValidKey ) {
$scope . $root . $eval ( $attrs . onValidKey ) ;
}
} ) ;
}
} ) ;
}
} ;
} ] ) ;
2017-03-10 00:18:18 +00:00
2016-05-20 20:35:50 +00:00
2016-06-08 23:12:48 +00:00
'use strict' ;
2016-05-20 20:35:50 +00:00
2017-09-30 00:33:55 +00:00
// Configuring the Forms drop-down menus
angular . module ( 'view-form' )
. filter ( 'formValidity' , function ( ) {
return function ( formObj ) {
if ( formObj && formObj . form _fields && formObj . visible _form _fields ) {
2017-07-31 21:30:55 +00:00
2017-09-30 00:33:55 +00:00
//get keys
var formKeys = Object . keys ( formObj ) ;
2016-05-20 20:35:50 +00:00
2017-09-30 00:33:55 +00:00
//we only care about things that don't start with $
var fieldKeys = formKeys . filter ( function ( key ) {
return key [ 0 ] !== '$' ;
} ) ;
var fields = formObj . form _fields ;
var valid _count = fields . filter ( function ( field ) {
if ( typeof field === 'object' && field . fieldType !== 'rating' && field . fieldType !== 'statement' ) {
return ! ! ( field . fieldValue ) ;
} else if ( field . fieldType === 'rating' ) {
return true ;
}
} ) . length ;
return valid _count - ( formObj . form _fields . length - formObj . visible _form _fields . length ) ;
}
return 0 ;
} ;
} ) ;
angular . module ( 'view-form' ) . value ( 'supportedFields' , [
2016-06-08 23:12:48 +00:00
'textfield' ,
'textarea' ,
'date' ,
'dropdown' ,
'hidden' ,
'password' ,
'radio' ,
'legal' ,
'statement' ,
'rating' ,
'yes_no' ,
'number' ,
'natural'
] ) ;
2016-06-07 21:30:15 +00:00
2017-09-30 00:33:55 +00:00
angular . module ( 'view-form' ) . constant ( 'VIEW_FORM_URL' , '/forms/:formId/render' ) ;
2016-06-08 23:12:48 +00:00
'use strict' ;
2016-06-07 21:30:15 +00:00
2017-09-30 00:33:55 +00:00
angular . module ( 'view-form' ) . config ( [ '$translateProvider' , function ( $translateProvider ) {
$translateProvider . translations ( 'english' , {
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 don’ t accept' ,
DELETE : 'Delete' ,
CANCEL : 'Cancel' ,
SUBMIT : 'Submit' ,
UPLOAD _FILE : 'Upload your File' ,
} ) ;
2016-06-07 21:30:15 +00:00
2017-09-30 00:33:55 +00:00
$translateProvider . preferredLanguage ( 'english' )
. fallbackLanguage ( 'english' )
. useSanitizeValueStrategy ( 'escape' ) ;
2016-05-20 20:35:50 +00:00
2017-09-30 00:33:55 +00:00
} ] ) ;
'use strict' ;
angular . module ( 'view-form' ) . config ( [ '$translateProvider' , function ( $translateProvider ) {
$translateProvider . translations ( 'french' , {
FORM _SUCCESS : 'Votre formulaire a été enregistré!' ,
REVIEW : 'Incomplet' ,
BACK _TO _FORM : 'Retourner au formulaire' ,
EDIT _FORM : 'Éditer le Tellform' ,
CREATE _FORM : 'Créer un TellForm' ,
ADVANCEMENT : '{{done}} complétés sur {{total}}' ,
CONTINUE _FORM : 'Aller au formulaire' ,
REQUIRED : 'obligatoire' ,
COMPLETING _NEEDED : '{{answers_not_completed}} réponse(s) doive(nt) être complétée(s)' ,
OPTIONAL : 'facultatif' ,
ERROR _EMAIL _INVALID : 'Merci de rentrer une adresse mail valide' ,
ERROR _NOT _A _NUMBER : 'Merce de ne rentrer que des nombres' ,
ERROR _URL _INVALID : 'Merci de rentrer une url valide' ,
OK : 'OK' ,
ENTER : 'presser ENTRÉE' ,
YES : 'Oui' ,
NO : 'Non' ,
NEWLINE : 'presser SHIFT+ENTER pour créer une nouvelle ligne' ,
CONTINUE : 'Continuer' ,
LEGAL _ACCEPT : 'J’ accepte' ,
LEGAL _NO _ACCEPT : 'Je n’ accepte pas' ,
DELETE : 'Supprimer' ,
CANCEL : 'Réinitialiser' ,
SUBMIT : 'Enregistrer' ,
UPLOAD _FILE : 'Envoyer un fichier' ,
Y : 'O' ,
N : 'N' ,
} ) ;
} ] ) ;
'use strict' ;
angular . module ( 'view-form' ) . config ( [ '$translateProvider' , function ( $translateProvider ) {
$translateProvider . translations ( 'german' , {
FORM _SUCCESS : 'Ihre Angaben wurden gespeichert.' ,
REVIEW : 'Unvollständig' ,
BACK _TO _FORM : 'Zurück zum Formular' ,
EDIT _FORM : '' ,
CREATE _FORM : '' ,
ADVANCEMENT : '{{done}} von {{total}} beantwortet' ,
CONTINUE _FORM : 'Zum Formular' ,
REQUIRED : 'verpflichtend' ,
COMPLETING _NEEDED : 'Es fehlen/fehtl noch {{answers_not_completed}} Antwort(en)' ,
OPTIONAL : 'fakultativ' ,
ERROR _EMAIL _INVALID : 'Bitte gültige Mailadresse eingeben' ,
ERROR _NOT _A _NUMBER : 'Bitte nur Zahlen eingeben' ,
ERROR _URL _INVALID : 'Bitte eine gültige URL eingeben' ,
OK : 'Okay' ,
ENTER : 'Eingabetaste drücken' ,
YES : 'Ja' ,
NO : 'Nein' ,
NEWLINE : 'Für eine neue Zeile SHIFT+ENTER drücken' ,
CONTINUE : 'Weiter' ,
LEGAL _ACCEPT : 'I accept' ,
LEGAL _NO _ACCEPT : 'I don’ t accept' ,
DELETE : 'Entfernen' ,
CANCEL : 'Canceln' ,
SUBMIT : 'Speichern' ,
UPLOAD _FILE : 'Datei versenden' ,
Y : 'J' ,
N : 'N' ,
} ) ;
} ] ) ;
'use strict' ;
angular . module ( 'view-form' ) . config ( [ '$translateProvider' , function ( $translateProvider ) {
$translateProvider . translations ( 'italian' , {
FORM _SUCCESS : 'Il formulario è stato inviato con successo!' ,
REVIEW : 'Incompleto' ,
BACK _TO _FORM : 'Ritorna al formulario' ,
EDIT _FORM : '' ,
CREATE _FORM : '' ,
ADVANCEMENT : '{{done}} su {{total}} completate' ,
CONTINUE _FORM : 'Vai al formulario' ,
REQUIRED : 'obbligatorio' ,
COMPLETING _NEEDED : '{{answers_not_completed}} risposta/e deve/ono essere completata/e' ,
OPTIONAL : 'opzionale' ,
ERROR _EMAIL _INVALID : 'Si prega di inserire un indirizzo email valido' ,
ERROR _NOT _A _NUMBER : 'Si prega di inserire solo numeri' ,
ERROR _URL _INVALID : 'Grazie per inserire un URL valido' ,
OK : 'OK' ,
ENTER : 'premere INVIO' ,
YES : 'Sì' ,
NO : 'No' ,
NEWLINE : 'premere SHIFT+INVIO per creare una nuova linea' ,
CONTINUE : 'Continua' ,
LEGAL _ACCEPT : 'I accept' ,
LEGAL _NO _ACCEPT : 'I don’ t accept' ,
DELETE : 'Cancella' ,
CANCEL : 'Reset' ,
SUBMIT : 'Registra' ,
UPLOAD _FILE : 'Invia un file' ,
Y : 'S' ,
N : 'N' ,
} ) ;
} ] ) ;
'use strict' ;
angular . module ( 'view-form' ) . config ( [ '$translateProvider' , function ( $translateProvider ) {
$translateProvider . translations ( 'spanish' , {
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'
} ) ;
} ] ) ;
'use strict' ;
// SubmitForm controller
angular . module ( 'view-form' ) . controller ( 'SubmitFormController' , [
'$scope' , '$rootScope' , '$state' , '$translate' , 'myForm' ,
function ( $scope , $rootScope , $state , $translate , myForm ) {
$scope . myform = myForm ;
2017-10-07 08:34:01 +00:00
$ ( ".loader" ) . fadeOut ( "slow" ) ;
document . body . style . background = myForm . design . colors . backgroundColor ;
2017-09-30 00:33:55 +00:00
$translate . use ( myForm . language ) ;
2016-06-08 23:12:48 +00:00
}
] ) ;
2016-05-20 20:35:50 +00:00
2016-06-07 21:30:15 +00:00
'use strict' ;
2016-05-20 20:35:50 +00:00
2017-09-30 00:33:55 +00:00
angular . module ( 'view-form' ) . directive ( 'fieldIconDirective' , function ( ) {
2016-05-20 20:35:50 +00:00
2016-06-08 23:12:48 +00:00
return {
template : '<i class="{{typeIcon}}"></i>' ,
restrict : 'E' ,
scope : {
typeName : '@'
} ,
controller : [ "$scope" , 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 ] ;
} ]
} ;
} ) ;
2016-05-20 20:35:50 +00:00
'use strict' ;
2016-06-08 23:12:48 +00:00
// coffeescript's for in loop
var _ _indexOf = [ ] . indexOf || function ( item ) {
2017-09-30 00:33:55 +00:00
for ( var i = 0 , l = this . length ; i < l ; i ++ ) {
if ( i in this && this [ i ] === item ) return i ;
}
return - 1 ;
} ;
2016-05-05 19:12:40 +00:00
2017-09-30 00:33:55 +00:00
angular . module ( 'view-form' ) . directive ( 'fieldDirective' , [ '$http' , '$compile' , '$rootScope' , '$templateCache' , 'supportedFields' ,
function ( $http , $compile , $rootScope , $templateCache , supportedFields ) {
var getTemplateHtml = function ( fieldType ) {
var type = fieldType ;
var supported _fields = [
'textfield' ,
'textarea' ,
'date' ,
'dropdown' ,
'hidden' ,
'password' ,
'radio' ,
'legal' ,
'statement' ,
'rating' ,
'yes_no' ,
'number' ,
'natural'
] ;
var templateUrl = 'form_modules/forms/base/views/directiveViews/field/' ;
if ( _ _indexOf . call ( supportedFields , type ) >= 0 ) {
templateUrl = templateUrl + type + '.html' ;
}
return $templateCache . get ( templateUrl ) ;
} ;
2016-06-07 21:30:15 +00:00
2017-09-30 00:33:55 +00:00
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 . nextField = $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
} ;
2016-06-08 23:12:48 +00:00
}
2016-06-07 21:30:15 +00:00
2017-09-30 00:33:55 +00:00
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' ;
2016-06-08 23:12:48 +00:00
}
2016-07-06 01:48:25 +00:00
2017-09-30 00:33:55 +00:00
var template = getTemplateHtml ( fieldType ) ;
element . html ( template ) . show ( ) ;
var output = $compile ( element . contents ( ) ) ( scope ) ;
}
} ;
} ] ) ;
2016-06-07 21:30:15 +00:00
2016-06-08 23:12:48 +00:00
'use strict' ;
2016-06-07 21:30:15 +00:00
2016-06-08 23:12:48 +00:00
//TODO: DAVID: Need to refactor this
2017-09-30 00:33:55 +00:00
angular . module ( 'view-form' ) . directive ( 'onEnterKey' , [ '$rootScope' , function ( $rootScope ) {
2016-06-08 23:12:48 +00:00
return {
restrict : 'A' ,
link : function ( $scope , $element , $attrs ) {
$element . bind ( 'keydown keypress' , function ( event ) {
2016-06-07 21:30:15 +00:00
2016-06-08 23:12:48 +00:00
var keyCode = event . which || event . keyCode ;
2016-06-07 21:30:15 +00:00
2016-06-08 23:12:48 +00:00
var onEnterKeyDisabled = false ;
if ( $attrs . onEnterKeyDisabled !== null ) onEnterKeyDisabled = $attrs . onEnterKeyDisabled ;
2016-06-07 21:30:15 +00:00
2016-06-08 23:12:48 +00:00
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 ) {
2017-10-07 08:34:01 +00:00
$element . bind ( 'keyup keypress' , function ( event ) {
2016-05-20 20:35:50 +00:00
2016-06-08 23:12:48 +00:00
var keyCode = event . which || event . keyCode ;
2016-05-20 20:35:50 +00:00
2016-06-08 23:12:48 +00:00
if ( keyCode === 9 && ! event . shiftKey ) {
2016-05-20 20:35:50 +00:00
2016-06-08 23:12:48 +00:00
event . preventDefault ( ) ;
$rootScope . $apply ( function ( ) {
$rootScope . $eval ( $attrs . onTabKey ) ;
} ) ;
2016-06-07 21:30:15 +00:00
}
} ) ;
2016-06-08 23:12:48 +00:00
}
} ;
} ] ) . directive ( 'onEnterOrTabKey' , [ '$rootScope' , function ( $rootScope ) {
return {
restrict : 'A' ,
link : function ( $scope , $element , $attrs ) {
$element . bind ( 'keydown keypress' , function ( event ) {
2016-05-20 20:35:50 +00:00
2016-06-08 23:12:48 +00:00
var keyCode = event . which || event . keyCode ;
2016-05-20 20:35:50 +00:00
2016-06-08 23:12:48 +00:00
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 ) {
2016-05-20 20:35:50 +00:00
2016-06-08 23:12:48 +00:00
var keyCode = event . which || event . keyCode ;
2016-05-20 20:35:50 +00:00
2016-06-08 23:12:48 +00:00
if ( keyCode === 9 && event . shiftKey ) {
2017-10-07 08:34:01 +00:00
console . log ( 'onTabAndShiftKey' ) ;
2016-06-08 23:12:48 +00:00
event . preventDefault ( ) ;
$rootScope . $apply ( function ( ) {
$rootScope . $eval ( $attrs . onTabAndShiftKey ) ;
} ) ;
}
} ) ;
}
} ;
} ] ) ;
2016-05-20 20:35:50 +00:00
2016-06-08 23:12:48 +00:00
'use strict' ;
2016-05-20 20:35:50 +00:00
2017-09-30 00:33:55 +00:00
angular . module ( 'view-form' ) . directive ( 'onFinishRender' , [ "$rootScope" , "$timeout" , function ( $rootScope , $timeout ) {
2016-06-08 23:12:48 +00:00
return {
restrict : 'A' ,
link : function ( scope , element , attrs ) {
2016-06-16 00:38:22 +00:00
2016-06-08 23:12:48 +00:00
//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 ;
}
2016-05-20 20:35:50 +00:00
2016-06-08 23:12:48 +00:00
var broadcastMessage = attrs . onFinishRender || 'ngRepeat' ;
2016-05-20 20:35:50 +00:00
2016-06-08 23:12:48 +00:00
if ( scope . $first && ! scope . $last ) {
scope . $evalAsync ( function ( ) {
$rootScope . $broadcast ( broadcastMessage + ' Started' ) ;
} ) ;
2017-09-30 00:33:55 +00:00
} else if ( scope . $last ) {
2016-06-08 23:12:48 +00:00
scope . $evalAsync ( function ( ) {
$rootScope . $broadcast ( broadcastMessage + ' Finished' ) ;
} ) ;
}
}
} ;
} ] ) ;
2016-05-20 20:35:50 +00:00
2016-06-07 21:30:15 +00:00
'use strict' ;
2016-05-20 20:35:50 +00:00
2017-09-30 00:33:55 +00:00
//FIXME: Should find an appropriate place for this
//Setting up jsep
jsep . addBinaryOp ( 'contains' , 10 ) ;
jsep . addBinaryOp ( '!contains' , 10 ) ;
jsep . addBinaryOp ( 'begins' , 10 ) ;
jsep . addBinaryOp ( '!begins' , 10 ) ;
jsep . addBinaryOp ( 'ends' , 10 ) ;
jsep . addBinaryOp ( '!ends' , 10 ) ;
2017-10-07 08:34:01 +00:00
angular . module ( 'view-form' ) . directive ( 'submitFormDirective' , [ '$http' , 'TimeCounter' , '$filter' , '$rootScope' , 'SendVisitorData' , '$translate' , '$timeout' ,
function ( $http , TimeCounter , $filter , $rootScope , SendVisitorData , $translate , $timeout ) {
2016-06-08 23:12:48 +00:00
return {
2017-09-30 00:33:55 +00:00
templateUrl : 'form_modules/forms/base/views/directiveViews/form/submit-form.client.view.html' ,
2016-06-08 23:12:48 +00:00
restrict : 'E' ,
scope : {
2017-09-30 00:33:55 +00:00
myform : '=' ,
ispreview : '='
2016-06-08 23:12:48 +00:00
} ,
controller : [ "$document" , "$window" , "$scope" , function ( $document , $window , $scope ) {
2017-10-07 08:34:01 +00:00
var NOSCROLL = false ;
var FORM _ACTION _ID = 'submit_field' ;
2016-06-08 23:12:48 +00:00
$scope . forms = { } ;
2017-09-30 00:33:55 +00:00
//Don't start timer if we are looking at a design preview
if ( $scope . ispreview ) {
TimeCounter . restartClock ( ) ;
}
2016-06-08 23:12:48 +00:00
var form _fields _count = $scope . myform . visible _form _fields . filter ( function ( field ) {
2017-09-30 00:33:55 +00:00
return field . fieldType !== 'statement' ;
} ) . length ;
2016-05-20 20:35:50 +00:00
2016-06-08 23:12:48 +00:00
var nb _valid = $filter ( 'formValidity' ) ( $scope . myform ) ;
$scope . translateAdvancementData = {
done : nb _valid ,
total : form _fields _count ,
answers _not _completed : form _fields _count - nb _valid
} ;
2016-05-20 20:35:50 +00:00
2016-06-08 23:12:48 +00:00
$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 ( ) ;
2016-05-20 20:35:50 +00:00
2016-06-08 23:12:48 +00:00
$scope . loading = false ;
$scope . error = '' ;
2016-05-20 20:35:50 +00:00
2016-06-08 23:12:48 +00:00
$scope . selected = {
_id : '' ,
index : 0
} ;
$scope . setActiveField ( $scope . myform . visible _form _fields [ 0 ] . _id , 0 , false ) ;
2016-05-20 20:35:50 +00:00
2016-06-08 23:12:48 +00:00
//Reset Timer
TimeCounter . restartClock ( ) ;
} ;
2016-05-20 20:35:50 +00:00
2016-06-08 23:12:48 +00:00
/ *
* * Field Controls
* /
2017-09-30 00:33:55 +00:00
var evaluateLogicJump = function ( field ) {
var logicJump = field . logicJump ;
2017-10-19 00:37:27 +00:00
if ( logicJump . enabled ) {
if ( logicJump . expressionString && logicJump . valueB && field . fieldValue ) {
var parse _tree = jsep ( logicJump . expressionString ) ;
var left , right ;
if ( parse _tree . left . name === 'field' ) {
left = field . fieldValue ;
right = logicJump . valueB ;
} else {
left = logicJump . valueB ;
right = field . fieldValue ;
2017-09-30 00:33:55 +00:00
}
2017-10-19 00:37:27 +00:00
if ( field . fieldType === 'number' || field . fieldType === 'scale' || field . fieldType === 'rating' ) {
switch ( parse _tree . operator ) {
case '==' :
return ( parseInt ( left ) === parseInt ( right ) ) ;
case '!==' :
return ( parseInt ( left ) !== parseInt ( right ) ) ;
case '>' :
return ( parseInt ( left ) > parseInt ( right ) ) ;
case '>=' :
return ( parseInt ( left ) > parseInt ( right ) ) ;
case '<' :
return ( parseInt ( left ) < parseInt ( right ) ) ;
case '<=' :
return ( parseInt ( left ) <= parseInt ( right ) ) ;
default :
return false ;
}
} else {
switch ( parse _tree . operator ) {
case '==' :
return ( left === right ) ;
case '!==' :
return ( left !== right ) ;
case 'contains' :
return ( left . indexOf ( right ) > - 1 ) ;
case '!contains' :
/* jshint -W018 */
return ! ( left . indexOf ( right ) > - 1 ) ;
case 'begins' :
return left . startsWith ( right ) ;
case '!begins' :
return ! left . startsWith ( right ) ;
case 'ends' :
return left . endsWith ( right ) ;
case '!ends' :
return left . endsWith ( right ) ;
default :
return false ;
}
2017-09-30 00:33:55 +00:00
}
}
}
} ;
2016-06-08 23:12:48 +00:00
var getActiveField = function ( ) {
if ( $scope . selected === null ) {
console . error ( 'current active field is null' ) ;
throw new Error ( 'current active field is null' ) ;
}
2016-05-20 20:35:50 +00:00
2017-10-07 08:34:01 +00:00
if ( $scope . selected . _id === FORM _ACTION _ID ) {
2016-06-08 23:12:48 +00:00
return $scope . myform . form _fields . length - 1 ;
}
2017-09-30 00:33:55 +00:00
return $scope . selected . index ;
2017-10-07 08:34:01 +00:00
} ;
2017-09-30 00:33:55 +00:00
2017-10-07 08:34:01 +00:00
$scope . isActiveField = function ( field ) {
if ( $scope . selected . _id === field . _id ) {
return true
}
return false ;
2016-06-08 23:12:48 +00:00
} ;
2016-06-07 21:30:15 +00:00
2016-06-08 23:12:48 +00:00
$scope . setActiveField = $rootScope . setActiveField = function ( field _id , field _index , animateScroll ) {
2017-10-07 08:34:01 +00:00
if ( $scope . selected === null || ( ! field _id && field _index === null ) ) {
return ;
}
if ( ! field _id ) {
field _id = $scope . myform . visible _form _fields [ field _index ] . _id ;
} else if ( field _index === null ) {
field _index = $scope . myform . visible _form _fields . length
2016-06-07 21:30:15 +00:00
2017-10-07 08:34:01 +00:00
for ( var i = 0 ; i < $scope . myform . visible _form _fields . length ; i ++ ) {
2017-09-30 00:33:55 +00:00
var currField = $scope . myform . visible _form _fields [ i ] ;
2017-10-07 08:34:01 +00:00
if ( currField [ '_id' ] == field _id ) {
field _index = i ;
2017-09-30 00:33:55 +00:00
break ;
}
}
}
2016-06-07 21:30:15 +00:00
2017-10-07 08:34:01 +00:00
if ( $scope . selected . _id === field _id ) {
return ;
}
$scope . selected . _id = field _id ;
$scope . selected . index = field _index ;
2016-06-08 23:12:48 +00:00
var nb _valid = $filter ( 'formValidity' ) ( $scope . myform ) ;
$scope . translateAdvancementData = {
done : nb _valid ,
total : form _fields _count ,
answers _not _completed : form _fields _count - nb _valid
2016-06-07 21:30:15 +00:00
} ;
2016-06-08 23:12:48 +00:00
if ( animateScroll ) {
2017-10-07 08:34:01 +00:00
NOSCROLL = true ;
2016-06-08 23:12:48 +00:00
setTimeout ( function ( ) {
$document . scrollToElement ( angular . element ( '.activeField' ) , - 10 , 200 ) . then ( function ( ) {
2017-10-07 08:34:01 +00:00
NOSCROLL = false ;
2016-06-08 23:12:48 +00:00
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 ( ) ;
}
} ) ;
} ) ;
} ) ;
2017-10-07 08:34:01 +00:00
}
2016-06-08 23:12:48 +00:00
} ;
2016-06-07 21:30:15 +00:00
2017-10-07 08:34:01 +00:00
$scope . $watch ( 'selected.index' , function ( oldValue , newValue ) {
if ( oldValue !== newValue && newValue < $scope . myform . form _fields . length ) {
//Only send analytics data if form has not been submitted
if ( ! $scope . myform . submitted ) {
console . log ( 'SendVisitorData.send()' ) ;
SendVisitorData . send ( $scope . myform , newValue , TimeCounter . getTimeElapsed ( ) ) ;
}
}
} ) ;
//Fire event when window is scrolled
$window . onscroll = function ( ) {
if ( ! NOSCROLL ) {
var scrollTop = $ ( window ) . scrollTop ( ) ;
var elemBox = document . getElementsByClassName ( 'activeField' ) [ 0 ] . getBoundingClientRect ( ) ;
var fieldTop = elemBox . top ;
var fieldBottom = elemBox . bottom ;
var field _id , field _index ;
var elemHeight = $ ( '.activeField' ) . height ( ) ;
var submitSectionHeight = $ ( '.form-actions' ) . height ( ) ;
var maxScrollTop = $ ( document ) . height ( ) - $ ( window ) . height ( ) ;
var fieldWrapperHeight = $ ( 'form_fields' ) . height ( ) ;
var selector = 'form > .field-directive:nth-of-type(' + String ( $scope . myform . visible _form _fields . length - 1 ) + ')'
var fieldDirectiveHeight = $ ( selector ) . height ( )
var scrollPosition = maxScrollTop - submitSectionHeight - fieldDirectiveHeight * 1.2 ;
var fractionToJump = 0.9 ;
//Focus on field above submit form button
if ( $scope . selected . index === $scope . myform . visible _form _fields . length ) {
if ( scrollTop < scrollPosition ) {
field _index = $scope . selected . index - 1 ;
$scope . setActiveField ( null , field _index , false ) ;
}
}
//Focus on submit form button
else if ( $scope . selected . index === $scope . myform . visible _form _fields . length - 1 && scrollTop > scrollPosition ) {
field _index = $scope . selected . index + 1 ;
$scope . setActiveField ( FORM _ACTION _ID , field _index , false ) ;
}
//If we scrolled bellow the current field, move to next field
else if ( fieldBottom < elemHeight * fractionToJump && $scope . selected . index < $scope . myform . visible _form _fields . length - 1 ) {
field _index = $scope . selected . index + 1 ;
$scope . setActiveField ( null , field _index , false ) ;
}
//If we scrolled above the current field, move to prev field
else if ( $scope . selected . index !== 0 && fieldTop > elemHeight * fractionToJump ) {
field _index = $scope . selected . index - 1 ;
$scope . setActiveField ( null , field _index , false ) ;
}
}
$scope . $apply ( ) ;
} ;
2017-09-30 00:33:55 +00:00
2017-10-07 08:34:01 +00:00
$rootScope . nextField = $scope . nextField = function ( ) {
2017-09-30 00:33:55 +00:00
if ( $scope . selected && $scope . selected . index > - 1 ) {
2017-10-07 08:34:01 +00:00
if ( $scope . selected . _id !== FORM _ACTION _ID ) {
var currField = $scope . myform . visible _form _fields [ $scope . selected . index ] ;
//Jump to logicJump's destination if it is true
if ( currField . logicJump && currField . logicJump . jumpTo && evaluateLogicJump ( currField ) ) {
$scope . setActiveField ( currField . logicJump . jumpTo , null , true ) ;
} else if ( $scope . selected . index < $scope . myform . visible _form _fields . length - 1 ) {
$scope . setActiveField ( null , $scope . selected . index + 1 , true ) ;
} else {
$scope . setActiveField ( FORM _ACTION _ID , null , true ) ;
2017-09-30 00:33:55 +00:00
}
2017-10-07 08:34:01 +00:00
} else {
//If we are at the submit actions page, go to the first field
$rootScope . setActiveField ( null , 0 , true ) ;
2017-09-30 00:33:55 +00:00
}
2017-10-07 08:34:01 +00:00
} else {
//If selected is not defined go to the first field
$rootScope . setActiveField ( null , 0 , true ) ;
2016-06-08 23:12:48 +00:00
}
2017-10-07 08:34:01 +00:00
2016-06-08 23:12:48 +00:00
} ;
2016-06-07 21:30:15 +00:00
2016-06-08 23:12:48 +00:00
$rootScope . prevField = $scope . prevField = function ( ) {
2017-10-07 08:34:01 +00:00
console . log ( 'prevField' ) ;
console . log ( $scope . selected ) ;
var selected _index = $scope . selected . index - 1 ;
2016-06-08 23:12:48 +00:00
if ( $scope . selected . index > 0 ) {
2017-10-07 08:34:01 +00:00
$scope . setActiveField ( null , selected _index , true ) ;
2016-06-08 23:12:48 +00:00
}
} ;
2016-06-07 21:30:15 +00:00
2017-10-07 08:34:01 +00:00
$rootScope . goToInvalid = $scope . goToInvalid = function ( ) {
var field _id = $ ( '.row.field-directive .ng-invalid.focusOn, .row.field-directive .ng-untouched.focusOn:not(.ng-valid)' ) . first ( ) . parents ( '.row.field-directive' ) . first ( ) . attr ( 'data-id' ) ;
$scope . setActiveField ( field _id , null , true ) ;
} ;
2016-06-08 23:12:48 +00:00
/ *
* * 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 ;
}
} ;
2016-06-07 21:30:15 +00:00
2017-09-30 00:33:55 +00:00
var getDeviceData = function ( ) {
var md = new MobileDetect ( window . navigator . userAgent ) ;
var deviceType = 'other' ;
if ( md . tablet ( ) ) {
deviceType = 'tablet' ;
} else if ( md . mobile ( ) ) {
deviceType = 'mobile' ;
} else if ( ! md . is ( 'bot' ) ) {
deviceType = 'desktop' ;
}
return {
type : deviceType ,
name : window . navigator . platform
} ;
} ;
var getIpAndGeo = function ( ) {
//Get Ip Address and GeoLocation Data
$ . ajaxSetup ( { 'async' : false } ) ;
var geoData = $ . getJSON ( 'https://freegeoip.net/json/' ) . responseJSON ;
$ . ajaxSetup ( { 'async' : true } ) ;
if ( ! geoData || ! geoData . ip ) {
geoData = {
ip : 'Adblocker'
} ;
}
return {
ipAddr : geoData . ip ,
geoLocation : {
City : geoData . city ,
Country : geoData . country _name
}
} ;
} ;
$rootScope . submitForm = $scope . submitForm = function ( ) {
2017-10-07 08:34:01 +00:00
if ( $scope . forms . myForm . $invalid ) {
$scope . goToInvalid ( ) ;
return ;
}
2016-06-07 21:30:15 +00:00
2016-06-08 23:12:48 +00:00
var _timeElapsed = TimeCounter . stopClock ( ) ;
$scope . loading = true ;
2016-06-07 21:30:15 +00:00
2016-06-08 23:12:48 +00:00
var form = _ . cloneDeep ( $scope . myform ) ;
2016-06-07 21:30:15 +00:00
2017-09-30 00:33:55 +00:00
var deviceData = getDeviceData ( ) ;
form . device = deviceData ;
2016-06-07 21:30:15 +00:00
2017-09-30 00:33:55 +00:00
var geoData = getIpAndGeo ( ) ;
form . ipAddr = geoData . ipAddr ;
form . geoLocation = geoData . geoLocation ;
form . timeElapsed = _timeElapsed ;
2016-06-08 23:12:48 +00:00
form . percentageComplete = $filter ( 'formValidity' ) ( $scope . myform ) / $scope . myform . visible _form _fields . length * 100 ;
2017-10-05 08:19:13 +00:00
delete form . endPage
delete form . isLive
delete form . provider
delete form . startPage
2016-06-08 23:12:48 +00:00
delete form . visible _form _fields ;
2017-10-05 01:42:55 +00:00
delete form . analytics ;
delete form . design ;
delete form . submissions ;
2017-10-05 08:19:13 +00:00
delete form . submitted ;
2016-06-08 23:12:48 +00:00
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 ;
}
2017-10-05 08:19:13 +00:00
//Get rid of unnessecary attributes for each form field
delete form . form _fields [ i ] . submissionId ;
delete form . form _fields [ i ] . disabled ;
delete form . form _fields [ i ] . ratingOptions ;
delete form . form _fields [ i ] . fieldOptions ;
delete form . form _fields [ i ] . logicJump ;
delete form . form _fields [ i ] . description ;
delete form . form _fields [ i ] . validFieldTypes ;
delete form . form _fields [ i ] . fieldType ;
2016-06-08 23:12:48 +00:00
}
2016-06-07 21:30:15 +00:00
2016-06-08 23:12:48 +00:00
setTimeout ( function ( ) {
$scope . submitPromise = $http . post ( '/forms/' + $scope . myform . _id , form )
2017-09-30 00:33:55 +00:00
. success ( function ( data , status ) {
2016-06-08 23:12:48 +00:00
$scope . myform . submitted = true ;
$scope . loading = false ;
2017-10-05 01:42:55 +00:00
SendVisitorData . send ( form , getActiveField ( ) , _timeElapsed ) ;
2016-06-08 23:12:48 +00:00
} )
. error ( function ( error ) {
$scope . loading = false ;
console . error ( error ) ;
$scope . error = error . message ;
} ) ;
} , 500 ) ;
} ;
2016-06-07 21:30:15 +00:00
2016-06-08 23:12:48 +00:00
//Reload our form
$scope . reloadForm ( ) ;
} ]
} ;
}
] ) ;
2016-06-07 21:30:15 +00:00
2016-06-08 23:12:48 +00:00
'use strict' ;
2016-06-07 21:30:15 +00:00
2016-06-08 23:12:48 +00:00
//Forms service used for communicating with the forms REST endpoints
2017-09-30 00:33:55 +00:00
angular . module ( 'view-form' ) . service ( 'CurrentForm' ,
2016-06-08 23:12:48 +00:00
function ( ) {
//Private variables
var _form = { } ;
2016-06-07 21:30:15 +00:00
2016-06-08 23:12:48 +00:00
//Public Methods
this . getForm = function ( ) {
return _form ;
} ;
this . setForm = function ( form ) {
_form = form ;
} ;
}
) ;
2017-09-30 00:33:55 +00:00
2016-06-08 23:12:48 +00:00
'use strict' ;
2016-06-07 21:30:15 +00:00
2016-06-08 23:12:48 +00:00
//Forms service used for communicating with the forms REST endpoints
2017-09-30 00:33:55 +00:00
angular . module ( 'view-form' ) . factory ( 'Forms' , [ '$resource' , 'VIEW_FORM_URL' ,
function ( $resource , VIEW _FORM _URL ) {
return $resource ( VIEW _FORM _URL , {
2016-06-08 23:12:48 +00:00
formId : '@_id'
} , {
'get' : {
method : 'GET' ,
transformResponse : function ( data , header ) {
var form = angular . fromJson ( data ) ;
2016-06-07 21:30:15 +00:00
2016-06-08 23:12:48 +00:00
form . visible _form _fields = _ . filter ( form . form _fields , function ( field ) {
return ( field . deletePreserved === false ) ;
} ) ;
return form ;
}
} ,
'update' : {
method : 'PUT'
} ,
'save' : {
method : 'POST'
}
2016-06-07 21:30:15 +00:00
} ) ;
2016-06-08 23:12:48 +00:00
}
] ) ;
2016-06-07 21:30:15 +00:00
2017-03-28 00:08:45 +00:00
( function ( ) {
'use strict' ;
2017-09-30 00:33:55 +00:00
// Create the Socket.io wrapper service
2017-03-28 00:08:45 +00:00
function Socket ( $timeout , $window ) {
2017-09-30 00:33:55 +00:00
2017-10-02 10:18:47 +00:00
var service = {
socket : null
} ;
2017-09-30 00:33:55 +00:00
2017-10-02 10:18:47 +00:00
// Connect to TellForm Socket.io server
function connect ( ) {
var url = '' ;
if ( $window . socketUrl && $window . socketPort ) {
url = window . location . protocol + '//' + $window . socketUrl + ':' + $window . socketPort ;
} else if ( $window . socketUrl ) {
url = window . location . protocol + '//' + $window . socketUrl ;
} else if ( $window . socketPort ) {
url = window . location . protocol + '//' + window . location . hostname + ':' + $window . socketPort ;
} else {
url = window . location . protocol + '//' + window . location . hostname ;
}
2017-03-28 00:08:45 +00:00
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 ) ;
}
}
2017-09-30 00:33:55 +00:00
2017-10-02 10:18:47 +00:00
connect ( ) ;
2017-07-20 23:09:21 +00:00
service = {
connect : connect ,
emit : emit ,
on : on ,
removeListener : removeListener ,
socket : null
} ;
return service ;
2017-03-28 00:08:45 +00:00
}
2017-09-30 00:33:55 +00:00
angular
. module ( 'view-form' )
2017-07-20 23:09:21 +00:00
. factory ( 'Socket' , Socket ) ;
Socket . $inject = [ '$timeout' , '$window' ] ;
2017-03-28 00:08:45 +00:00
} ( ) ) ;
2016-06-08 23:12:48 +00:00
'use strict' ;
2016-06-07 21:30:15 +00:00
2017-09-30 00:33:55 +00:00
angular . module ( 'view-form' ) . service ( 'TimeCounter' , [
2016-06-08 23:12:48 +00:00
function ( ) {
2017-09-30 00:33:55 +00:00
var _startTime , _endTime = null ;
2016-06-07 21:30:15 +00:00
2016-06-08 23:12:48 +00:00
this . timeSpent = 0 ;
2016-06-07 21:30:15 +00:00
2016-06-08 23:12:48 +00:00
this . restartClock = function ( ) {
_startTime = Date . now ( ) ;
_endTime = null ;
} ;
2016-06-07 21:30:15 +00:00
2016-06-08 23:12:48 +00:00
this . getTimeElapsed = function ( ) {
if ( _startTime ) {
return Math . abs ( Date . now ( ) . valueOf ( ) - _startTime . valueOf ( ) ) / 1000 ;
}
} ;
2016-06-07 21:30:15 +00:00
2016-06-08 23:12:48 +00:00
this . stopClock = function ( ) {
if ( _startTime && _endTime === null ) {
_endTime = Date . now ( ) ;
this . timeSpent = Math . abs ( _endTime . valueOf ( ) - _startTime . valueOf ( ) ) / 1000 ;
this . _startTime = this . _endTime = null ;
2016-06-07 21:30:15 +00:00
2016-06-08 23:12:48 +00:00
return this . timeSpent ;
}
2017-09-30 00:33:55 +00:00
return new Error ( 'Clock has not been started' ) ;
2016-06-08 23:12:48 +00:00
} ;
2016-06-07 21:30:15 +00:00
2016-06-08 23:12:48 +00:00
this . clockStarted = function ( ) {
return ! ! this . _startTime ;
} ;
2016-06-07 21:30:15 +00:00
2016-06-08 23:12:48 +00:00
}
] ) ;