From 0370dc983a3b4d3cb534f838c4da0aac70c04475 Mon Sep 17 00:00:00 2001 From: Ioannis Michaloliakos Date: Thu, 1 Feb 2024 01:20:41 -0500 Subject: [PATCH] store last visited assignment group --- courses/static/courses/detail.js | 17 +++++++++++++++++ courses/templates/courses/detail.html | 2 +- 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/courses/static/courses/detail.js b/courses/static/courses/detail.js index 8176bf0..2fa5291 100644 --- a/courses/static/courses/detail.js +++ b/courses/static/courses/detail.js @@ -356,3 +356,20 @@ if (assignmentCanvasBtns) { }); }); } + + +$('button[data-bs-toggle="pill"]').on('show.bs.tab', function (e) { + console.log("New tab activated. Saving to local storage."); + localStorage.setItem('activePill', $(e.target).attr('data-bs-target')); +}); + +var activePill = localStorage.getItem('activePill'); +if(activePill){ + const query = 'button[data-bs-target="' + activePill + '"]'; + console.log(query); + const activeTab = document.querySelector(query); + console.log(activeTab); + if (activeTab) { + activeTab.click(); + } +} \ No newline at end of file diff --git a/courses/templates/courses/detail.html b/courses/templates/courses/detail.html index bc4e4ea..2dc26cf 100644 --- a/courses/templates/courses/detail.html +++ b/courses/templates/courses/detail.html @@ -93,7 +93,7 @@

Assignments

{% for group in course.get_all_assignment_groups %} -
+
    {% for assignment in group.assignments.all %}