PATH:
home
/
letacommog
/
letaweb
/
scripts
/
editor
/
modules
define(['module/base'],function(base) { return createModuleDefinition([base], function($window,$rootScope,pageEdit_iframe) { this.initializeData = { images: [ {src:'/assets/samples/image.png',caption:'Enter caption here',description:'Enter description here',link:''}, {src:'/assets/samples/image.png',caption:'Enter caption here',description:'Enter description here',link:''}, {src:'/assets/samples/image.png',caption:'Enter caption here',description:'Enter description here',link:''}, ], settings: { column:4, margin:20, } }; this.controller = function($scope, $moduleInstance,$file_manager) { $scope.data.settings = $scope.data.settings || {}; $scope.data.settings.margin = parseInt($scope.data.settings.margin || 20); $scope.data.settings.column = $scope.data.settings.column || 1; $scope.deleteImageItem = function($index) { var r = confirm("Delete slide!"); if (!r) { return; } var portfolioList = $moduleInstance.getElement().children('.portfolio-container').children('.portfolio-list'); var gallery_item = jQuery('.portfolio-item', portfolioList).eq($index); gallery_item.remove(); $scope.data.images.splice($index ,1); relayout(); }; function relayout() { var portfolioList = $moduleInstance.getElement().children('.portfolio-container').children('.portfolio-list'); var isotopeInstance = portfolioList.data('isotope' ); if ( isotopeInstance ) isotopeInstance.destroy(); $moduleInstance.getElement().cherryPortfolioLayoutPlugin(); } $scope.onItemAdded = function() { var new_item = $scope.data.images[$scope.data.images.length - 1]; var portfolioList = $moduleInstance.getElement().children('.portfolio-container').children('.portfolio-list'); id = $moduleInstance.getPage_id(); var portfolioItem = jQuery('<div class="portfolio-item"><div class="inner-wrap"><div class="image_content"></div><div class="item_content"></div></div></div>'); jQuery('.image_content',portfolioItem).html('<a title="" href="#"><img alt="" src="'+new_item.src+'"></a>'); jQuery('.item_content',portfolioItem).html('<h3><a href="'+new_item.link+'">'+new_item.caption+'</a></h3><p>'+new_item.description+'</p>'); portfolioList.append(portfolioItem); relayout(); }; var ctrl = this; this._selectSlide = function(index) { if($scope.editing_item == index) return false; $scope.editing_item = $scope.data.images[index]; $scope.editing = true; $scope.editing_index = index; } ctrl._selectSlide(0); $scope.editImageItem = function(index) { ctrl._selectSlide(index); }; $scope.editSlideBG = function() { $file_manager.open().result.then(function(images) { if(images.length == 0) return; var image = images[0]; $scope.editing_item.src = image.full_url; var gallery_item = $moduleInstance.getElement().children('.portfolio-container').children('.portfolio-list').children('.portfolio-item:eq('+$scope.editing_index+')'); var image = jQuery('img',gallery_item); image.attr('src', $scope.editing_item.src); }); } $scope.changeSlideInfo = function() { var portfolioList = $moduleInstance.getElement().children('.portfolio-container').children('.portfolio-list'); var gallery_item = jQuery('.portfolio-item', portfolioList).eq($scope.editing_index); var item_content = jQuery('.item_content', gallery_item); jQuery('a', item_content).attr('href',$scope.editing_item.link); jQuery('a', item_content).html($scope.editing_item.caption); jQuery('p', item_content).html($scope.editing_item.description); } $scope.addImageItem = function() { $file_manager.open().result.then(function(images) { if(images.length == 0) return; var image = images[0]; var data = {src:image.full_url,caption:'Enter caption here',description:'Enter description here',link:'#' }; $scope.data.images.push(data); $scope.onItemAdded(); }); } $scope.changeColumn = function() { $moduleInstance.getElement().children('.portfolio-container').data('column',$scope.data.settings.column); relayout(); } $scope.changeMargin = function() { $moduleInstance.getElement().children('.portfolio-container').data('item-margin',$scope.data.settings.margin); relayout(); } }; }) });
[+]
..
[-] 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]