base.html 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387
  1. {% load i18n static jazzmin admin_urls %}
  2. {% get_current_language as LANGUAGE_CODE %}
  3. {% get_current_language_bidi as LANGUAGE_BIDI %}
  4. {% get_jazzmin_settings request as jazzmin_settings %}
  5. {% get_jazzmin_ui_tweaks as jazzmin_ui %}
  6. <!DOCTYPE html>
  7. <html lang="{{ LANGUAGE_CODE|default:"en-us" }}" {% if LANGUAGE_BIDI %}dir="rtl"{% endif %}>
  8. <head>
  9. <meta charset="utf-8">
  10. <meta name="viewport" content="width=device-width, initial-scale=1">
  11. <meta http-equiv="x-ua-compatible" content="ie=edge">
  12. <!-- Prevent admin panel being crawled by search engines -->
  13. <meta name="robots" content="none, noarchive">
  14. <title>{% block title %}{{ title }} | {{ jazzmin_settings.site_title }}{% endblock %}</title>
  15. <!-- Font Awesome Icons -->
  16. <link rel="stylesheet" href="{% static "vendor/fontawesome-free/css/all.min.css" %}">
  17. <!-- Bootstrap and adminLTE -->
  18. <link rel="stylesheet" href="{% static "vendor/adminlte/css/adminlte.min.css" %}" id="adminlte-css">
  19. <!-- Bootswatch theme -->
  20. {% if jazzmin_ui.theme.name != 'default' %}
  21. <link rel="stylesheet" href="{{ jazzmin_ui.theme.src }}" id="jazzmin-theme" />
  22. {% endif %}
  23. {% if jazzmin_ui.dark_mode_theme %}
  24. <link rel="stylesheet" href="{{ jazzmin_ui.dark_mode_theme.src }}" id="jazzmin-dark-mode-theme" media="(prefers-color-scheme: dark)"/>
  25. {% endif %}
  26. <!-- Custom fixes for django -->
  27. <link rel="stylesheet" href="{% static "jazzmin/css/main.css" %}">
  28. {% if jazzmin_settings.custom_css %}
  29. <!-- Custom CSS -->
  30. <link rel="stylesheet" href="{% static jazzmin_settings.custom_css %}">
  31. {% endif %}
  32. <!-- favicons -->
  33. <link rel="shortcut icon" href="{% static jazzmin_settings.site_icon %}" type="image/png">
  34. <link rel="icon" href="{% static jazzmin_settings.site_icon %}" sizes="32x32" type="image/png">
  35. {% if jazzmin_settings.use_google_fonts_cdn %}
  36. <!-- Google Font: Source Sans Pro -->
  37. <link href="https://fonts.googleapis.com/css?family=Source+Sans+Pro:300,400,400i,700" rel="stylesheet">
  38. {% endif %}
  39. {% block extrastyle %} {% endblock %}
  40. {% block extrahead %} {% endblock %}
  41. </head>
  42. <body class="hold-transition{% if not jazzmin_settings.show_sidebar %} no-sidebar{% else %} sidebar-mini{% endif %} {% sidebar_status request %} {% if is_popup %}popup {% endif %}{% block bodyclass %}{% endblock %} {{ jazzmin_ui.body_classes }} {% if jazzmin_ui.dark_mode_theme %}theme-dark{% endif %}" data-admin-utc-offset="{% now "Z" %}">
  43. <div class="wrapper">
  44. {% if not is_popup %}
  45. <nav class="main-header navbar navbar-expand {{ jazzmin_ui.navbar_classes }}" id="jazzy-navbar">
  46. <ul class="navbar-nav">
  47. {% if jazzmin_settings.show_sidebar %}
  48. <li class="nav-item">
  49. <a class="nav-link" data-widget="pushmenu" href="#" role="button"><i class="fas fa-bars"></i></a>
  50. </li>
  51. {% else %}
  52. <li class="nav-item">
  53. <a href="{% url 'admin:index' %}" class="brand-link">
  54. <img src="{% static jazzmin_settings.site_logo %}" alt="{{ jazzmin_settings.site_header }} Logo" class="{{ jazzmin_settings.site_logo_classes }} brand-image" style="opacity: .8; margin: 0 0 0 5px;">
  55. </a>
  56. </li>
  57. {% endif %}
  58. {% get_top_menu user request.current_app|default:"admin" as top_menu %}
  59. {% for link in top_menu %}
  60. <li class="nav-item d-none d-sm-inline-block{% if link.children %} dropdown{% endif %}">
  61. {% if link.children %}
  62. <a class="nav-link dropdown-toggle" href="#" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
  63. {{ link.name }}
  64. </a>
  65. <div class="dropdown-menu">
  66. {% for child in link.children %}
  67. <a class="dropdown-item" href="{{ child.url }}" {% if link.new_window %}target="_blank"{% endif %}>{{ child.name }}</a>
  68. {% endfor %}
  69. </div>
  70. {% else %}
  71. <a href="{{ link.url }}" class="nav-link" {% if link.new_window %}target="_blank"{% endif %}>{{ link.name }}</a>
  72. {% endif %}
  73. </li>
  74. {% endfor %}
  75. </ul>
  76. {% if jazzmin_settings.search_model %}
  77. {% for search_model in jazzmin_settings.search_models_parsed %}
  78. <form action="{{ search_model.search_url }}" method="GET" class="form-inline ml-3">
  79. <div class="input-group input-group-sm">
  80. <input class="form-control form-control-navbar" name="q" type="search" placeholder="{% trans 'Search' %} {{ search_model.search_name }}..." aria-label="{% trans 'Search' %} {{ search_model.search_name }}...">
  81. <div class="input-group-append">
  82. <button class="btn btn-navbar" type="submit">
  83. <i class="fas fa-search"></i>
  84. </button>
  85. </div>
  86. </div>
  87. </form>
  88. {% endfor %}
  89. {% endif %}
  90. {% block site-settings %}{% endblock %}
  91. <ul class="navbar-nav ml-auto">
  92. {% if jazzmin_settings.show_ui_builder %}
  93. <li class="nav-item">
  94. <a class="nav-link" data-widget="control-sidebar" data-slide="true" href="#" role="button">
  95. <i class="fas fa-th-large"></i>
  96. </a>
  97. </li>
  98. {% endif %}
  99. {% if 'django.contrib.admindocs'|app_is_installed %}
  100. <li class="nav-item">
  101. <a class="nav-link" href="{% url 'django-admindocs-docroot' %}" role="button">
  102. <i class="fas fa-book"></i>
  103. </a>
  104. </li>
  105. {% endif %}
  106. {% if jazzmin_settings.language_chooser %}
  107. {% get_available_languages as LANGUAGES %}
  108. {% get_language_info_list for LANGUAGES as languages %}
  109. <li class="nav-item dropdown">
  110. <a class="nav-link btn" data-toggle="dropdown" href="#" title="Choose language">
  111. <i class="fas fa-globe" aria-hidden="true"></i>
  112. </a>
  113. <div class="dropdown-menu dropdown-menu-lg dropdown-menu-left" id="jazzy-languagemenu">
  114. <form action="{% url 'set_language' %}" method="post">
  115. {% csrf_token %}
  116. <input name="next" type="hidden" value="{{ request.get_full_path|remove_lang:LANGUAGE_CODE }}" />
  117. {% for language in languages %}
  118. <button
  119. type="submit"
  120. name="language"
  121. value="{{ language.code }}"
  122. class="dropdown-item {% if language.code == LANGUAGE_CODE %}active{% endif %}"
  123. lang="{{ language.code }}"
  124. >
  125. {{ language.name_local|title }}
  126. </button>
  127. {% endfor %}
  128. </form>
  129. </div>
  130. </li>
  131. {% endif %}
  132. <li class="nav-item dropdown">
  133. <a class="nav-link btn" data-toggle="dropdown" href="#" title="{{ request.user }}">
  134. <i class="far fa-user" aria-hidden="true"></i>
  135. </a>
  136. <div class="dropdown-menu dropdown-menu-lg dropdown-menu-left" id="jazzy-usermenu">
  137. <span class="dropdown-header">{% trans 'Account' %}</span>
  138. <div class="dropdown-divider"></div>
  139. <a href="{% url 'admin:password_change' %}" class="dropdown-item">
  140. <i class="fas fa-key mr-2"></i> {% trans 'Change password' %}
  141. </a>
  142. <div class="dropdown-divider"></div>
  143. <a href="{% url 'admin:logout' %}" class="dropdown-item">
  144. <i class="fas fa-users mr-2"></i> {% trans 'Log out' %}
  145. </a>
  146. {% get_user_menu user request.current_app|default:"admin" as user_menu %}
  147. {% for link in user_menu %}
  148. <div class="dropdown-divider"></div>
  149. <a href="{{ link.url }}" class="dropdown-item" {% if link.new_window %}target="_blank"{% endif %}>
  150. <i class="{{ link.icon }} mr-2"></i> {% trans link.name %}
  151. </a>
  152. {% endfor %}
  153. <div class="dropdown-divider"></div>
  154. {% if perms|can_view_self %}
  155. <a href="{% jazzy_admin_url request.user request.current_app|default:"admin" %}" class="dropdown-item dropdown-footer">{% trans 'See Profile' %}</a>
  156. {% endif %}
  157. </div>
  158. </li>
  159. </ul>
  160. </nav>
  161. {% block sidebar %}
  162. {% if jazzmin_settings.show_sidebar %}
  163. {% get_side_menu as side_menu_list %}
  164. <aside class="main-sidebar elevation-4 {{ jazzmin_ui.sidebar_classes }}" id="jazzy-sidebar">
  165. <a href="{% url 'admin:index' %}" class="brand-link {{ jazzmin_ui.brand_classes }}" id="jazzy-logo">
  166. <img src="{% static jazzmin_settings.site_logo %}" alt="{{ jazzmin_settings.site_header }} Logo" class="{{ jazzmin_settings.site_logo_classes }} brand-image elevation-3" style="opacity: .8">
  167. <span class="brand-text font-weight-light">{{ jazzmin_settings.site_brand }}</span>
  168. </a>
  169. <div class="sidebar">
  170. <div class="user-panel mt-3 pb-3 mb-3 d-flex">
  171. <div class="image">
  172. {% if jazzmin_settings|has_jazzmin_setting:"user_avatar" %}
  173. <img src="{% get_user_avatar request.user %}" width="160px" class="img-circle elevation-2" alt="User Image">
  174. {% else %}
  175. <i class="fas fa-inverse user-profile fa-user-circle"></i>
  176. {% endif %}
  177. </div>
  178. <div class="info">
  179. {% if perms|can_view_self %}
  180. <a href="{% jazzy_admin_url request.user request.current_app|default:"admin" %}" class="d-block">{{ request.user }}</a>
  181. {% else %}
  182. <span class="d-block" style="color: white;">{{ request.user }}</span>
  183. {% endif %}
  184. </div>
  185. </div>
  186. <nav class="mt-2">
  187. <ul class="nav nav-pills nav-sidebar flex-column {{ jazzmin_ui.sidebar_list_classes }}" data-widget="treeview" role="menu" data-collapsible="false">
  188. <li class="nav-item">
  189. <a href="{% url 'admin:index' %}" class="nav-link">
  190. <i class="nav-icon fas fa-th-large"></i>
  191. <p>{% trans 'Dashboard' %}</p>
  192. </a>
  193. </li>
  194. {% if jazzmin_settings.navigation_expanded %}
  195. {% for app in side_menu_list %}
  196. <li class="nav-header">{{ app.name }}</li>
  197. {% for model in app.models %}
  198. <li class="nav-item">
  199. {% if model.url %}
  200. <a href="{{ model.url }}" class="nav-link">
  201. <i class="nav-icon {{ model.icon }}"></i> <p>{{ model.name }}</p>
  202. </a>
  203. {% else %}
  204. <span class="nav-link disabled">
  205. <i class="nav-icon {{ model.icon }}"></i> <p>{{ model.name }}</p>
  206. </span>
  207. {% endif %}
  208. </li>
  209. {% endfor %}
  210. {% endfor %}
  211. {% else %}
  212. {% for app in side_menu_list %}
  213. <li class="nav-item has-treeview">
  214. <a href="#" class="nav-link">
  215. <i class="nav-icon {{ app.icon }}"></i>
  216. <p>{{ app.name|truncatechars:21 }} <i class="fas fa-angle-left right"></i></p>
  217. </a>
  218. <ul class="nav nav-treeview" style="display: none;">
  219. {% for model in app.models %}
  220. <li class="nav-item">
  221. <a href="{% if model.url %}{{ model.url }}{% else %}javascript:void(0){% endif %}" class="nav-link">
  222. <i class="nav-icon {{ model.icon }}"></i>
  223. <p>{{ model.name }}</p>
  224. </a>
  225. </li>
  226. {% endfor %}
  227. </ul>
  228. </li>
  229. {% endfor %}
  230. {% endif %}
  231. </ul>
  232. </nav>
  233. </div>
  234. </aside>
  235. {% endif %}
  236. {% endblock %}
  237. {% endif %}
  238. <div class="content-wrapper" {% if is_popup %}style="margin-left:0px; padding-top: 20px;"{% endif %}>
  239. {% block page_content %}
  240. {% if not is_popup %}
  241. <div class="content border-bottom mb-2">
  242. <div class="container-fluid">
  243. <div class="row">
  244. <div class="col-12 col-md-auto d-flex flex-grow-1 align-items-center">
  245. <h1 class="h4 m-0 pr-3 mr-3 border-right">{% block content_title %}{% endblock %}</h1>
  246. {% block breadcrumbs %}{% endblock %}
  247. </div>
  248. {% block page_actions %}{% endblock %}
  249. </div>
  250. </div>
  251. </div>
  252. {% endif %}
  253. <div class="content">
  254. <div class="container-fluid">
  255. <section id="content" class="content">
  256. {% block messages %}
  257. {% for message in messages %}
  258. {% if message.tags == 'success' %}
  259. <div class="alert alert-success alert-dismissible">
  260. <button type="button" class="close" data-dismiss="alert" aria-hidden="true">×
  261. </button>
  262. <i class="icon fa fa-check"></i>{{ message|capfirst }}
  263. </div>
  264. {% elif message.tags == 'error' %}
  265. <div class="alert alert-danger alert-dismissible">
  266. <button type="button" class="close" data-dismiss="alert" aria-hidden="true">×
  267. </button>
  268. <i class="icon fa fa-ban"></i>{{ message|capfirst }}
  269. </div>
  270. {% elif message.tags == 'warning' %}
  271. <div class="alert alert-warning alert-dismissible">
  272. <button type="button" class="close" data-dismiss="alert" aria-hidden="true">×
  273. </button>
  274. <i class="icon fa fa-exclamation-triangle"></i>{{ message|capfirst }}
  275. </div>
  276. {% elif message.tags == 'info' %}
  277. <div class="alert alert-info alert-dismissible">
  278. <button type="button" class="close" data-dismiss="alert" aria-hidden="true">×
  279. </button>
  280. <i class="icon fa fa-info"></i>{{ message|capfirst }}
  281. </div>
  282. {% endif %}
  283. {% endfor %}
  284. {% endblock messages %}
  285. <div class="row">
  286. {% block content %} {% endblock %}
  287. </div>
  288. </section>
  289. </div>
  290. </div>
  291. {% endblock %}
  292. </div>
  293. {% block footer %}
  294. {% if not is_popup %}
  295. <footer class="main-footer {{ jazzmin_ui.footer_classes }}">
  296. <div class="float-right d-none d-sm-inline">
  297. <b>{% trans 'Jazzmin version' %}</b> {% get_jazzmin_version %}
  298. </div>
  299. {% autoescape off %}
  300. <strong>{% trans 'Copyright' %} &copy; {% now 'Y' %} {{ jazzmin_settings.copyright }}.</strong> {% trans 'All rights reserved.' %}
  301. {% endautoescape %}
  302. </footer>
  303. {% if jazzmin_settings.show_ui_builder %}
  304. {% include 'jazzmin/includes/ui_builder_panel.html' %}
  305. {% endif %}
  306. {% endif %}
  307. {% endblock %}
  308. </div>
  309. {% if jazzmin_settings.show_ui_builder %}
  310. <div id="codeBox" class="modal fade" role="dialog">
  311. <div class="modal-dialog">
  312. <div class="modal-content">
  313. <div class="modal-header">
  314. <h4 class="modal-title">{% trans 'UI Configuration' %}</h4>
  315. <button type="button" class="close" data-dismiss="modal">&times;</button>
  316. </div>
  317. <div class="modal-body">
  318. <p>{% trans 'Copy this info your settings file to persist these UI changes' %}</p>
  319. <pre><code></code></pre>
  320. </div>
  321. <div class="modal-footer">
  322. <button type="button" class="btn {{ jazzmin_ui.button_classes.danger }}" data-dismiss="modal">{% trans 'Close' %}</button>
  323. </div>
  324. </div>
  325. </div>
  326. </div>
  327. {% endif %}
  328. <!-- jQuery -->
  329. <script src="{% static "admin/js/vendor/jquery/jquery.js" %}"></script>
  330. <!-- Bootstrap 4 -->
  331. <script src="{% static "vendor/bootstrap/js/bootstrap.min.js" %}"></script>
  332. <!-- AdminLTE App -->
  333. <script src="{% static "vendor/adminlte/js/adminlte.min.js" %}"></script>
  334. <!-- Django customisations -->
  335. <script src="{% static "jazzmin/js/main.js" %}"></script>
  336. {% if jazzmin_settings.custom_js %}
  337. <script src="{% static jazzmin_settings.custom_js %}"></script>
  338. {% endif %}
  339. {% if jazzmin_settings.show_ui_builder %}
  340. <script>
  341. window.ui_changes = JSON.parse('{{ jazzmin_ui.raw|as_json|safe }}');
  342. </script>
  343. <script src="{% static "jazzmin/js/ui-builder.js" %}"></script>
  344. {% endif %}
  345. {% block extrajs %}{% endblock %}
  346. </body>
  347. </html>