From 385114d4a6d6c0f2533196be11e5f249bf3b899b Mon Sep 17 00:00:00 2001 From: Sebastian Serth Date: Mon, 27 Jan 2020 15:03:41 +0100 Subject: [PATCH] Allow clicking on RfCs already present on LA Dashboard --- app/assets/javascripts/channels/la_exercises.js | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/app/assets/javascripts/channels/la_exercises.js b/app/assets/javascripts/channels/la_exercises.js index 8e758e49..a6701768 100644 --- a/app/assets/javascripts/channels/la_exercises.js +++ b/app/assets/javascripts/channels/la_exercises.js @@ -4,6 +4,17 @@ $(document).on('turbolinks:load', function() { const exercise_id = $('.teacher_dashboard').data().exerciseId; const study_group_id = $('.teacher_dashboard').data().studyGroupId; + $("tbody#posted_rfcs").children().each(function() { + let $row = $(this); + addClickEventToRfCEntry($row); + }); + + function addClickEventToRfCEntry($row) { + $row.click(function () { + Turbolinks.visit($(this).data("href")); + }); + } + const specific_channel = { channel: "LaExercisesChannel", exercise_id: exercise_id, study_group_id: study_group_id }; @@ -33,9 +44,7 @@ $(document).on('turbolinks:load', function() { } $row = $row.replaceWithAndReturnNewElement(data.html); $row.find('time').timeago(); - $row.click(function () { - Turbolinks.visit($(this).data("href")); - }); + addClickEventToRfCEntry($row); } function handleWorkingTimeUpdate(data) {