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 %}