mirror of
https://github.com/DarkflameUniverse/NexusDashboard.git
synced 2024-11-13 21:38:20 +00:00
259efc81fd
fix: tooltips on lazy loaded items
120 lines
3.1 KiB
Django/Jinja
120 lines
3.1 KiB
Django/Jinja
{% import "_formhelpers.jinja2" as helper %}
|
|
<!doctype html>
|
|
<html lang='en'>
|
|
|
|
<head>
|
|
|
|
{# Title #}
|
|
<title>{% block title %}{% endblock %} - {{ config.APP_NAME }}</title>
|
|
|
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
|
|
{% block css %}
|
|
<style>
|
|
.required:after {
|
|
content:" *";
|
|
color: red;
|
|
}
|
|
.error {
|
|
color: red;
|
|
}
|
|
</style>
|
|
|
|
{# CSS Styling #}
|
|
{% assets "scss_all" %}
|
|
<link rel=stylesheet type=text/css href="{{ ASSET_URL }}">
|
|
{% endassets %}
|
|
|
|
<link rel='stylesheet' href="{{ url_for('static', filename='font-awesome/css/all.min.css')}}">
|
|
|
|
{% endblock %}
|
|
|
|
</head>
|
|
<body class="bg-dark text-white">
|
|
|
|
|
|
{% block header %}
|
|
{# Header / Navigation #}
|
|
{% include 'header.html.j2' %}
|
|
{% endblock %}
|
|
|
|
|
|
{# Content #}
|
|
|
|
<div class="container py-0">
|
|
|
|
{# Text #}
|
|
<div class="text-center">
|
|
<span class="h3 mb-0"><br/>{% block content_before %}{% endblock %}<br/><br/></span>
|
|
</div>
|
|
{# Show any errors #}
|
|
{% with messages = get_flashed_messages(with_categories=true) %}
|
|
{% if messages %}
|
|
{% for category, message in messages %}
|
|
<div class="alert alert-{{category}}" role="alert">
|
|
{{message}}
|
|
</div>
|
|
{% endfor %}
|
|
{% endif %}
|
|
{% endwith %}
|
|
</div>
|
|
|
|
{% block content_override %}
|
|
<div class='container mt-4'>
|
|
{% block content %}{% endblock %}
|
|
</div>
|
|
{% endblock %}
|
|
|
|
<div class='container mt-4'>
|
|
{% block content_after %}{% endblock %}
|
|
</div>
|
|
|
|
<footer>
|
|
{# Footer #}
|
|
{% block footer %}
|
|
<hr class="my-5"/>
|
|
|
|
{% endblock %}
|
|
</footer>
|
|
|
|
|
|
{% block js %}
|
|
{# JavaScript #}
|
|
<script type="text/javascript" src="{{ url_for('static', filename='bootstrap-4.2.1/js/jquery-3.3.1.min.js') }}"></script>
|
|
<script type="text/javascript" src="{{ url_for('static', filename='bootstrap-4.2.1/js/bootstrap.bundle.min.js') }}"></script>
|
|
<script type="text/javascript" src="{{ url_for('static', filename='datatables/datatables.min.js') }}"></script>
|
|
<script type="sytylesheet" src="{{ url_for('static', filename='datatables/datatables.min.css') }}"></script>
|
|
<script>
|
|
// set the active nav-link item
|
|
$(function () {
|
|
let target_nav = '#{{request.endpoint}}'.replace('\.', '-');
|
|
$(target_nav).addClass('active');
|
|
});
|
|
// make tooltips with data work
|
|
$(function () {
|
|
$('[data-toggle="tooltip"]').tooltip()
|
|
})
|
|
function setInnerHTML(elm, html) {
|
|
elm.innerHTML = html;
|
|
$("body").tooltip({ selector: '[data-toggle=tooltip]' });
|
|
Array.from(elm.querySelectorAll("script"))
|
|
.forEach( oldScriptEl => {
|
|
const newScriptEl = document.createElement("script");
|
|
|
|
Array.from(oldScriptEl.attributes).forEach( attr => {
|
|
newScriptEl.setAttribute(attr.name, attr.value)
|
|
});
|
|
|
|
const scriptText = document.createTextNode(oldScriptEl.innerHTML);
|
|
newScriptEl.appendChild(scriptText);
|
|
|
|
oldScriptEl.parentNode.replaceChild(newScriptEl, oldScriptEl);
|
|
|
|
});
|
|
}
|
|
</script>
|
|
{% endblock %}
|
|
|
|
</body>
|
|
</html>
|