From e136006e6da8e6f1448d9545db3546904cc87bf7 Mon Sep 17 00:00:00 2001 From: Philippus Date: Sat, 21 Jul 2018 16:02:41 +0200 Subject: [PATCH] Don't render training data on events page, fixes #936 --- resources/js/functions.js | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/resources/js/functions.js b/resources/js/functions.js index 1178035fd..efe333d84 100644 --- a/resources/js/functions.js +++ b/resources/js/functions.js @@ -404,7 +404,7 @@ $(document).ready(function() { }); } - // Render training data for our training page + // Render training data for our front page var frontPageTrainingList = $('.training-items-list'); // Stop early if the front page element does not exist if (frontPageTrainingList.length !== 0) { @@ -444,10 +444,11 @@ $(document).ready(function() { }); } - // Render training data for the front page + // Render training data for the training page + var pathname = window.location.pathname; var trainingPageItemList = $('.training-events .wrap .inner-box'); - // Stop early if the training page element does not exist - if (trainingPageItemList.length !== 0) { + // Check if we are on the training page and the training page element exists + if (pathname.startsWith("/training") && trainingPageItemList.length !== 0) { getTrainings() .then(function (trainings) { var MAX_TRAININGS = 999;