base.html 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  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-base-path="{{ settings.BASE_PATH }}"
  11. {% with preferences|get_key:'ui.colormode' as color_mode %}
  12. data-netbox-color-mode="{{ color_mode|default:"unset" }}"
  13. {% endwith %}
  14. >
  15. <head>
  16. <meta charset="UTF-8" />
  17. <meta name="viewport" content="initial-scale=1, maximum-scale=1, user-scalable=no, width=device-width, viewport-fit=cover" />
  18. <meta name="htmx-config" content='{"scrollBehavior": "auto"}'>
  19. {# Page title #}
  20. <title>{% block title %}{% trans "Home" %}{% endblock %} | NetBox</title>
  21. {# Initialize color mode #}
  22. <script
  23. type="text/javascript"
  24. src="{% static 'setmode.js' %}"
  25. onerror="window.location='{% url 'media_failure' %}?filename=setmode.js'">
  26. </script>
  27. <script type="text/javascript">
  28. (function () {
  29. initMode()
  30. })();
  31. window.CSRF_TOKEN = "{{ csrf_token }}";
  32. </script>
  33. {# Static resources #}
  34. <link
  35. rel="stylesheet"
  36. href="{% static 'netbox-external.css'%}?v={{ settings.VERSION }}"
  37. onerror="window.location='{% url 'media_failure' %}?filename=netbox-external.css'"
  38. />
  39. <link
  40. rel="stylesheet"
  41. href="{% static 'netbox.css'%}?v={{ settings.VERSION }}"
  42. onerror="window.location='{% url 'media_failure' %}?filename=netbox.css'"
  43. />
  44. <link rel="icon" type="image/png" href="{% static 'netbox.ico' %}" />
  45. <link rel="apple-touch-icon" type="image/png" href="{% static 'netbox_touch-icon-180.png' %}" />
  46. {# Javascript #}
  47. <script
  48. type="text/javascript"
  49. src="{% static 'netbox.js' %}?v={{ settings.VERSION }}"
  50. onerror="window.location='{% url 'media_failure' %}?filename=netbox.js'">
  51. </script>
  52. {% django_htmx_script %}
  53. {# Additional <head> content #}
  54. {% block head %}{% endblock %}
  55. </head>
  56. <body>
  57. {# Page layout #}
  58. {% block layout %}{% endblock %}
  59. {# Additional Javascript #}
  60. {% block javascript %}{% endblock %}
  61. {# User messages #}
  62. {% include 'inc/messages.html' %}
  63. </body>
  64. </html>