-
Notifications
You must be signed in to change notification settings - Fork 157
/
base.html
128 lines (124 loc) · 5.71 KB
/
base.html
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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
{% load i18n %}
{% load static %}
{% load comp_filters %}
{% get_available_languages as LANGUAGES %}
{% get_current_language as current_language %}
<!DOCTYPE html>
<html dir="ltr" lang="en" class="h-100">
<head>
<meta charset="utf-8" />
<title>{% block title %}django-comments-xtd comp demo{% endblock %}</title>
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Oxygen:wght@300;400;700&display=swap" rel="stylesheet">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-icons/1.11.3/font/bootstrap-icons.min.css" integrity="sha512-dPXYcDub/aeb08c63jRq/k6GaKccl256JQy/AnOq7CAnEZ9FzSL9wSbcZkMp4R26vBsMLFYH4kQ67/bbV8XaCQ==" crossorigin="anonymous" referrerpolicy="no-referrer" />
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/bootstrap/5.3.3/css/bootstrap.min.css" integrity="sha512-jnSuA4Ss2PkkikSOLtYs8BlYIeeIK1h99ty4YfvRPAlzr377vr3CXDb7sb7eEEBYjDtcYj+AjBH3FLv5uSJuXg==" crossorigin="anonymous" referrerpolicy="no-referrer" />
<style>
html, body {
font-family: "Open Sans", Tahoma, sans-serif;
}
main h1, main h2, main h3 {
font-family: "Georgia";
}
main h1 { line-height: 2.4; }
main h2 { line-height: 2.2; }
main h3 { line-height: 2.0; }
.container {
max-width: 960px;
}
pre { padding: 0 16px; }
.comment .content p:last-child {
margin-bottom: 0px;
}
.comment-header .permalink {
display: none;
}
.comment-header:hover .permalink {
display: inline;
}
</style>
</head>
<body class="h-100 d-flex flex-column">
<div class="container">
<div class="d-flex py-4 align-items-center">
<h2 class="flex-grow-1"><a href="/" class="text-decoration-none">comp demo</a></h2>
<nav class="nav nav-underline">
{% if request.user.is_authenticated %}
<a class="flex-sm-fill text-sm-center nav-link disabled">Hi, {{ request.user.get_full_name }}</a>
{% endif %}
<a class="flex-sm-fill text-sm-center nav-link {% block menu-class-homepage %}{% endblock %}"
href="{% url 'homepage' %}">{% trans "Home" %}</a>
<a class="flex-sm-fill text-sm-center nav-link {% block menu-class-articles %}{% endblock %}"
href="{% url 'articles-index' %}">{% trans "articles" %}</a>
<a class="flex-sm-fill text-sm-center nav-link {% block menu-class-quotes %}{% endblock %}"
href="{% url 'quotes-index' %}">{% trans "quotes" %}</a>
<a class="flex-sm-fill text-sm-center nav-link {% block menu-class-comments %}{% endblock %}"
href="{% url 'comp-comment-list' %}">{% trans "comments" %}</a>
{% if 'rosetta' in settings.INSTALLED_APPS %}
<div class="dropdown">
<form id="langform" hidden>
{% csrf_token %}<input type="text" id="language" name="language" /><input type="text" name="next" />
</form>
<a class="flex-sm-fill text-sm-center nav-link dropdown-toggle"
data-bs-toggle="dropdown"
href="#" data-dcx-language-active>{{ current_language|language_name }}</a>
<div class="dropdown-menu languages" id="selectlanguage">
{% for language in LANGUAGES %}
{% if current_language != language.0 %}
<a class="dropdown-item" href="#" data-dcx-language-code="{{ language.0 }}">{{ language.0|language_tuple }}</a>
{% else %}
<a class="dropdown-item disabled"
href="#">{{ language.0|language_name }}</a>
{% endif %}
{% endfor %}
</div>
</div>
{% endif %}
</nav>
</div>
</div>
<main>
{% block content %}
{% endblock %}
</main>
<footer class="mt-auto">
<div class="container">
<div class="row">
<div class="col-md-12">
<hr/>
<p class="text-center text-muted small">django-comments-xtd comp demo.</p>
</div>
</div>
</div>
</footer>
<script src="https://cdnjs.cloudflare.com/ajax/libs/remarkable/2.0.1/remarkable.min.js" integrity="sha512-skYYbQHAuOTpeJTthhUH3flZohep8blA+qjZOY0VqmfXMDiYcWxu29F5UbxU4LxaIpGkRBk+3Qf8qaXfd9jngg==" crossorigin="anonymous" referrerpolicy="no-referrer"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/bootstrap/5.3.3/js/bootstrap.bundle.min.js" integrity="sha512-7Pi/otdlbbCR+LnW+F7PwFcSDJOuUJB3OxtEHbg4vSMvzvJjde4Po1v4BR9Gdc9aXNUNFVUY+SK51wWT8WF0Gg==" crossorigin="anonymous" referrerpolicy="no-referrer"></script>
<script type="text/javascript" src="{% url 'javascript-catalog' %}"></script>
<script>
function set_language(event) {
event.preventDefault();
const formEl = document.getElementById('langform');
const inputEl = document.querySelector('input[name=language]');
inputEl.value = event.target.dataset.dcxLanguageCode;
const _promise = fetch('/i18n/setlang/', {
method: "POST", mode: "cors", body: new FormData(formEl)
});
_promise.then(() => window.location.reload());
}
window.addEventListener('DOMContentLoaded', () => {
const qs_lang_anchors = "[data-dcx-language-code]";
for (const item of document.querySelectorAll(qs_lang_anchors)) {
item.addEventListener("click", set_language);
}
});
/*
$(function() {
$('.dropdown-toggle').dropdown();
$("#selectlanguage A[data-name=language]").click(set_language);
});
*/
</script>
{% block extra_js %}
{% endblock %}
</body>
</html>