To receive notifications about scheduled maintenance, please subscribe to the mailing-list gitlab-operations@sympa.ethz.ch. You can subscribe to the mailing-list at https://sympa.ethz.ch

Commit c579178b authored by Hermann's avatar Hermann
Browse files

add number of members of a group

parent 6146a656
...@@ -6,13 +6,14 @@ import { ...@@ -6,13 +6,14 @@ import {
ToolbarTitle, ToolbarTitle,
TextField, TextField,
Icon, Icon,
IconButton,
} from 'polythene-mithril'; } from 'polythene-mithril';
import { icons, Property, DropdownCard } from '../views/elements'; import { icons, Property, DropdownCard, chip } from '../views/elements';
import { colors } from '../style';
import ItemView from '../views/itemView'; import ItemView from '../views/itemView';
import TableView from '../views/tableView'; import TableView from '../views/tableView';
import DatalistController from '../listcontroller'; import DatalistController from '../listcontroller';
import SelectList from '../views/selectList'; import SelectList from '../views/selectList';
import { ResourceHandler } from '../auth';
// Helper class to either display the signed up participants or those on the // Helper class to either display the signed up participants or those on the
...@@ -180,24 +181,40 @@ class EmailTable { ...@@ -180,24 +181,40 @@ class EmailTable {
} }
export default class viewGroup extends ItemView { export default class viewGroup extends ItemView {
oninit() {
// load the number of members in this group
const handler = new ResourceHandler('groupmemberships');
handler.get({ where: { group: this.data._id } }).then((memberships) => {
this.numMembers = memberships._meta.total;
m.redraw();
});
}
view() { view() {
// update the reference to the controller data, as this may be refreshed in between // update the reference to the controller data, as this may be refreshed in between
this.data = this.controller.data; this.data = this.controller.data;
const stdMargin = { margin: '5px' };
return this.layout([ return this.layout([
// this div is the title line // this div is the title line
m('div.maincontainer', [ m('div.maincontainer', [
m('h1', this.data.name), m('h1', this.data.name),
this.data.moderator ? m(Property, { this.data.requires_storage && m(chip, {
title: 'Moderator', svg: icons.cloud,
onclick: () => { m.route.set(`/users/${this.data.moderator._id}`); }, color: '#ffffff',
}, `${this.data.moderator.firstname} ${this.data.moderator.lastname}`) : '', background: colors.orange,
this.data.requires_storage ? m(IconButton, { ...stdMargin,
label: 'has a folder on the AMIV Cloud', }, 'has a folder on the AMIV Cloud'),
style: { color: '#ffffff', backgroundColor: 'orange' }, m('div', { style: { display: 'flex' } }, [
icon: { svg: { content: m.trust(icons.cloud) } }, this.numMembers && m(Property, { title: 'Members', style: stdMargin }, this.numMembers),
inactive: true, this.data.moderator && m(Property, {
compact: true, title: 'Moderator',
}) : '', onclick: () => { m.route.set(`/users/${this.data.moderator._id}`); },
style: stdMargin,
}, `${this.data.moderator.firstname} ${this.data.moderator.lastname}`),
]),
]), ]),
m('div.viewcontainer', [ m('div.viewcontainer', [
// now-column layout: This first column are the members // now-column layout: This first column are the members
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment