This repository was archived by the owner on Jun 13, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 30
Expand file tree
/
Copy pathbase_site.html
More file actions
60 lines (53 loc) · 1.81 KB
/
base_site.html
File metadata and controls
60 lines (53 loc) · 1.81 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
{% extends "admin/base_site.html" %}
{% load i18n %}
{% block branding %}
<h1 id="site-name">
<a href="{% url 'admin:index' %}">
{% trans 'Django administration' %}
<span id="impersonation-notice" style="display: none;">
- Impersonating (return to codecov.io and log out)
</span>
</a>
</h1>
{% endblock %}
{% block extrahead %}
{{ block.super }}
<style>
/* Custom styling when cookie is present */
html[data-theme="light"].impersonation, :root.impersonation {
--primary: #ff9800;
--secondary: #ff9800;
--link-fg: #ff9800;
--link-selected-fg: #ff9800;
}
#header.impersonation {
background-color: #ff9800 !important;
}
</style>
<script>
document.addEventListener('DOMContentLoaded', function() {
function getCookie(name) {
const value = `; ${document.cookie}`;
const parts = value.split(`; ${name}=`);
if (parts.length === 2) return parts.pop().split(';').shift();
return null;
}
// Check for the "staff_user" cookie
const staffUserCookie = getCookie('staff_user');
if (staffUserCookie) {
// Modify the header appearance
const headerElement = document.querySelector('#header');
if (headerElement) {
headerElement.classList.add('impersonation');
}
// Add class to html element for theme variables
document.documentElement.classList.add('impersonation');
// Show the impersonation notice
const impersonationNotice = document.getElementById('impersonation-notice');
if (impersonationNotice) {
impersonationNotice.style.display = 'inline';
}
}
});
</script>
{% endblock %}