layout.html 7.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200
  1. {# Base layout for the core NetBox UI w/navbar and page content #}
  2. {% extends 'base/base.html' %}
  3. {% load helpers %}
  4. {% load navigation %}
  5. {% load plugins %}
  6. {% load static %}
  7. {% load i18n %}
  8. {% comment %}
  9. Blocks:
  10. header: Page header
  11. tabs: Horizontal navigation tabs
  12. content: Page content
  13. modals: Bootstrap 5 modal components
  14. {% endcomment %}
  15. {% block layout %}
  16. <div class="page">
  17. {# Sidebar #}
  18. <aside class="navbar navbar-vertical navbar-expand-lg" data-bs-theme="dark">
  19. <div class="container-fluid">
  20. {# Menu toggle (mobile view) #}
  21. <button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#sidebar-menu" aria-controls="sidebar-menu" aria-expanded="false" aria-label="Toggle navigation">
  22. <span class="navbar-toggler-icon"></span>
  23. </button>
  24. {# Logo #}
  25. <h1 class="navbar-brand navbar-brand-autodark">
  26. <a href="{% url 'home' %}">
  27. <img src="{% static 'netbox_logo.svg' %}" alt="{% trans "NetBox Logo" %}" class="navbar-brand-image">
  28. </a>
  29. </h1>
  30. {# User menu (mobile view) #}
  31. <div class="navbar-nav flex-row align-items-center d-lg-none">
  32. {% plugin_navbar %}
  33. {% include 'inc/light_toggle.html' %}
  34. {% include 'inc/user_menu.html' %}
  35. </div>
  36. {# Navigation menu #}
  37. <div class="collapse navbar-collapse" id="sidebar-menu">
  38. {% nav %}
  39. </div>
  40. </div>
  41. </aside>
  42. {# Top menu #}
  43. <header class="navbar navbar-expand-md sticky-top d-none d-lg-flex d-print-none">
  44. <div class="container-fluid">
  45. {# User menu (desktop view) #}
  46. <div class="navbar-nav flex-row align-items-center order-md-last">
  47. {% plugin_navbar %}
  48. {% include 'inc/light_toggle.html' %}
  49. {% include 'inc/user_menu.html' %}
  50. </div>
  51. {# Search box #}
  52. <div class="collapse navbar-collapse" id="navbar-menu">
  53. <form action="{% url 'search' %}" method="get" autocomplete="off" novalidate>
  54. <div class="input-icon">
  55. <span class="input-icon-addon">
  56. <i class="mdi mdi-magnify"></i>
  57. </span>
  58. <input type="text" name="q" value="" class="form-control" placeholder="Search…" aria-label="Search NetBox">
  59. </div>
  60. </form>
  61. </div>
  62. </div>
  63. </header>
  64. {# Page content #}
  65. <div class="page-wrapper">
  66. <div id="page-content" {% htmx_boost %}>
  67. {# Page header #}
  68. {% block header %}
  69. {# Top banner #}
  70. {% if config.BANNER_TOP %}
  71. {% include 'inc/banner.html' with content=config.BANNER_TOP %}
  72. {% endif %}
  73. {# /Top banner #}
  74. {# Alerts #}
  75. {% if settings.DEBUG and not settings.DEVELOPER %}
  76. {% include 'inc/alerts/warning.html' with title="Debug mode is enabled" message="Performance may be limited. Debugging should never be enabled on a production system." %}
  77. {% endif %}
  78. {% if config.MAINTENANCE_MODE and config.BANNER_MAINTENANCE %}
  79. {% include 'inc/alerts/warning.html' with title="Maintenance Mode" message=config.BANNER_MAINTENANCE|safe %}
  80. {% endif %}
  81. {# /Alerts #}
  82. {% endblock header %}
  83. {# /Page header #}
  84. {# Page body #}
  85. {% block page %}
  86. <div class="page-body my-1">
  87. <div class="container-fluid tab-content py-3">
  88. {# Page alerts #}
  89. {% block alerts %}{% endblock %}
  90. {# /Page alerts #}
  91. {# Page content #}
  92. {% block content %}{% endblock %}
  93. {# /Page content #}
  94. </div>
  95. </div>
  96. {% endblock page %}
  97. {# /Page body #}
  98. {# Bottom banner #}
  99. {% if config.BANNER_BOTTOM %}
  100. {% include 'inc/banner.html' with content=config.BANNER_BOTTOM %}
  101. {% endif %}
  102. {# /Bottom banner #}
  103. {# BS5 pop-up modals #}
  104. {% block modals %}{% endblock %}
  105. </div>
  106. {# Page footer #}
  107. <footer class="footer footer-transparent d-print-none py-2">
  108. <div class="container-fluid d-flex justify-content-between align-items-center">
  109. {% block footer %}
  110. {# Footer links #}
  111. <ul class="list-inline mb-0 fs-2">
  112. {% block footer_links %}
  113. {# Documentation #}
  114. <li class="list-inline-item">
  115. <a href="{% static 'docs/' %}" target="_blank" class="link-secondary" rel="noopener">
  116. <i title="{% trans "Docs" %}" class="mdi mdi-book-open-variant text-primary" data-bs-placement="top" data-bs-toggle="tooltip"></i>
  117. </a>
  118. </li>
  119. {# REST API #}
  120. <li class="list-inline-item">
  121. <a href="{% url 'api-root' %}" target="_blank" class="link-secondary" rel="noopener">
  122. <i title="{% trans "REST API" %}" class="mdi mdi-cloud-braces text-primary" data-bs-placement="top" data-bs-toggle="tooltip"></i>
  123. </a>
  124. </li>
  125. {# API docs #}
  126. <li class="list-inline-item">
  127. <a href="{% url 'api_docs' %}" target="_blank" class="link-secondary" rel="noopener">
  128. <i title="{% trans "REST API documentation" %}" class="mdi mdi-book text-primary" data-bs-placement="top" data-bs-toggle="tooltip"></i>
  129. </a>
  130. </li>
  131. {# GraphQL API #}
  132. {% if config.GRAPHQL_ENABLED %}
  133. <li class="list-inline-item">
  134. <a href="{% url 'graphql' %}" target="_blank" class="link-secondary" rel="noopener">
  135. <i title="{% trans "GraphQL API" %}" class="mdi mdi-graphql text-primary" data-bs-placement="top" data-bs-toggle="tooltip"></i>
  136. </a>
  137. </li>
  138. {% endif %}
  139. {# GitHub #}
  140. <li class="list-inline-item">
  141. <a href="https://github.com/netbox-community/netbox" target="_blank" class="link-secondary" rel="noopener">
  142. <i title="{% trans "Source Code" %}" class="mdi mdi-github text-primary" data-bs-placement="top" data-bs-toggle="tooltip"></i>
  143. </a>
  144. </li>
  145. {# NetDev Slack #}
  146. <li class="list-inline-item">
  147. <a href="https://netdev.chat" target="_blank" class="link-secondary" rel="noopener">
  148. <i title="{% trans "Community" %}" class="mdi mdi-slack text-primary" data-bs-placement="top" data-bs-toggle="tooltip"></i>
  149. </a>
  150. </li>
  151. {% endblock footer_links %}
  152. </ul>
  153. {# /Footer links #}
  154. {# Footer text #}
  155. <ul class="list-inline list-inline-dots fs-5 mb-0" id="footer-stamp" hx-swap-oob="true">
  156. <li class="list-inline-item">{% now 'Y-m-d H:i:s T' %}</li>
  157. <li class="list-inline-item">{{ settings.HOSTNAME }}</li>
  158. <li class="list-inline-item">{{ settings.RELEASE.name }}</li>
  159. </ul>
  160. {# /Footer text #}
  161. {% endblock footer %}
  162. </div>
  163. </footer>
  164. {# /Page footer #}
  165. {# /Page content #}
  166. </div>
  167. </div>
  168. {% endblock layout %}