forked from Archives/Athou_commafeed
auto refresh every 30s (fixes #6)
This commit is contained in:
@@ -10,7 +10,7 @@ module.run(function($rootScope) {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
module.controller('CategoryTreeCtrl', function($scope, $stateParams, $location,
|
module.controller('CategoryTreeCtrl', function($scope, $timeout, $stateParams, $location,
|
||||||
$state, $route, SubscriptionService) {
|
$state, $route, SubscriptionService) {
|
||||||
|
|
||||||
$scope.$on('$stateChangeSuccess', function() {
|
$scope.$on('$stateChangeSuccess', function() {
|
||||||
@@ -18,6 +18,12 @@ module.controller('CategoryTreeCtrl', function($scope, $stateParams, $location,
|
|||||||
$scope.selectedId = $stateParams._id;
|
$scope.selectedId = $stateParams._id;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
$timeout(function refreshTree() {
|
||||||
|
SubscriptionService.init(function() {
|
||||||
|
$timeout(refreshTree, 30000);
|
||||||
|
});
|
||||||
|
}, 30000);
|
||||||
|
|
||||||
$scope.SubscriptionService = SubscriptionService;
|
$scope.SubscriptionService = SubscriptionService;
|
||||||
|
|
||||||
var unreadCount = function(category) {
|
var unreadCount = function(category) {
|
||||||
@@ -253,34 +259,36 @@ module.controller('FeedListCtrl', function($scope, $stateParams, $http, $route,
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
module.controller('ManageUsersCtrl',
|
module.controller('ManageUsersCtrl', function($scope, $state, $location,
|
||||||
function($scope, $state, $location, AdminUsersService) {
|
AdminUsersService) {
|
||||||
$scope.users = AdminUsersService.getAll();
|
$scope.users = AdminUsersService.getAll();
|
||||||
$scope.selection = [];
|
$scope.selection = [];
|
||||||
$scope.gridOptions = {
|
$scope.gridOptions = {
|
||||||
data : 'users',
|
data : 'users',
|
||||||
selectedItems : $scope.selection,
|
selectedItems : $scope.selection,
|
||||||
multiSelect : false,
|
multiSelect : false,
|
||||||
afterSelectionChange : function(item) {
|
afterSelectionChange : function(item) {
|
||||||
$state.transitionTo('admin.useredit', {
|
$state.transitionTo('admin.useredit', {
|
||||||
_id : item.entity.id
|
_id : item.entity.id
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
$scope.addUser = function() {
|
$scope.addUser = function() {
|
||||||
$state.transitionTo('admin.useradd');
|
$state.transitionTo('admin.useradd');
|
||||||
};
|
};
|
||||||
$scope.back = function() {
|
$scope.back = function() {
|
||||||
$location.path('/');
|
$location.path('/');
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
||||||
module.controller('ManageUserCtrl', function($scope, $state, $stateParams,
|
module.controller('ManageUserCtrl', function($scope, $state, $stateParams,
|
||||||
AdminUsersService) {
|
AdminUsersService) {
|
||||||
$scope.user = $stateParams._id ? AdminUsersService.get({
|
$scope.user = $stateParams._id ? AdminUsersService.get({
|
||||||
id : $stateParams._id
|
id : $stateParams._id
|
||||||
}) : {enabled: true};
|
}) : {
|
||||||
|
enabled : true
|
||||||
|
};
|
||||||
$scope.alerts = [];
|
$scope.alerts = [];
|
||||||
$scope.closeAlert = function(index) {
|
$scope.closeAlert = function(index) {
|
||||||
$scope.alerts.splice(index, 1);
|
$scope.alerts.splice(index, 1);
|
||||||
@@ -288,11 +296,11 @@ module.controller('ManageUserCtrl', function($scope, $state, $stateParams,
|
|||||||
var alertFunction = function(data) {
|
var alertFunction = function(data) {
|
||||||
$scope.alerts.push({
|
$scope.alerts.push({
|
||||||
msg : data.data,
|
msg : data.data,
|
||||||
type: 'error'
|
type : 'error'
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
$scope.cancel = function(){
|
$scope.cancel = function() {
|
||||||
$state.transitionTo('admin.userlist');
|
$state.transitionTo('admin.userlist');
|
||||||
};
|
};
|
||||||
$scope.save = function() {
|
$scope.save = function() {
|
||||||
@@ -302,8 +310,10 @@ module.controller('ManageUserCtrl', function($scope, $state, $stateParams,
|
|||||||
}, alertFunction);
|
}, alertFunction);
|
||||||
};
|
};
|
||||||
$scope.remove = function() {
|
$scope.remove = function() {
|
||||||
AdminUsersService.remove({id: $scope.user.id}, function() {
|
AdminUsersService.remove({
|
||||||
|
id : $scope.user.id
|
||||||
|
}, function() {
|
||||||
$state.transitionTo('admin.userlist');
|
$state.transitionTo('admin.userlist');
|
||||||
},alertFunction);
|
}, alertFunction);
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
Reference in New Issue
Block a user