PATH:
home
/
letacommog
/
letaweb
/
scripts
/
editor
/
modules
define(['module/base'],function(base) { return createModuleDefinition([base], function($file_manager,$dialog) { this.initializeData = { forms: [ {name:'Name', type:'name', required:true}, {name:'Email', type:'email', required:true}, {name:'Message', type:'textarea', required:true} ], mailto:'abc@example.com', success:'Enter form success message here', require:'Enter form require message here', error:'Enter form error message here', submit:'Submit', reset:'Reset', }; this.subModules = [{type:'button',uniqueName:'submit',selector:'.submit_button'},{type:'button',uniqueName:'reset',selector:'.reset_button'}]; this.getFormFieldElement = function(index) { var form = jQuery('form', this.getElement()); return jQuery('.form_field:nth-child(' + (index + 1) + ')', this.getElement()); }; this.controller = function($scope, $moduleInstance) { $scope.fields = { text:'text', name:'text', email:'text', textarea:'textarea', file:'file', checkbox:'radio', radio:'radio', address:'text', phone:'text', password:'password', address:'text' }; $scope.default_fields = { name:{name:'New Field'}, text:{name:'New Field'}, email:{name:'New Field'}, textarea:{name:'New Field'}, file:{name:'New File'}, checkbox:{name:'New Field', options:'Options 1\t\nOptions 2'}, radio:{name:'New Field', options:'Options 1\t\nOptions 2'}, password:{name:'New Field'}, phone:{name:'New Field'}, address:{name:'New Field'}, line:{name:'New Line'}, spacer:{name:'New Line'} }; $scope.add_mode = false; for(var i = 0;i < $scope.data.forms.length;i++) { $scope.data.forms[i].edit_type = $scope.fields[$scope.data.forms[i].type]; $scope.data.forms[i].edit_mode = false; } $scope.deleteField = function(index) { $moduleInstance.getFormFieldElement(index).remove(); $scope.data.forms.splice(index,1); } $scope.editField = function(index) { $scope.data.forms[index].edit_mode = !$scope.data.forms[index].edit_mode; } $scope.insertField = function(type) { $scope.add_mode = false; var n = angular.copy($scope.default_fields[type]); n.type = type; n.required = false n.edit_mode = true; n.edit_type = $scope.fields[type]; $scope.data.forms.push(n); $moduleInstance.loadHtml(); } $scope.addField = function() { $scope.add_mode =true; } $scope.changeName = function(index) { var name = $scope.data.forms[index].name; var required = $scope.data.forms[index].required; var fieldElement = $moduleInstance.getFormFieldElement(index); var label = jQuery('label:first', fieldElement); label.html(name); if(required) label.append('*'); } $scope.changeRequired = function(index) { var name = $scope.data.forms[index].name; var required = $scope.data.forms[index].required; var fieldElement = $moduleInstance.getFormFieldElement(index); var label = jQuery('label:first', fieldElement); label.html(name); if(required) label.append('*'); } $scope.changeRequired = function(index) { var name = $scope.data.forms[index].name; var required = $scope.data.forms[index].required; var fieldElement = $moduleInstance.getFormFieldElement(index); var label = jQuery('label:first', fieldElement); label.html(name); if(required) label.append('*'); } $scope.changePlaceholder = function(index) { var placeholder = $scope.data.forms[index].placeholder; var type = $scope.data.forms[index].type; var selector = type == 'textarea' ? 'textarea' : ((type == 'email' || type== 'text') ? 'input[type="text"]': 'input'); var required = $scope.data.forms[index].required; var fieldElement = $moduleInstance.getFormFieldElement(index); var input = jQuery(selector,fieldElement); input.attr('placeholder',placeholder); } $scope.changeDescription = function(index) { var instruction = $scope.data.forms[index].instruction; var fieldElement = $moduleInstance.getFormFieldElement(index); var label = jQuery('label', fieldElement); var descriptionElement; if(label.next('p.description').length > 0) descriptionElement = label.next('p.description'); else { descriptionElement = jQuery('<p class="description"></p>') label.after(descriptionElement); } descriptionElement.html(instruction); } }; }); });
[+]
..
[-] productlist.js
[edit]
[-] facebookvideo.js
[edit]
[-] newslist.js
[edit]
[-] image.js
[edit]
[-] video.js
[edit]
[-] button.js
[edit]
[-] zone.js
[edit]
[-] text.js
[edit]
[-] newscategory.js
[edit]
[-] googlemap.js
[edit]
[-] base_structure.js
[edit]
[-] contactform.js
[edit]
[-] spacer.js
[edit]
[-] infobox.js
[edit]
[-] html.js
[edit]
[-] testmodule.js
[edit]
[-] facebookcomment.js
[edit]
[-] iframe.js
[edit]
[-] twitterfeed.js
[edit]
[-] recentnews.js
[edit]
[-] audio_player.js
[edit]
[-] slick.js
[edit]
[-] newsdetail.js
[edit]
[-] facebookpost.js
[edit]
[-] pagezone.js
[edit]
[-] panigation.js
[edit]
[-] row.js
[edit]
[-] __custom_module_template.js
[edit]
[-] carousel.js
[edit]
[-] icon.js
[edit]
[-] typedtext.js
[edit]
[-] newscomment.js
[edit]
[-] box.js
[edit]
[-] base_custom.js
[edit]
[-] wordpress.js
[edit]
[-] base.js
[edit]
[-] column.js
[edit]
[-] fancytext.js
[edit]
[-] recentproduct.js
[edit]
[-] statcounter.js
[edit]
[-] tab.js
[edit]
[-] bootstrap_slider.js
[edit]
[-] ihover.js
[edit]
[-] line.js
[edit]
[-] blogger.js
[edit]
[-] slideshow.js
[edit]
[-] title.js
[edit]
[-] facebookpage.js
[edit]
[-] share_buttons.js
[edit]
[-] facebooklike.js
[edit]
[-] infobanner.js
[edit]
[-] rssfeed.js
[edit]
[-] flash.js
[edit]
[-] countdown.js
[edit]
[-] facebooksend.js
[edit]
[-] mailchimp.js
[edit]
[-] infotable.js
[edit]
[-] navbar.js
[edit]
[-] cycleslider.js
[edit]
[-] modal.js
[edit]
[-] embed.js
[edit]
[-] alert.js
[edit]
[-] progress_bar.js
[edit]
[-] accordion.js
[edit]
[-] youtube.js
[edit]
[-] social_buttons.js
[edit]
[-] productcategory.js
[edit]
[-] menu.js
[edit]
[-] pricetable.js
[edit]
[-] productdetail.js
[edit]
[-] gallery.js
[edit]