PATH:
home
/
letacommog
/
letaweb
/
scripts
/
editor
/
blog
/
post
define([], function() { return function($scope, communication) { $scope.news_categories_list = []; communication.getList('news_categories',{}, 'blog.post.category').then(function(json) { $scope.news_categories_list = json; }); $scope.relativeUrl = window.getRelativeUrl(); $scope.setClass = function() { return ''; } $scope.changeOrder = function(item,oldIndex,new_parent) { var items = new_parent.items; if(items == undefined) items = new_parent; var rs =[]; for(var i = 0;i < items.length;i++) { if(items[i].id != undefined) rs.push(items[i].id); } communication.api('changeOrder',{parent_id:new_parent.id || 0, orders:rs},'blog.post.category').then(function(data) { communication.removeList('news_categories'); }); } window.news_categoriesAddItemCtrl = function($scope,$modalInstance) { $scope.ok = function() { communication.api('saveCategory',{parent_id:$scope.parentData.id || 0 ,data:$scope.data},'blog.post.category').then(function(data) { communication.removeList('news_categories'); $modalInstance.close(data); }); } } window.deleteCategoryCtrl = function($scope,$modalInstance) { $scope.ok = function() { function getAllDeleted(item) { var rs = []; rs.push(item.id); var items = item.items; if(items != undefined) { for(var i in items) { if(!items.hasOwnProperty(i)) continue; var c = getAllDeleted(items[i]); for(var j = 0;j < c.length;j++) { rs.push(c[j]); } } } return rs; } var rs = getAllDeleted($scope.data); if(rs.length) communication.api('deleteCategories',{ids:rs},'blog.post.category').then(function(data) { communication.removeList('news_categories'); $modalInstance.close(data); }) else $modalInstance.close(1); } } } });
[+]
..
[-] category.js
[edit]
[-] post.js
[edit]