base.html 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. {# Base template for (almost) all NetBox pages #}
  2. {% load static %}
  3. {% load helpers %}
  4. {% load i18n %}
  5. {% load django_htmx %}
  6. <!DOCTYPE html>
  7. <html
  8. lang="en"
  9. data-netbox-url-name="{{ request.resolver_match.url_name }}"
  10. data-netbox-version="{{ settings.VERSION }}"
  11. {% if request.user.is_authenticated %}
  12. data-netbox-user-name="{{ request.user.username }}"
  13. data-netbox-user-id="{{ request.user.pk }}"
  14. {% endif %}
  15. >
  16. <head>
  17. <meta charset="UTF-8" />
  18. <meta name="viewport" content="initial-scale=1, maximum-scale=5, width=device-width, viewport-fit=cover" />
  19. <meta name="htmx-config" content='{"scrollBehavior": "auto"}'>
  20. <meta name="hostname" content="{{ settings.HOSTNAME }}" />
  21. {# Page title #}
  22. <title>{% block title %}{% trans "Home" %}{% endblock %} | NetBox</title>
  23. {# Initialize color mode #}
  24. <script
  25. type="text/javascript"
  26. src="{% static 'setmode.js' %}?v={{ settings.RELEASE.version }}"
  27. onerror="window.location='{% url 'media_failure' %}?filename=setmode.js'">
  28. </script>
  29. <script type="text/javascript">
  30. (function () {
  31. initMode()
  32. })();
  33. window.CSRF_TOKEN = "{{ csrf_token }}";
  34. </script>
  35. {# Static resources #}
  36. <link
  37. rel="stylesheet"
  38. href="{% static 'netbox-external.css'%}?v={{ settings.RELEASE.version }}"
  39. onerror="window.location='{% url 'media_failure' %}?filename=netbox-external.css'"
  40. />
  41. <link
  42. rel="stylesheet"
  43. href="{% static 'netbox.css'%}?v={{ settings.RELEASE.version }}"
  44. onerror="window.location='{% url 'media_failure' %}?filename=netbox.css'"
  45. />
  46. <link rel="icon" type="image/png" href="{% static 'netbox.ico' %}" />
  47. <link rel="apple-touch-icon" type="image/png" href="{% static 'netbox_touch-icon-180.png' %}" />
  48. {# Javascript #}
  49. <script
  50. type="text/javascript"
  51. src="{% static 'netbox.js' %}?v={{ settings.RELEASE.version }}"
  52. onerror="window.location='{% url 'media_failure' %}?filename=netbox.js'">
  53. </script>
  54. {% django_htmx_script %}
  55. {# Additional <head> content #}
  56. {% block head %}{% endblock %}
  57. </head>
  58. <body>
  59. {# Page layout #}
  60. {% block layout %}{% endblock %}
  61. {# Additional Javascript #}
  62. {% block javascript %}{% endblock %}
  63. {# User messages #}
  64. {% include 'inc/messages.html' %}
  65. </body>
  66. </html>