base.html 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314
  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-label">
  66. <span class="sidebar-link-icon icon-data"></span>
  67. {% trans 'Home' %}
  68. </span>
  69. </a>
  70. </div>
  71. {% endif %}
  72. {% if site_url %}
  73. <div>
  74. <a href="{{ site_url }}" class="sidebar-link icon">
  75. <span class="sidebar-link-label">
  76. <span class="sidebar-link-icon icon-open-external"></span>
  77. {% trans 'View site' %}
  78. </span>
  79. </a>
  80. </div>
  81. {% endif %}
  82. {% url 'django-admindocs-docroot' as docsroot %}
  83. {% if docsroot %}
  84. <div>
  85. <a href="{{ docsroot }}" class="sidebar-link icon">
  86. <span class="sidebar-link-label">
  87. <span class="sidebar-link-icon icon-book"></span>
  88. {% trans 'Documentation' %}
  89. </span>
  90. </a>
  91. </div>
  92. {% endif %}
  93. {% block nav-global %}{% endblock %}
  94. </div>
  95. {% if user.is_active and user.is_staff %}
  96. {% get_menu as app_list %}
  97. {% if app_list.apps or app_list.pinned_apps %}
  98. {% if SIDE_MENU_COMPACT %}
  99. {% for app in app_list.all_apps %}
  100. <div class="sidebar-section">
  101. <div class="sidebar-title">
  102. <a href="{{ app.app_url }}" class="sidebar-title-link">
  103. {% if app.name != app.app_label|capfirst|escape %}
  104. {{ app.name }}
  105. {% else %}
  106. {% trans app.app_label as app_label %}{{ app_label|capfirst|escape }}
  107. {% endif %}
  108. </a>
  109. </div>
  110. {% for model in app.models %}
  111. {% if model.admin_url %}
  112. <div>
  113. <a href="{{ model.admin_url }}" class="sidebar-link">
  114. <span class="sidebar-right">
  115. <span class="sidebar-right-arrow icon-arrow-right"></span>
  116. </span>
  117. <span class="sidebar-link-label">{{ model.name }}</span>
  118. </a>
  119. </div>
  120. {% endif %}
  121. {% endfor %}
  122. </div>
  123. {% endfor %}
  124. {% else %}
  125. <form action="{% url "jet:toggle_application_pin" %}" method="POST" id="toggle-application-pin-form">
  126. {% csrf_token %}
  127. <input type="hidden" name="app_label">
  128. </form>
  129. <div class="sidebar-section">
  130. <div class="sidebar-title">
  131. <span class="sidebar-right">
  132. <a href="#" class="sidebar-right-edit edit-apps-list"><span class="icon-settings"></span></a>
  133. </span>
  134. {% trans 'Applications' %}
  135. </div>
  136. <div class="apps-list-pinned">
  137. {% for app in app_list.pinned_apps %}
  138. <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 }}">
  139. <span class="sidebar-left collapsible">
  140. <span class="sidebar-left-pin icon-star pin-toggle"></span>
  141. <span class="sidebar-left-unpin icon-cross pin-toggle"></span>
  142. </span>
  143. <span class="sidebar-right">
  144. <span class="sidebar-right-arrow icon-arrow-right"></span>
  145. </span>
  146. <span class="sidebar-link-label">
  147. {% if app.name != app.app_label|capfirst|escape %}
  148. {{ app.name }}
  149. {% else %}
  150. {% trans app.app_label as app_label %}{{ app_label|capfirst|escape }}
  151. {% endif %}
  152. </span>
  153. </a>
  154. {% endfor %}
  155. </div>
  156. <a href="#" class="sidebar-center-link apps-hide">
  157. <span class="apps-hide-label apps-visible">{% trans "Hide applications" %}</span>
  158. <span class="apps-hide-label apps-hidden">{% trans "Show hidden" %}</span>
  159. </a>
  160. <div class="apps-list">
  161. {% for app in app_list.apps %}
  162. <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 }}">
  163. <span class="sidebar-left collapsible">
  164. <span class="sidebar-left-pin icon-star pin-toggle"></span>
  165. <span class="sidebar-left-unpin icon-cross pin-toggle"></span>
  166. </span>
  167. <span class="sidebar-right">
  168. <span class="sidebar-right-arrow icon-arrow-right"></span>
  169. </span>
  170. <span class="sidebar-link-label">
  171. {% if app.name != app.app_label|capfirst|escape %}
  172. {{ app.name }}
  173. {% else %}
  174. {% trans app.app_label as app_label %}{{ app_label|capfirst|escape }}
  175. {% endif %}
  176. </span>
  177. </a>
  178. {% endfor %}
  179. </div>
  180. </div>
  181. {% endif %}
  182. {% endif %}
  183. <div class="sidebar-section">
  184. <div class="dialog-confirm" id="bookmarks-add-dialog" title="{% trans "Add bookmark" %}">
  185. <form action="{% url "jet:add_bookmark" %}" method="POST" id="bookmarks-add-form">
  186. {% csrf_token %}
  187. <p>{% trans "Title" %}:</p>
  188. <input type="text" name="title" class="fill_width">
  189. <p>{% trans "URL" %}:</p>
  190. <input type="text" name="url" class="fill_width">
  191. </form>
  192. </div>
  193. <form action="{% url "jet:remove_bookmark" %}" method="POST" id="bookmarks-remove-form">
  194. {% csrf_token %}
  195. <input type="hidden" name="id">
  196. </form>
  197. <div class="dialog-confirm" id="bookmarks-remove-dialog" title="{% trans "Delete bookmark" %}">
  198. <p>{% trans "Are you sure want to delete this bookmark?" %}</p>
  199. </div>
  200. <div class="sidebar-title">
  201. <span class="sidebar-right">
  202. <a href="#" class="sidebar-right-plus bookmarks-add" title="{% trans "Add bookmark" %}"{% if title %} data-title="{{ title }}"{% endif %}><span class="icon-add"></span></a>
  203. </span>
  204. {% trans 'bookmarks' %}
  205. </div>
  206. <div class="bookmarks-list">
  207. {% get_bookmarks user as bookmarks %}
  208. {% for bookmark in bookmarks %}
  209. <a href="{{ bookmark.url }}" class="sidebar-link bookmark-item">
  210. <span class="sidebar-right collapsible">
  211. <span class="sidebar-right-remove bookmarks-remove" data-bookmark-id="{{ bookmark.pk }}">{% trans "Remove" %}</span>
  212. </span>
  213. <span class="sidebar-link-label">{{ bookmark.title }}</span>
  214. </a>
  215. {% endfor %}
  216. <a class="sidebar-link bookmark-item clone">
  217. <span class="sidebar-right collapsible">
  218. <span class="sidebar-right-remove bookmarks-remove">{% trans "Remove" %}</span>
  219. <span class="sidebar-link-label"></span>
  220. </span>
  221. </a>
  222. </div>
  223. </div>
  224. {% endif %}
  225. </div>
  226. <div class="sidebar-copyright">powered by DJANGO JET</div>
  227. {% if app_list and not SIDE_MENU_COMPACT %}
  228. <div class="sidebar-popup-container">
  229. <div class="sidebar-popup">
  230. <a href="#" class="sidebar-close popup sidebar-back">
  231. <span class="sidebar-close-icon icon-arrow-left"></span>
  232. </a>
  233. {% for app in app_list.apps|add:app_list.pinned_apps %}
  234. <div class="sidebar-popup-section sidebar-popup-section-{{ app.app_label }}">
  235. <div class="sidebar-popup-title">
  236. {% if app.name != app.app_label|capfirst|escape %}
  237. {{ app.name }}
  238. {% else %}
  239. {% trans app.app_label as app_label %}{{ app_label|capfirst|escape }}
  240. {% endif %}
  241. </div>
  242. <input class="sidebar-popup-search" placeholder="Search...">
  243. <ul class="sidebar-popup-list">
  244. <li class="sidebar-popup-list-item app-{{ app.app_label }}{{ app.current|yesno:" current," }}">
  245. <a href="{{ app.app_url }}" class="sidebar-popup-list-item-link">{% trans 'Application page' %}</a>
  246. </li>
  247. {% for model in app.models %}
  248. <li class="sidebar-popup-list-item model-{{ model.object_name|lower }}{{ model.current|yesno:" current," }}">
  249. {% if model.admin_url %}
  250. <a href="{{ model.admin_url }}" class="sidebar-popup-list-item-link">{{ model.name }}</a>
  251. {% else %}
  252. {{ model.name }}
  253. {% endif %}
  254. </li>
  255. {% endfor %}
  256. </ul>
  257. </div>
  258. {% endfor %}
  259. </div>
  260. </div>
  261. {% endif %}
  262. </div>
  263. {% endif %}
  264. {% get_themes as THEMES %}
  265. {% if THEMES %}
  266. {% get_current_theme as THEME %}
  267. {% get_current_jet_version as JET_VERSION %}
  268. <li class="user-tools-contrast-block theme-chooser">
  269. <div class="user-tools-contrast-block-title">{% trans "current theme" %}</div>
  270. <div class="user-tools-theme-link-container">
  271. {% spaceless %}
  272. {% for conf_theme in THEMES %}
  273. {% if conf_theme.theme %}
  274. <a href="#"
  275. class="user-tools-theme-link choose-theme{% if conf_theme.theme == THEME %} selected{% endif %}"
  276. data-theme="{{ conf_theme.theme }}"
  277. data-base-stylesheet="{% static "jet/css/themes/"|add:conf_theme.theme|add:"/base.css" %}?v={{ JET_VERSION }}"
  278. data-select2-stylesheet="{% static "jet/css/themes/"|add:conf_theme.theme|add:"/select2.theme.css" %}?v={{ JET_VERSION }}"
  279. data-jquery-ui-stylesheet="{% static "jet/css/themes/"|add:conf_theme.theme|add:"/jquery-ui.theme.css" %}?v={{ JET_VERSION }}"
  280. {% if conf_theme.title %} title="{{ conf_theme.title }}"{% endif %}
  281. style="background-color: {{ conf_theme.color|default:"white" }};"
  282. ></a>
  283. {% endif %}
  284. {% endfor %}
  285. {% endspaceless %}
  286. </div>
  287. </li>
  288. {% endif %}
  289. {% endblock %}