Skip to content
Snippets Groups Projects
Commit d665a963 authored by sandeepsajan0's avatar sandeepsajan0 Committed by Fredrik Jonsson
Browse files

Fix tests and js lint issues

parent c0372c26
No related branches found
No related tags found
No related merge requests found
...@@ -3,6 +3,7 @@ from .models import Activity ...@@ -3,6 +3,7 @@ from .models import Activity
def notification_context(request): def notification_context(request):
context_data = dict() context_data = dict()
if request.user.is_authenticated and request.user.is_apply_staff: if hasattr(request, 'user'):
context_data['latest_notifications'] = Activity.objects.all().order_by('-timestamp')[:5] if request.user.is_authenticated and request.user.is_apply_staff:
context_data['latest_notifications'] = Activity.objects.all().order_by('-timestamp')[:5]
return context_data return context_data
function notificationToggle() { function notificationToggle() {
document.getElementById("notificationDropdown").classList.toggle("show"); 'use strict';
document.getElementById('notificationDropdown').classList.toggle('show');
} }
// Close the dropdown menu if the user clicks outside of it // Close the dropdown menu if the user clicks outside of it
window.onclick = function(event) { window.onclick = function (event) {
if (!event.target.matches('.dropbtn, .dropbtn *')) { 'use strict';
var dropdowns = document.getElementsByClassName("dropdown-content"); if (!event.target.matches('.dropbtn, .dropbtn *')) {
var i; var dropdowns = document.getElementsByClassName('dropdown-content');
for (i = 0; i < dropdowns.length; i++) { var i;
var openDropdown = dropdowns[i]; for (i = 0; i < dropdowns.length; i++) {
if (openDropdown.classList.contains('show')) { var openDropdown = dropdowns[i];
openDropdown.classList.remove('show'); if (openDropdown.classList.contains('show')) {
} notificationToggle();
}
}
} }
} };
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment