base.html 15 KB

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