base.html 2.4 KB

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