base.html 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397
  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. <ul class="navbar-nav ml-auto">
  91. {% if jazzmin_settings.show_ui_builder %}
  92. <li class="nav-item">
  93. <a class="nav-link" data-widget="control-sidebar" data-slide="true" href="#" role="button">
  94. <i class="fas fa-th-large"></i>
  95. </a>
  96. </li>
  97. {% endif %}
  98. {% if 'django.contrib.admindocs'|app_is_installed %}
  99. <li class="nav-item">
  100. <a class="nav-link" href="{% url 'django-admindocs-docroot' %}" role="button">
  101. <i class="fas fa-book"></i>
  102. </a>
  103. </li>
  104. {% endif %}
  105. {% if jazzmin_settings.language_chooser %}
  106. {% get_available_languages as LANGUAGES %}
  107. {% get_language_info_list for LANGUAGES as languages %}
  108. <li class="nav-item dropdown">
  109. <a class="nav-link btn" data-toggle="dropdown" href="#" title="Choose language">
  110. <i class="fas fa-globe" aria-hidden="true"></i>
  111. </a>
  112. <div class="dropdown-menu dropdown-menu-lg dropdown-menu-left" id="jazzy-languagemenu">
  113. <form action="{% url 'set_language' %}" method="post">
  114. {% csrf_token %}
  115. <input name="next" type="hidden" value="{{ request.get_full_path|remove_lang:LANGUAGE_CODE }}" />
  116. {% for language in languages %}
  117. <button
  118. type="submit"
  119. name="language"
  120. value="{{ language.code }}"
  121. class="dropdown-item {% if language.code == LANGUAGE_CODE %}active{% endif %}"
  122. lang="{{ language.code }}"
  123. >
  124. {{ language.name_local|title }}
  125. </button>
  126. {% endfor %}
  127. </form>
  128. </div>
  129. </li>
  130. {% endif %}
  131. <li class="nav-item dropdown">
  132. <a class="nav-link btn" data-toggle="dropdown" href="#" title="{{ request.user }}">
  133. <i class="far fa-user" aria-hidden="true"></i>
  134. </a>
  135. <div class="dropdown-menu dropdown-menu-lg dropdown-menu-left" id="jazzy-usermenu">
  136. <span class="dropdown-header">{% trans 'Account' %}</span>
  137. <div class="dropdown-divider"></div>
  138. <a href="{% url 'admin:password_change' %}" class="dropdown-item">
  139. <i class="fas fa-key mr-2"></i> {% trans 'Change password' %}
  140. </a>
  141. <div class="dropdown-divider"></div>
  142. <a href="{% url 'admin:logout' %}" class="dropdown-item">
  143. <i class="fas fa-users mr-2"></i> {% trans 'Log out' %}
  144. </a>
  145. {% get_user_menu user request.current_app|default:"admin" as user_menu %}
  146. {% for link in user_menu %}
  147. <div class="dropdown-divider"></div>
  148. <a href="{{ link.url }}" class="dropdown-item" {% if link.new_window %}target="_blank"{% endif %}>
  149. <i class="{{ link.icon }} mr-2"></i> {% trans link.name %}
  150. </a>
  151. {% endfor %}
  152. <div class="dropdown-divider"></div>
  153. {% if perms|can_view_self %}
  154. <a href="{% jazzy_admin_url request.user request.current_app|default:"admin" %}" class="dropdown-item dropdown-footer">{% trans 'See Profile' %}</a>
  155. {% endif %}
  156. </div>
  157. </li>
  158. </ul>
  159. </nav>
  160. {% block sidebar %}
  161. {% if jazzmin_settings.show_sidebar %}
  162. {% get_side_menu as side_menu_list %}
  163. <aside class="main-sidebar elevation-4 {{ jazzmin_ui.sidebar_classes }}" id="jazzy-sidebar">
  164. <a href="{% url 'admin:index' %}" class="brand-link {{ jazzmin_ui.brand_classes }}" id="jazzy-logo">
  165. <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">
  166. <span class="brand-text font-weight-light">{{ jazzmin_settings.site_brand }}</span>
  167. </a>
  168. <div class="sidebar">
  169. <div class="user-panel mt-3 pb-3 mb-3 d-flex">
  170. <div class="image">
  171. {% if jazzmin_settings|has_jazzmin_setting:"user_avatar" %}
  172. <img src="{% get_user_avatar request.user %}" width="160px" class="img-circle elevation-2" alt="User Image">
  173. {% else %}
  174. <i class="fas fa-inverse user-profile fa-user-circle"></i>
  175. {% endif %}
  176. </div>
  177. <div class="info">
  178. {% if perms|can_view_self %}
  179. <a href="{% jazzy_admin_url request.user request.current_app|default:"admin" %}" class="d-block">{{ request.user }}</a>
  180. {% else %}
  181. <span class="d-block" style="color: white;">{{ request.user }}</span>
  182. {% endif %}
  183. </div>
  184. </div>
  185. <nav class="mt-2">
  186. <ul class="nav nav-pills nav-sidebar flex-column {{ jazzmin_ui.sidebar_list_classes }}" data-widget="treeview" role="menu" data-collapsible="false">
  187. <li class="nav-item">
  188. <a href="{% url 'admin:index' %}" class="nav-link">
  189. <i class="nav-icon fas fa-th-large"></i>
  190. <p>{% trans 'Dashboard' %}</p>
  191. </a>
  192. </li>
  193. {% if jazzmin_settings.navigation_expanded %}
  194. {% for app in side_menu_list %}
  195. <li class="nav-header">{{ app.name }}</li>
  196. {% for model in app.models %}
  197. <li class="nav-item">
  198. {% if model.url %}
  199. <a href="{{ model.url }}" class="nav-link">
  200. <i class="nav-icon {{ model.icon }}"></i> <p>{{ model.name }}</p>
  201. </a>
  202. {% else %}
  203. <span class="nav-link disabled">
  204. <i class="nav-icon {{ model.icon }}"></i> <p>{{ model.name }}</p>
  205. </span>
  206. {% endif %}
  207. </li>
  208. {% endfor %}
  209. {% endfor %}
  210. {% else %}
  211. {% for app in side_menu_list %}
  212. <li class="nav-item has-treeview">
  213. <a href="#" class="nav-link">
  214. <i class="nav-icon {{ app.icon }}"></i>
  215. <p>{{ app.name|truncatechars:21 }} <i class="fas fa-angle-left right"></i></p>
  216. </a>
  217. <ul class="nav nav-treeview" style="display: none;">
  218. {% for model in app.models %}
  219. <li class="nav-item">
  220. <a href="{% if model.url %}{{ model.url }}{% else %}javascript:void(0){% endif %}" class="nav-link">
  221. <i class="nav-icon {{ model.icon }}"></i>
  222. <p>{{ model.name }}</p>
  223. </a>
  224. </li>
  225. {% endfor %}
  226. </ul>
  227. </li>
  228. {% endfor %}
  229. {% endif %}
  230. </ul>
  231. </nav>
  232. </div>
  233. </aside>
  234. {% endif %}
  235. {% endblock %}
  236. {% endif %}
  237. <div class="content-wrapper" {% if is_popup %}style="margin-left:0px; padding-top: 20px;"{% endif %}>
  238. {% block page_content %}
  239. {% if not is_popup %}
  240. <div class="content border-bottom mb-2">
  241. <div class="container-fluid">
  242. <div class="row">
  243. <div class="col-12 col-md-auto d-flex flex-grow-1 align-items-center">
  244. <h1 class="h4 m-0 pr-3 mr-3 border-right">{% block content_title %}{% endblock %}</h1>
  245. {% block breadcrumbs %}{% endblock %}
  246. </div>
  247. {% block page_actions %}{% endblock %}
  248. </div>
  249. </div>
  250. </div>
  251. {% endif %}
  252. <div class="content">
  253. <div class="container-fluid">
  254. <section id="content" class="content">
  255. {% block messages %}
  256. {% for message in messages %}
  257. {% if message.tags == 'success' %}
  258. <div class="alert alert-success alert-dismissible">
  259. <button type="button" class="close" data-dismiss="alert" aria-hidden="true">×
  260. </button>
  261. <i class="icon fa fa-check"></i>{{ message|capfirst }}
  262. </div>
  263. {% elif message.tags == 'error' %}
  264. <div class="alert alert-danger alert-dismissible">
  265. <button type="button" class="close" data-dismiss="alert" aria-hidden="true">×
  266. </button>
  267. <i class="icon fa fa-ban"></i>{{ message|capfirst }}
  268. </div>
  269. {% elif message.tags == 'warning' %}
  270. <div class="alert alert-warning alert-dismissible">
  271. <button type="button" class="close" data-dismiss="alert" aria-hidden="true">×
  272. </button>
  273. <i class="icon fa fa-exclamation-triangle"></i>{{ message|capfirst }}
  274. </div>
  275. {% elif message.tags == 'info' %}
  276. <div class="alert alert-info alert-dismissible">
  277. <button type="button" class="close" data-dismiss="alert" aria-hidden="true">×
  278. </button>
  279. <i class="icon fa fa-info"></i>{{ message|capfirst }}
  280. </div>
  281. {% endif %}
  282. {% endfor %}
  283. {% endblock messages %}
  284. <div class="row">
  285. <div class="col-lg-9 col-12">
  286. <div class="row">
  287. <div class="col-md-6 col-sm-12">
  288. <div class="card text-center">
  289. <div class="card-header">
  290. <h5 class="m-0">Дополнительные настройки системы</h5>
  291. </div>
  292. <div class="card-body">
  293. {% block site-settings %}{% endblock %}
  294. </div>
  295. </div>
  296. </div>
  297. </div>
  298. </div>
  299. {% block content %} {% endblock %}
  300. </div>
  301. </section>
  302. </div>
  303. </div>
  304. {% endblock %}
  305. </div>
  306. {% block footer %}
  307. {% if not is_popup %}
  308. <footer class="main-footer {{ jazzmin_ui.footer_classes }}">
  309. <div class="float-right d-none d-sm-inline">
  310. <b>{% trans 'Jazzmin version' %}</b> {% get_jazzmin_version %}
  311. </div>
  312. {% autoescape off %}
  313. <strong>{% trans 'Copyright' %} &copy; {% now 'Y' %} {{ jazzmin_settings.copyright }}.</strong> {% trans 'All rights reserved.' %}
  314. {% endautoescape %}
  315. </footer>
  316. {% if jazzmin_settings.show_ui_builder %}
  317. {% include 'jazzmin/includes/ui_builder_panel.html' %}
  318. {% endif %}
  319. {% endif %}
  320. {% endblock %}
  321. </div>
  322. {% if jazzmin_settings.show_ui_builder %}
  323. <div id="codeBox" class="modal fade" role="dialog">
  324. <div class="modal-dialog">
  325. <div class="modal-content">
  326. <div class="modal-header">
  327. <h4 class="modal-title">{% trans 'UI Configuration' %}</h4>
  328. <button type="button" class="close" data-dismiss="modal">&times;</button>
  329. </div>
  330. <div class="modal-body">
  331. <p>{% trans 'Copy this info your settings file to persist these UI changes' %}</p>
  332. <pre><code></code></pre>
  333. </div>
  334. <div class="modal-footer">
  335. <button type="button" class="btn {{ jazzmin_ui.button_classes.danger }}" data-dismiss="modal">{% trans 'Close' %}</button>
  336. </div>
  337. </div>
  338. </div>
  339. </div>
  340. {% endif %}
  341. <!-- jQuery -->
  342. <script src="{% static "admin/js/vendor/jquery/jquery.js" %}"></script>
  343. <!-- Bootstrap 4 -->
  344. <script src="{% static "vendor/bootstrap/js/bootstrap.min.js" %}"></script>
  345. <!-- AdminLTE App -->
  346. <script src="{% static "vendor/adminlte/js/adminlte.min.js" %}"></script>
  347. <!-- Django customisations -->
  348. <script src="{% static "jazzmin/js/main.js" %}"></script>
  349. {% if jazzmin_settings.custom_js %}
  350. <script src="{% static jazzmin_settings.custom_js %}"></script>
  351. {% endif %}
  352. {% if jazzmin_settings.show_ui_builder %}
  353. <script>
  354. window.ui_changes = JSON.parse('{{ jazzmin_ui.raw|as_json|safe }}');
  355. </script>
  356. <script src="{% static "jazzmin/js/ui-builder.js" %}"></script>
  357. {% endif %}
  358. {% block extrajs %}{% endblock %}
  359. </body>
  360. </html>