base.html 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307
  1. {% extends "admin/original_base.html" %}
  2. {% load i18n static jet_tags %}
  3. {% block extrastyle %}
  4. {{ block.super }}
  5. {% get_current_theme as THEME %}
  6. {% get_current_jet_version as JET_VERSION %}
  7. <link rel="stylesheet" type="text/css" href="{% static "jet/css/vendor.css" %}?v={{ JET_VERSION }}" />
  8. <link rel="stylesheet" type="text/css" href="{% static "jet/css/icons/style.css" %}?v={{ JET_VERSION }}" />
  9. <link rel="stylesheet" type="text/css" href="{% static "jet/css/themes/"|add:THEME|add:"/base.css" %}?v={{ JET_VERSION }}" class="base-stylesheet" />
  10. <link rel="stylesheet" type="text/css" href="{% static "jet/css/themes/"|add:THEME|add:"/select2.theme.css" %}?v={{ JET_VERSION }}" class="select2-stylesheet" />
  11. <link rel="stylesheet" type="text/css" href="{% static "jet/css/themes/"|add:THEME|add:"/jquery-ui.theme.css" %}?v={{ JET_VERSION }}" class="jquery-ui-stylesheet" />
  12. {% endblock %}
  13. {% block extrahead %}
  14. {{ block.super }}
  15. <script type="text/javascript" charset="utf-8">
  16. var DATE_FORMAT = "{% get_date_format %}";
  17. var TIME_FORMAT = "{% get_time_format %}";
  18. var DATETIME_FORMAT = "{% get_datetime_format %}";
  19. </script>
  20. <script src="{% static "jet/js/build/bundle.min.js" %}"></script>
  21. {% jet_static_translation_urls as translation_urls %}
  22. {% for url in translation_urls %}
  23. <script src="{% static url %}"></script>
  24. {% endfor %}
  25. <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no, minimal-ui">
  26. {% endblock %}
  27. {% block footer %}
  28. {{ block.super }}
  29. {% jet_delete_confirmation_context %}
  30. {% jet_change_form_sibling_links_enabled as show_siblings %}
  31. {% if change and show_siblings %}
  32. <div class="changeform-navigation">
  33. {% spaceless %}
  34. {% jet_previous_object_url as url %}
  35. <a{% if url %} href="{{ url }}"{% endif %} class="segmented-button left{% if not url %} disabled{% endif %}">
  36. <span class="changeform-navigation-button icon-arrow-left"></span>
  37. </a>
  38. {% jet_next_object_url as url %}
  39. <a{% if url %} href="{{ url }}"{% endif %} class="segmented-button right{% if not url %} disabled{% endif %}">
  40. <span class="changeform-navigation-button icon-arrow-right"></span>
  41. </a>
  42. {% endspaceless %}
  43. </div>
  44. {% endif %}
  45. {% get_side_menu_compact as SIDE_MENU_COMPACT %}
  46. {% if not is_popup %}
  47. <div class="related-popup-container scrollable">
  48. <a href="#" class="related-popup-back"><span class="related-popup-back-icon icon-arrow-left"></span> <span class="related-popup-back-label">{% trans "back" %}</span></a>
  49. <span class="icon-refresh loading-indicator"></span>
  50. </div>
  51. <div class="sidebar-header sidebar-dependent">
  52. <a href="#" class="sidebar-header-menu sidebar-toggle">
  53. <span class="sidebar-header-menu-icon icon-menu"></span>
  54. </a>
  55. </div>
  56. <div class="sidebar sidebar-dependent">
  57. <div class="sidebar-wrapper scrollable">
  58. <a href="#" class="sidebar-close sidebar-toggle">
  59. <span class="sidebar-close-icon icon-arrow-left"></span>
  60. </a>
  61. <div class="sidebar-section">
  62. {% if user.is_active and user.is_staff %}
  63. <div>
  64. <a href="{% url 'admin:index' %}" class="sidebar-link icon">
  65. <span class="sidebar-link-icon icon-data"></span>
  66. <span class="sidebar-link-label">{% trans 'Home' %}</span>
  67. </a>
  68. </div>
  69. {% endif %}
  70. {% if site_url %}
  71. <div>
  72. <a href="{{ site_url }}" class="sidebar-link icon">
  73. <span class="sidebar-link-icon icon-open-external"></span>
  74. <span class="sidebar-link-label">{% trans 'View site' %}</span>
  75. </a>
  76. </div>
  77. {% endif %}
  78. {% url 'django-admindocs-docroot' as docsroot %}
  79. {% if docsroot %}
  80. <div>
  81. <a href="{{ docsroot }}" class="sidebar-link icon">
  82. <span class="sidebar-link-icon icon-book"></span>
  83. <span class="sidebar-link-label">{% trans 'Documentation' %}</span>
  84. </a>
  85. </div>
  86. {% endif %}
  87. {% block nav-global %}{% endblock %}
  88. </div>
  89. {% if user.is_active and user.is_staff %}
  90. {% get_menu as app_list %}
  91. {% if app_list.apps or app_list.pinned_apps %}
  92. {% if SIDE_MENU_COMPACT %}
  93. {% for app in app_list.all_apps %}
  94. <div class="sidebar-section">
  95. <div class="sidebar-title">
  96. <a href="{{ app.app_url }}" class="sidebar-title-link">
  97. {% if app.name != app.app_label|capfirst|escape %}
  98. {{ app.name }}
  99. {% else %}
  100. {% trans app.app_label as app_label %}{{ app_label|capfirst|escape }}
  101. {% endif %}
  102. </a>
  103. </div>
  104. {% for model in app.models %}
  105. {% if model.admin_url %}
  106. <div>
  107. <a href="{{ model.admin_url }}" class="sidebar-link">
  108. <span class="sidebar-right">
  109. <span class="sidebar-right-arrow icon-arrow-right"></span>
  110. </span>
  111. {{ model.name }}
  112. </a>
  113. </div>
  114. {% endif %}
  115. {% endfor %}
  116. </div>
  117. {% endfor %}
  118. {% else %}
  119. <form action="{% url "jet:toggle_application_pin" %}" method="POST" id="toggle-application-pin-form">
  120. {% csrf_token %}
  121. <input type="hidden" name="app_label">
  122. </form>
  123. <div class="sidebar-section">
  124. <div class="sidebar-title">
  125. <span class="sidebar-right">
  126. <a href="#" class="sidebar-right-edit edit-apps-list"><span class="icon-settings"></span></a>
  127. </span>
  128. {% trans 'Applications' %}
  129. </div>
  130. <div class="apps-list-pinned">
  131. {% for app in app_list.pinned_apps %}
  132. <a href="{{ app.app_url }}" class="sidebar-link popup-section-link app-item" data-app-label="{{ app.app_label }}" data-popup-section-class="sidebar-popup-section-{{ app.app_label }}">
  133. <span class="sidebar-left collapsible">
  134. <span class="sidebar-left-pin icon-star pin-toggle"></span>
  135. <span class="sidebar-left-unpin icon-cross pin-toggle"></span>
  136. </span>
  137. <span class="sidebar-right">
  138. <span class="sidebar-right-arrow icon-arrow-right"></span>
  139. </span>
  140. <span class="sidebar-link-label">
  141. {% if app.name != app.app_label|capfirst|escape %}
  142. {{ app.name }}
  143. {% else %}
  144. {% trans app.app_label as app_label %}{{ app_label|capfirst|escape }}
  145. {% endif %}
  146. </span>
  147. </a>
  148. {% endfor %}
  149. </div>
  150. <a href="#" class="sidebar-center-link apps-hide">
  151. <span class="apps-hide-label apps-visible">{% trans "Hide applications" %}</span>
  152. <span class="apps-hide-label apps-hidden">{% trans "Show hidden" %}</span>
  153. </a>
  154. <div class="apps-list">
  155. {% for app in app_list.apps %}
  156. <a href="{{ app.app_url }}" class="sidebar-link popup-section-link app-item" data-app-label="{{ app.app_label }}" data-popup-section-class="sidebar-popup-section-{{ app.app_label }}">
  157. <span class="sidebar-left collapsible">
  158. <span class="sidebar-left-pin icon-star pin-toggle"></span>
  159. <span class="sidebar-left-unpin icon-cross pin-toggle"></span>
  160. </span>
  161. <span class="sidebar-right">
  162. <span class="sidebar-right-arrow icon-arrow-right"></span>
  163. </span>
  164. <span class="sidebar-link-label">
  165. {% if app.name != app.app_label|capfirst|escape %}
  166. {{ app.name }}
  167. {% else %}
  168. {% trans app.app_label as app_label %}{{ app_label|capfirst|escape }}
  169. {% endif %}
  170. </span>
  171. </a>
  172. {% endfor %}
  173. </div>
  174. </div>
  175. {% endif %}
  176. {% endif %}
  177. <div class="sidebar-section">
  178. <div class="dialog-confirm" id="bookmarks-add-dialog" title="{% trans "Add bookmark" %}">
  179. <form action="{% url "jet:add_bookmark" %}" method="POST" id="bookmarks-add-form">
  180. {% csrf_token %}
  181. <p>{% trans "Title" %}:</p>
  182. <input type="text" name="title" class="fill_width">
  183. <p>{% trans "URL" %}:</p>
  184. <input type="text" name="url" class="fill_width">
  185. </form>
  186. </div>
  187. <form action="{% url "jet:remove_bookmark" %}" method="POST" id="bookmarks-remove-form">
  188. {% csrf_token %}
  189. <input type="hidden" name="id">
  190. </form>
  191. <div class="dialog-confirm" id="bookmarks-remove-dialog" title="{% trans "Delete bookmark" %}">
  192. <p>{% trans "Are you sure want to delete this bookmark?" %}</p>
  193. </div>
  194. <div class="sidebar-title">
  195. <span class="sidebar-right">
  196. <a href="#" class="sidebar-right-plus bookmarks-add" title="{% trans "Add bookmark" %}"{% if title %} data-title="{{ title }}"{% endif %}><span class="icon-add"></span></a>
  197. </span>
  198. {% trans 'bookmarks' %}
  199. </div>
  200. <div class="bookmarks-list">
  201. {% get_bookmarks user as bookmarks %}
  202. {% for bookmark in bookmarks %}
  203. <a href="{{ bookmark.url }}" class="sidebar-link bookmark-item">
  204. <span class="sidebar-right collapsible">
  205. <span class="sidebar-right-remove bookmarks-remove" data-bookmark-id="{{ bookmark.pk }}">{% trans "Remove" %}</span>
  206. </span>
  207. {{ bookmark.title }}
  208. </a>
  209. {% endfor %}
  210. <a class="sidebar-link bookmark-item clone">
  211. <span class="sidebar-right collapsible">
  212. <span class="sidebar-right-remove bookmarks-remove">{% trans "Remove" %}</span>
  213. </span>
  214. </a>
  215. </div>
  216. </div>
  217. {% endif %}
  218. </div>
  219. <div class="sidebar-copyright">powered by DJANGO JET</div>
  220. {% if app_list and not SIDE_MENU_COMPACT %}
  221. <div class="sidebar-popup-container">
  222. <div class="sidebar-popup">
  223. <a href="#" class="sidebar-close popup sidebar-back">
  224. <span class="sidebar-close-icon icon-arrow-left"></span>
  225. </a>
  226. {% for app in app_list.apps|add:app_list.pinned_apps %}
  227. <div class="sidebar-popup-section sidebar-popup-section-{{ app.app_label }}">
  228. <div class="sidebar-popup-title">
  229. {% if app.name != app.app_label|capfirst|escape %}
  230. {{ app.name }}
  231. {% else %}
  232. {% trans app.app_label as app_label %}{{ app_label|capfirst|escape }}
  233. {% endif %}
  234. </div>
  235. <input class="sidebar-popup-search" placeholder="Search...">
  236. <ul class="sidebar-popup-list">
  237. <li class="sidebar-popup-list-item app-{{ app.app_label }}{{ app.current|yesno:" current," }}">
  238. <a href="{{ app.app_url }}" class="sidebar-popup-list-item-link">{% trans 'Application page' %}</a>
  239. </li>
  240. {% for model in app.models %}
  241. <li class="sidebar-popup-list-item model-{{ model.object_name|lower }}{{ model.current|yesno:" current," }}">
  242. {% if model.admin_url %}
  243. <a href="{{ model.admin_url }}" class="sidebar-popup-list-item-link">{{ model.name }}</a>
  244. {% else %}
  245. {{ model.name }}
  246. {% endif %}
  247. </li>
  248. {% endfor %}
  249. </ul>
  250. </div>
  251. {% endfor %}
  252. </div>
  253. </div>
  254. {% endif %}
  255. </div>
  256. {% endif %}
  257. {% get_themes as THEMES %}
  258. {% if THEMES %}
  259. {% get_current_theme as THEME %}
  260. {% get_current_jet_version as JET_VERSION %}
  261. <li class="user-tools-contrast-block theme-chooser">
  262. <div class="user-tools-contrast-block-title">{% trans "current theme" %}</div>
  263. <div class="user-tools-theme-link-container">
  264. {% spaceless %}
  265. {% for conf_theme in THEMES %}
  266. {% if conf_theme.theme %}
  267. <a href="#"
  268. class="user-tools-theme-link choose-theme{% if conf_theme.theme == THEME %} selected{% endif %}"
  269. data-theme="{{ conf_theme.theme }}"
  270. data-base-stylesheet="{% static "jet/css/themes/"|add:conf_theme.theme|add:"/base.css" %}?v={{ JET_VERSION }}"
  271. data-select2-stylesheet="{% static "jet/css/themes/"|add:conf_theme.theme|add:"/select2.theme.css" %}?v={{ JET_VERSION }}"
  272. data-jquery-ui-stylesheet="{% static "jet/css/themes/"|add:conf_theme.theme|add:"/jquery-ui.theme.css" %}?v={{ JET_VERSION }}"
  273. {% if conf_theme.title %} title="{{ conf_theme.title }}"{% endif %}
  274. style="background-color: {{ conf_theme.color|default:"white" }};"
  275. ></a>
  276. {% endif %}
  277. {% endfor %}
  278. {% endspaceless %}
  279. </div>
  280. </li>
  281. {% endif %}
  282. {% endblock %}