fixes #124: show number of attendees in the list of events

This commit is contained in:
Davide Alberani 2016-05-13 23:30:15 +02:00
parent 30c14b1046
commit 906d5fbf9c
3 changed files with 26 additions and 2 deletions

View file

@ -30,6 +30,7 @@
<thead>
<tr>
<th><strong>{{'Event' | translate}}</strong></th>
<th class="hcenter"><strong>{{'Attendees / Registered' | translate}}</strong></th>
<th><strong>{{'Delete' | translate}}</strong></th>
</tr>
</thead>
@ -37,9 +38,12 @@
<tr ng-repeat="event in events | splittedFilter:query | orderBy:eventsOrderProp">
<td>
<span><strong><a ui-sref="event.info({id: event._id})">{{event.title}}</a></strong></span>
<p>{{'Begins:' | translate}} {{event['begin-date'] | date:'fullDate' }} {{event['begin-time'] | date:'HH:mm' }}<br/>
<p>{{'Begins:' | translate}} {{event['begin-date'] | date:'fullDate'}} {{event['begin-time'] | date:'HH:mm'}}<br/>
{{'Ends:' | translate}} {{event['end-date'] | date:'fullDate' }} {{event['end-time'] | date:'HH:mm'}}</p>
</td>
<td class="hcenter">
<p><span ng-init="attendeesNr = (event.persons | attendeesFilter).length">{{attendeesNr}}</span> / {{event.persons.length || 0}}</p>
</td>
<td>
<button ng-click="remove(event._id)" type="button" class="btn btn-link fa fa-trash fa-lg"></button>
</td>

View file

@ -64,3 +64,19 @@ eventManApp.filter('splittedFilter', ['$filter',
}]
);
/* Filter that returns only the attendees at an event. */
eventManApp.filter('attendeesFilter', ['$filter',
function($filter) {
return function(inputArray) {
var returnArray = [];
for (var x=0; x < inputArray.length; x++) {
if (inputArray[x]['attended']) {
returnArray.push(inputArray[x]);
}
}
return returnArray;
};
}]
);

View file

@ -1,4 +1,3 @@
/* nav-bar padding */
body { padding-top: 70px; }
@ -37,6 +36,11 @@ body { padding-top: 70px; }
.min200 { min-width: 200px; }
.min250 { min-width: 250px; }
/* horizontally center */
.hcenter {
text-align: center;
}
/* vertically center */
.vcenter {
vertical-align: middle;