2016-11-09 12:38:02 +00:00
|
|
|
import { Paginator } from '../../utils';
|
|
|
|
import template from './list.html';
|
|
|
|
|
2016-12-20 12:27:08 +00:00
|
|
|
function GroupsCtrl($scope, $uibModal, currentUser, Events, Group) {
|
2016-11-23 15:58:00 +00:00
|
|
|
Events.record('view', 'page', 'groups');
|
2016-11-09 12:38:02 +00:00
|
|
|
$scope.currentUser = currentUser;
|
|
|
|
$scope.groups = new Paginator([], { itemsPerPage: 20 });
|
|
|
|
Group.query((groups) => {
|
|
|
|
$scope.groups.updateRows(groups);
|
|
|
|
});
|
|
|
|
|
|
|
|
$scope.newGroup = () => {
|
|
|
|
$uibModal.open({
|
|
|
|
component: 'editGroupDialog',
|
|
|
|
size: 'sm',
|
|
|
|
resolve: {
|
|
|
|
group() {
|
|
|
|
return new Group({});
|
|
|
|
},
|
|
|
|
},
|
|
|
|
});
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
2017-10-03 17:21:36 +00:00
|
|
|
export default function init(ngModule) {
|
2016-11-09 12:38:02 +00:00
|
|
|
ngModule.controller('GroupsCtrl', GroupsCtrl);
|
2016-11-09 13:50:18 +00:00
|
|
|
|
2016-11-09 12:38:02 +00:00
|
|
|
return {
|
|
|
|
'/groups': {
|
|
|
|
template,
|
|
|
|
controller: 'GroupsCtrl',
|
2016-11-27 13:49:17 +00:00
|
|
|
title: 'Groups',
|
2016-11-09 12:38:02 +00:00
|
|
|
},
|
|
|
|
};
|
|
|
|
}
|