tellform/public/dist/application.min.js

2 lines
60 KiB
JavaScript
Raw Normal View History

"use strict";var ApplicationConfiguration=function(){var a="NodeForm",b=["duScroll","ui.select","ngSanitize","vButton","ngResource","TellForm.templates","ui.router","ui.bootstrap","ui.utils","pascalprecht.translate"],c=function(b,c){angular.module(b,c||[]),angular.module(a).requires.push(b)};return{applicationModuleName:a,applicationModuleVendorDependencies:b,registerModule:c}}();angular.module(ApplicationConfiguration.applicationModuleName,ApplicationConfiguration.applicationModuleVendorDependencies),angular.module(ApplicationConfiguration.applicationModuleName).config(["$locationProvider",function(a){a.hashPrefix("!")}]),angular.module(ApplicationConfiguration.applicationModuleName).constant("APP_PERMISSIONS",{viewAdminSettings:"viewAdminSettings",editAdminSettings:"editAdminSettings",editForm:"editForm",viewPrivateForm:"viewPrivateForm"}),angular.module(ApplicationConfiguration.applicationModuleName).constant("USER_ROLES",{admin:"admin",normal:"user",superuser:"superuser"}),angular.module(ApplicationConfiguration.applicationModuleName).constant("FORM_URL","/forms/:formId"),angular.element(document).ready(function(){"#_=_"===window.location.hash&&(window.location.hash="#!"),angular.bootstrap(document,[ApplicationConfiguration.applicationModuleName])}),ApplicationConfiguration.registerModule("core",["users"]),ApplicationConfiguration.registerModule("forms",["ngFileUpload","ui.router.tabs","ui.date","ui.sortable","angular-input-stars","users","ngclipboard"]),ApplicationConfiguration.registerModule("users"),angular.module("forms").config(["$translateProvider",function(a){a.translations("en",{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?",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:"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",ARE_YOU_SURE:"Are you ABSOLUTELY sure?",READ_WARNING:"Unexpected bad things will happen if you dont 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",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 conta
var m=c.refreshFrame=function(){document.getElementById("iframe")&&document.getElementById("iframe").contentWindow.location.reload()};c.tabData=[{heading:k("translate")("CONFIGURE_TAB"),templateName:"configure"},{heading:k("translate")("ANALYZE_TAB"),templateName:"analyze"}],c.setForm=function(a){c.myform=a},a.resetForm=function(){c.myform=f.get({formId:d.formId})},c.openDeleteModal=function(){c.deleteModal=i.open({animation:c.animationsEnabled,templateUrl:"formDeleteModal.html",controller:"AdminFormController",resolve:{myForm:function(){return c.myform}}}),c.deleteModal.result.then(function(a){c.selected=a},function(){console.log("Modal dismissed at: "+new Date)})},c.cancelDeleteModal=function(){c.deleteModal&&c.deleteModal.dismiss("cancel")},c.removeCurrentForm=function(){if(c.deleteModal&&c.deleteModal.opened){c.deleteModal.close();var a=c.myform._id;if(!a)throw new Error("Error - removeCurrentForm(): $scope.myform._id does not exist");h["delete"]("/forms/"+a).then(function(a){console.log("form deleted successfully"),e.go("listForms",{},{reload:!0})},function(a){console.log("ERROR: Form could not be deleted."),console.error(a)})}},c.update=a.update=function(b,d,e,f,g){m();var i=!0;if(b||(i=!a.saveInProgress),i){var j=null;if(b||(a.saveInProgress=!0),e)c.updatePromise=h.put("/forms/"+c.myform._id,{changes:d}).then(function(b){f&&(a.myform=c.myform=b.data)})["catch"](function(a){console.log("Error occured during form UPDATE.\n"),j=a.data})["finally"](function(){if(b||(a.saveInProgress=!1),"function"==typeof g)return g(j)});else{var k=d;k.analytics&&k.analytics.visitors&&delete k.analytics.visitors,k.submissions&&delete k.submissions,c.updatePromise=h.put("/forms/"+c.myform._id,{form:k}).then(function(b){f&&(a.myform=c.myform=b.data)})["catch"](function(a){console.log("Error occured during form UPDATE.\n"),j=a.data})["finally"](function(){if(b||(a.saveInProgress=!1),"function"==typeof g)return g(j)})}}}}]),angular.module("forms").controller("ListFormsController",["$rootScope","$scope","$stateParams","$state","Forms","CurrentForm","$http","$uibModal",function(a,b,c,d,e,f,g,h){b=a,b.forms={},b.showCreateModal=!1,a.languageRegExp={regExp:/[@!#$%^&*()\-+={}\[\]|\\/'";:`.,~№?<>]+/i,test:function(a){return!this.regExp.test(a)}},b.openDeleteModal=function(a){b.deleteModal=h.open({animation:b.animationsEnabled,templateUrl:"deleteModalListForms.html",controller:["$uibModalInstance","items","$scope",function(a,b,c){c.content=b,c.cancel=c.cancelDeleteModal,c.deleteForm=function(){c.$parent.removeForm(b.formIndex)}}],resolve:{items:function(){return{currFormTitle:b.myforms[a].title,formIndex:a}}}})},b.cancelDeleteModal=function(){b.deleteModal&&b.deleteModal.dismiss("cancel")},b.findAll=function(){e.query(function(a){b.myforms=a})},b.openCreateModal=function(){b.showCreateModal||(b.showCreateModal=!0)},b.closeCreateModal=function(){b.showCreateModal&&(b.showCreateModal=!1)},b.setForm=function(a){b.myform=a},b.goToWithId=function(a,b){d.go(a,{formId:b},{reload:!0})},b.duplicateForm=function(a){var c=_.cloneDeep(b.myforms[a]);delete c._id,g.post("/forms",{form:c}).success(function(c,d,e){b.myforms.splice(a+1,0,c)}).error(function(a){console.error(a),null===a&&(b.error=a.data.message)})},b.createNewForm=function(){var a={};a.title=b.forms.createForm.title.$modelValue,a.language=b.forms.createForm.language.$modelValue,b.forms.createForm.$valid&&b.forms.createForm.$dirty&&g.post("/forms",{form:a}).success(function(a,c,d){b.goToWithId("viewForm.create",a._id+"")}).error(function(a){console.error(a),b.error=a.data.message})},b.removeForm=function(a){if(a>=b.myforms.length||a<0)throw new Error("Error: form_index in removeForm() must be between 0 and "+b.myforms.length-1);g["delete"]("/forms/"+b.myforms[a]._id).success(function(c,d,e){b.myforms.splice(a,1),b.cancelDeleteModal()}).error(function(a){console.error(a)})}}]),angular.module("forms").directive("configureFormDirective",["$rootScope","$http","Upload","CurrentForm",function(a,b,c,d){return{templateUrl:"modules/forms/admin/views/directiveViews/form/configure-form.client.view.html",r