Files
brewman/brewman/static/scripts/group.js
T

42 lines
1.2 KiB
JavaScript

'use strict';
var GroupListController = ['$scope', 'groups', function ($scope, groups) {
$scope.info = groups;
}];
GroupListController.resolve = {
groups: ['Group', function (Group) {
return Group.query({}).$promise;
}]
};
var GroupController = ['$scope', '$location', 'group', function ($scope, $location, group) {
$scope.group = group;
$scope.save = function () {
$scope.group.$save(function (u, putResponseHeaders) {
$scope.toasts.push({Type: 'Success', Message: ''});
$location.path('/Groups')
}, function (data, status) {
$scope.toasts.push({Type: 'Danger', Message: data.data});
});
};
$scope.delete = function () {
$scope.group.$delete(function (u, putResponseHeaders) {
$scope.toasts.push({Type: 'Success', Message: ''});
$location.path('/Groups')
}, function (data, status) {
$scope.toasts.push({Type: 'Danger', Message: data.data});
});
};
$scope.foName = true;
}];
GroupController.resolve = {
group: ['$route', 'Group', function ($route, Group) {
var id = $route.current.params.id;
return Group.get({id: id}).$promise;
}]
};