PATH:
home
/
letacommog
/
letaweb
/
scripts
/
editor
/
popup
angular.module('ui.popup') .service('popup_news', ['$file_manager','communication','popup_form','$templateCache','$filter',function($file_manager,communication,popup_form,$templateCache,$filter) { this.open = function(opt) { opt = opt || {}; return popup_form.open( { name:'news', controller: function($scope) { communication.getList('news_categories', {},'blog.post.category').then(function(json) { $scope.news_categories_list = angular.copy(json); mergeCategories(); }); $scope.selectedSongs = function () { $scope.data.category = $filter('filter')($scope.news_categories_list, {checked: true}); } $scope.openCategoryItem = function(item) { if(!item.opened) item.opened = true; else delete item.opened; } $scope.data.allow_comment = $scope.data.allow_comment || 1; if($scope.data != undefined && $scope.data.main_category != undefined && $scope.data.main_category.id != undefined) { $scope.data.main_category_id = $scope.data.main_category.id } $scope.data.status = $scope.data.status || 1; $scope.selectImage = function() { $file_manager.open().result.then(function(images) { if(images.length == 0) return; var image = images[0]; $scope.data.image = (image.full_url); }); } $scope.selectedCategories=[]; var mergeCategories = function() { function checkCat(cat) { if($scope.data.categories != undefined) { for(var i = 0;i < $scope.data.categories.length;i++) { if($scope.data.categories[i].id == cat.id) cat.checked = true; } if(angular.isDefined(cat.items)) { for(var i = 0;i < cat.items.length;i++) { checkCat(cat.items[i]); } } } } for(var i = 0;i < $scope.news_categories_list.length;i++) { checkCat($scope.news_categories_list[i]); } } $scope.selectedCategories = angular.copy($scope.data.categories); $scope.selectedCategory = function() { $scope.selectedCategories=[]; function checkCat(cat) { if(cat.checked) $scope.selectedCategories.push(cat); if(angular.isDefined(cat.items)) { for(var i = 0;i < cat.items.length;i++) { checkCat(cat.items[i]); } } } for(var i = 0;i < $scope.news_categories_list.length;i++) { checkCat($scope.news_categories_list[i]); } $scope.data.categories = $scope.selectedCategories; } var popupNewsCategoryTree_recursiveTpl = '<i class="jstree-icon" ng-click="openCategoryItem(item)"></i>'+ '<i class="jstree-cat-icon"></i>'+ '<input type="checkbox" value="{{item.value}}" ng-model="item.checked" ng-change="selectedCategory()" />'+ '<label>{{item.name}}</label>'+ '<ul class="jstree">' + '<li ng-class="{\'jstree-close\': angular.isDefined(item.items) && item.opened,\'jstree-leaf\':!angular.isDefined(item.items) }" ng-repeat="item in item.items" ng-include="\'popupNewsCategoryTree_recursiveTpl.html\'" ng-model="item">' + '</li>'+ '</ul>'; $templateCache.put('popupNewsCategoryTree_recursiveTpl.html', popupNewsCategoryTree_recursiveTpl); }, data:opt.data, size:'lg', execute_path:'blog.post', form_name:'NewsForm' }); } }]) .directive('popupNewsCategoryTree',[ function() { return { link: function(scope) { } } }]);
[+]
..
[-] profile.js
[edit]
[-] pagelist.js
[edit]
[-] order.js
[edit]
[-] customer_group.js
[edit]
[-] module_list.js
[edit]
[-] backgroundeditor.js
[edit]
[-] product.js
[edit]
[-] visualcsseditor.js
[edit]
[-] shipping_rule.js
[edit]
[-] profile_change_password.js
[edit]
[-] review.js
[edit]
[-] contributor_invite.js
[edit]
[-] dbfilter.js
[edit]
[-] tax_class.js
[edit]
[-] special_module_style_editor.js
[edit]
[-] idletimeout.js
[edit]
[-] address.js
[edit]
[-] contributor.js
[edit]
[-] login.js
[edit]
[-] skin.js
[edit]
[-] mail.js
[edit]
[-] discount.js
[edit]
[-] customer.js
[edit]
[-] productgrid.js
[edit]
[-] socialsharebuttonconfig.js
[edit]
[-] news.js
[edit]
[-] color.js
[edit]
[-] palette.js
[edit]
[-] newsgrid.js
[edit]
[-] product_option_combination_grid.js
[edit]
[-] page.js
[edit]
[-] product_option.js
[edit]
[-] tax_rate.js
[edit]
[-] coupons.js
[edit]
[-] zone.js
[edit]
[-] product_bulk_price.js
[edit]
[-] option_set.js
[edit]
[-] product_option_combination.js
[edit]