PATH:
home
/
letacommog
/
letaweb
/
admin
/
modules
/
gallery
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(); } }; }) });
[+]
..
[-] frontend_script.php
[edit]
[-] backend.php
[edit]
[-] frontend_view.php
[edit]
[-] backend.js
[edit]
[-] frontend_class.php
[edit]