PATH:
home
/
letacommog
/
letaweb
/
scripts
/
editor
/
modules
define(['module/base','module/base_structure'],function(base,base_structure) { return createModuleDefinition([base,base_structure], function($window, pageEdit,pageEdit_layout,$q) { this.initializeData = {accordions:['Accordion 1', 'Accordion 2', 'Accordion 3']}; this.loadElement = function(element) { this._loadElement(element); var accordions = []; jQuery(element).children('.accordions').children('.accordion-header').each(function(i) { accordions[i] = {}; accordions[i].value = i; accordions[i].label = jQuery.trim(jQuery(this).html()); }); this.module_data = this.module_data || {}; this.module_data.accordions = accordions; this.checkEmptyAccordion(); }; this.checkEmptyAccordion = function() { var element = this.getElement(); element.children('.accordions').children('.accordion-content').each(function(i) { pageEdit_layout.scanEmptyRow(this); if(jQuery(this).children().length == 0) { var dumprow = pageEdit_layout.create_row_helper(); jQuery(this).append(dumprow); } }); element.children('.accordions').children('.accordion-content').children('.'+pageEdit_layout.row_class).each(function(i) { pageEdit_layout.createRow(this); }); }; this.insert = function(dropInfo) { var insert_point = dropInfo.node; var pos = dropInfo.direction; var insertPlacement = this.createInsertPlacement(insert_point, pos, dropInfo); this.element = insertPlacement; var defered = $q.defer(); var e = this.insertTab(); this.loadElement(insertPlacement); defered.resolve(e); return defered.promise; }; this.insertTab = function() { var element = this.getElement(); element = $(element); var data = this.initializeData; var accordions = jQuery('<div class="accordions"/>'); element.append(accordions); for(var i = 0;i < data.accordions.length;i++) { var header = jQuery('<div class="accordion-header"/>'); header.html(data.accordions[i]); accordions.append(header); var content = jQuery('<div class="accordion-content"/>'); accordions.append(content); content.hide(); var row = pageEdit_layout.create_row_helper(); content.append(row); } accordions.accordions(); return element; }; this.controller = function($scope, $moduleInstance) { $scope.deleteTab = function(index) { if($scope.data.accordions.length == 1) return; $scope.data.accordions.splice(index, 1); var t = $moduleInstance.getElement(); t.children('.accordions').children('.accordion-header:eq(' + index + ')').remove(); t.children('.accordions').children('.accordion-content:eq(' + index + ')').remove(); } $scope.changeTabHeader = function(index) { if($scope.data.accordions.length == 1) return; if($scope.data.accordions[index] == undefined) return; var t = $moduleInstance.getElement(); t.children('.accordions').children('.accordion-header:eq(' + index + ')').html($scope.data.accordions[index].label); } $scope.addTab = function() { var tabname = 'New Accordion'; $scope.data.accordions.push({label:tabname}); var t = $moduleInstance.getElement(); var accordions = t.children('.accordions'); var header = jQuery('<div class="accordion-header"/>'); header.html(tabname); accordions.append(header); var content = jQuery('<div class="accordion-content"/>'); accordions.append(content); content.hide(); var row = pageEdit_layout.create_row_helper(); content.append(row); accordions.accordions(); } }; this.copyDataTo = function(new_element) { new_element = jQuery(new_element); jQuery('.ww_module_info',new_element).remove(); var id = pageEdit.generateModuleId(); new_element.attr('id',id); this._copyDataTo(new_element); var that = this; new_element.children('.accordions').accordions(); new_element.children('.accordions').children('.accordion-content').children('.'+pageEdit_layout.row_class).each(function() { var moduleObj = pageEdit.getModule(this); if(!moduleObj) return; moduleObj.copyDataTo(this); }); } this.getStructure= function() { var s = this._getStructure(); var element = this.getElement(); element = jQuery(element); s.accordions = {}; element.children('.accordions').children('.accordion-header').each(function(i) { s.accordions[i] = {}; s.accordions[i].name = jQuery.trim( jQuery(this).html() ); var content = jQuery(this).next(); var zones_structure = pageEdit.getInnerZoneStructure(content); s.accordions[i].rows = zones_structure.rows; }); return s; }; }) });
[+]
..
[-] 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]