Skip to content

Commit

Permalink
store last visited assignment group
Browse files Browse the repository at this point in the history
  • Loading branch information
IonMich committed Feb 1, 2024
1 parent a887e87 commit 0370dc9
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 1 deletion.
17 changes: 17 additions & 0 deletions courses/static/courses/detail.js
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
}
2 changes: 1 addition & 1 deletion courses/templates/courses/detail.html
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ <h3>Assignments</h3>

<div class="tab-content" id="myTabContent" style="overflow-y:auto; margin-bottom: 1em">
{% for group in course.get_all_assignment_groups %}
<div class="tab-pane fade {% if forloop.first %}show active{% endif %}" role="tabpanel" id="assignment_group_{{forloop.counter}}">
<div class="tab-pane {% if forloop.first %}show active{% endif %}" role="tabpanel" id="assignment_group_{{forloop.counter}}">
<ul class="list-group">
{% for assignment in group.assignments.all %}
<a href="assignments/{{assignment.pk}}/" class="list-group-item list-group-item-action">
Expand Down

0 comments on commit 0370dc9

Please sign in to comment.