diff --git a/CHANGELOG.md b/CHANGELOG.md index 07c0b8c14..9773ea1b0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,7 @@ ## next deploy +- Feature the next event in the event page - Documentation for installing behind a proxy - Ability to install behind a proxy - Improved docker image building time diff --git a/app/frontend/src/javascript/controllers/events.js.erb b/app/frontend/src/javascript/controllers/events.js.erb index 008c9a748..3786901f7 100644 --- a/app/frontend/src/javascript/controllers/events.js.erb +++ b/app/frontend/src/javascript/controllers/events.js.erb @@ -112,14 +112,14 @@ Application.Controllers.controller('EventsController', ['$scope', '$state', 'Eve */ const groupEvents = function (events) { 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 obj[key]; }); }); $scope.eventsGroupByMonth = Object.assign($scope.eventsGroupByMonth, eventsGroupedByMonth); $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); } }; diff --git a/app/frontend/templates/events/index.html b/app/frontend/templates/events/index.html index 02b436682..9616005ee 100644 --- a/app/frontend/templates/events/index.html +++ b/app/frontend/templates/events/index.html @@ -56,6 +56,7 @@ event="event" card-type="'sm'" 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})">