1
0
mirror of https://github.com/LaCasemate/fab-manager.git synced 2025-01-19 08:52:25 +01:00

(feat) feature the next event in the event page

This commit is contained in:
Sylvain 2022-06-15 10:55:08 +02:00
parent a8ca94ce32
commit 31fe9dea05
3 changed files with 4 additions and 2 deletions

View File

@ -2,6 +2,7 @@
## next deploy ## next deploy
- Feature the next event in the event page
- Documentation for installing behind a proxy - Documentation for installing behind a proxy
- Ability to install behind a proxy - Ability to install behind a proxy
- Improved docker image building time - Improved docker image building time

View File

@ -112,14 +112,14 @@ Application.Controllers.controller('EventsController', ['$scope', '$state', 'Eve
*/ */
const groupEvents = function (events) { const groupEvents = function (events) {
if (events.length > 0) { if (events.length > 0) {
const eventsGroupedByMonth = _.groupBy(events.slice(1), function (obj) { const eventsGroupedByMonth = _.groupBy(events, function (obj) {
return _.map(['month_id', 'year'], function (key) { return _.map(['month_id', 'year'], function (key) {
return obj[key]; return obj[key];
}); });
}); });
$scope.eventsGroupByMonth = Object.assign($scope.eventsGroupByMonth, eventsGroupedByMonth); $scope.eventsGroupByMonth = Object.assign($scope.eventsGroupByMonth, eventsGroupedByMonth);
$scope.monthOrder = Object.keys($scope.eventsGroupByMonth); $scope.monthOrder = Object.keys($scope.eventsGroupByMonth);
$scope.featuredEevent = events[0]; $scope.featuredEevent = _.minBy(events.filter(e => moment(e.start_date).isAfter()), e => e.start_date);
} }
}; };

View File

@ -56,6 +56,7 @@
event="event" event="event"
card-type="'sm'" card-type="'sm'"
ng-repeat="event in eventsGroupByMonth[month].slice(3*$index, 3*$index + 3)" ng-repeat="event in eventsGroupByMonth[month].slice(3*$index, 3*$index + 3)"
ng-if="event.id !== featuredEevent.id"
ui-sref="app.public.events_show({id: event.id})"> ui-sref="app.public.events_show({id: event.id})">
</event-card> </event-card>
</div> </div>