forked from Archives/Athou_commafeed
add categories
This commit is contained in:
@@ -88,6 +88,22 @@ module.directive('subscribe', function(SubscriptionService) {
|
||||
SubscriptionService.init();
|
||||
$scope.closeImport();
|
||||
};
|
||||
|
||||
$scope.cat = {};
|
||||
|
||||
$scope.openCategory= function(){
|
||||
$scope.isOpenCategory = true;
|
||||
$scope.cat = {};
|
||||
};
|
||||
|
||||
$scope.closeCategory= function(){
|
||||
$scope.isOpenCategory = false;
|
||||
};
|
||||
|
||||
$scope.saveCategory = function() {
|
||||
SubscriptionService.addCategory($scope.cat);
|
||||
$scope.closeCategory();
|
||||
};
|
||||
}
|
||||
};
|
||||
});
|
||||
@@ -147,7 +163,7 @@ module.directive('category', function($compile) {
|
||||
});
|
||||
|
||||
module.directive('toolbar', function($stateParams, $route, $location,
|
||||
SettingsService, EntryService, SubscriptionService) {
|
||||
SettingsService, EntryService, SubscriptionService, SessionService) {
|
||||
return {
|
||||
scope : {},
|
||||
restrict : 'E',
|
||||
@@ -158,6 +174,8 @@ module.directive('toolbar', function($stateParams, $route, $location,
|
||||
function totalActiveAjaxRequests() {
|
||||
return ($http.pendingRequests.length + $.active);
|
||||
}
|
||||
|
||||
$scope.session = SessionService.get();
|
||||
|
||||
$scope.loading = true;
|
||||
$scope.$watch(totalActiveAjaxRequests, function() {
|
||||
|
||||
@@ -1,9 +1,10 @@
|
||||
var module = angular.module('commafeed.services', [ 'ngResource' ]);
|
||||
|
||||
module.factory('SubscriptionService', [
|
||||
'$resource',
|
||||
'$http',
|
||||
function($resource, $http) {
|
||||
module.factory('SessionService', function($resource){
|
||||
return $resource('rest/session/get');
|
||||
});
|
||||
|
||||
module.factory('SubscriptionService', function($resource, $http) {
|
||||
|
||||
var flatten = function(category, parentName, array) {
|
||||
if (!array)
|
||||
@@ -50,6 +51,18 @@ module.factory('SubscriptionService', [
|
||||
params : {
|
||||
_method : 'collapse'
|
||||
}
|
||||
},
|
||||
addCategory : {
|
||||
method : 'GET',
|
||||
params : {
|
||||
_method : 'addCategory'
|
||||
}
|
||||
},
|
||||
deleteCategory : {
|
||||
method : 'GET',
|
||||
params : {
|
||||
_method : 'deleteCategory'
|
||||
}
|
||||
}
|
||||
};
|
||||
var s = {};
|
||||
@@ -98,12 +111,19 @@ module.factory('SubscriptionService', [
|
||||
id : id
|
||||
});
|
||||
};
|
||||
s.addCategory = function(cat, callback) {
|
||||
res.addCategory(cat, function(data) {
|
||||
s.init();
|
||||
if (callback)
|
||||
callback(data);
|
||||
});
|
||||
};
|
||||
s.collapse = res.collapse;
|
||||
s.init();
|
||||
return s;
|
||||
} ]);
|
||||
});
|
||||
|
||||
module.factory('EntryService', [ '$resource', '$http',
|
||||
module.factory('EntryService',
|
||||
function($resource, $http) {
|
||||
var actions = {
|
||||
get : {
|
||||
@@ -121,7 +141,7 @@ module.factory('EntryService', [ '$resource', '$http',
|
||||
};
|
||||
var res = $resource('rest/entries/:_method', {}, actions);
|
||||
return res;
|
||||
} ]);
|
||||
});
|
||||
|
||||
module.factory('SettingsService', function($resource) {
|
||||
var s = {}
|
||||
|
||||
Reference in New Issue
Block a user