private_index.html 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127
  1. {% extends "admin/base_site.html" %}
  2. {% load i18n admin_urls static admin_list %}
  3. {% load core_tags %}
  4. {% block extrastyle %}
  5. {{ block.super }}
  6. <link rel="stylesheet" type="text/css" href="{% static "admin/css/changelists.css" %}">
  7. {% if cl.formset %}
  8. <link rel="stylesheet" type="text/css" href="{% static "admin/css/forms.css" %}">
  9. {% endif %}
  10. {% if cl.formset or action_form %}
  11. <script src="{% url 'admin:jsi18n' %}"></script>
  12. {% endif %}
  13. {{ media.css }}
  14. {% if not actions_on_top and not actions_on_bottom %}
  15. <style>
  16. #changelist table thead th:first-child {width: inherit}
  17. </style>
  18. {% endif %}
  19. {% endblock %}
  20. {% block extrahead %}
  21. {{ block.super }}
  22. {{ media.js }}
  23. {% endblock %}
  24. {% block bodyclass %}{{ block.super }} app-{{ opts.app_label }} model-{{ opts.model_name }} change-list{% endblock %}
  25. {% if not is_popup %}
  26. {% block breadcrumbs %}
  27. <div class="breadcrumbs">
  28. <a href="{% url 'admin:index' %}">{% translate 'Home' %}</a>
  29. &rsaquo; <a href="{% url 'admin:app_list' app_label=cl.opts.app_label %}">{{ cl.opts.app_config.verbose_name }}</a>
  30. &rsaquo; {{ cl.opts.verbose_name_plural|capfirst }}
  31. </div>
  32. {% endblock %}
  33. {% endif %}
  34. {% block coltype %}{% endblock %}
  35. {% block content %}
  36. <div id="content-main">
  37. {% block object-tools %}
  38. <ul class="object-tools">
  39. {% block object-tools-items %}
  40. {% change_list_object_tools %}
  41. {% endblock %}
  42. </ul>
  43. {% endblock %}
  44. {% if cl.formset and cl.formset.errors %}
  45. <p class="errornote">
  46. {% if cl.formset.total_error_count == 1 %}{% translate "Please correct the error below." %}{% else %}{% translate "Please correct the errors below." %}{% endif %}
  47. </p>
  48. {{ cl.formset.non_form_errors }}
  49. {% endif %}
  50. <div class="module{% if cl.has_filters %} filtered{% endif %}" id="changelist">
  51. <div class="changelist-form-container">
  52. {% block search %}{% search_form cl %}{% endblock %}
  53. {% block date_hierarchy %}{% if cl.date_hierarchy %}{% date_hierarchy cl %}{% endif %}{% endblock %}
  54. <form id="changelist-form" method="post"{% if cl.formset and cl.formset.is_multipart %} enctype="multipart/form-data"{% endif %} novalidate>{% csrf_token %}
  55. {% if cl.formset %}
  56. <div>{{ cl.formset.management_form }}</div>
  57. {% endif %}
  58. {% block result_list %}
  59. {% if action_form and actions_on_top and cl.show_admin_actions %}{% admin_actions %}{% endif %}
  60. {% comment %}
  61. Table grid
  62. {% result_list cl %}
  63. {% endcomment %}
  64. {% snapshots_grid cl %}
  65. {% if action_form and actions_on_bottom and cl.show_admin_actions %}{% admin_actions %}{% endif %}
  66. {% endblock %}
  67. {% block pagination %}{% pagination cl %}{% endblock %}
  68. </form>
  69. </div>
  70. {% block filters %}
  71. {% if cl.has_filters %}
  72. <div id="changelist-filter">
  73. <h2>
  74. {% translate 'Filter' %}
  75. <button
  76. type="button"
  77. id="changelist-filter-toggle"
  78. class="filter-toggle"
  79. aria-expanded="true"
  80. data-show-label="{% translate 'Filters' %}"
  81. data-hide-label="{% translate 'Hide' %}"
  82. >
  83. {% translate 'Hide' %}
  84. </button>
  85. </h2>
  86. {% if cl.has_active_filters %}<h3 id="changelist-filter-clear">
  87. <a href="{{ cl.clear_all_filters_qs }}">&#10006; {% translate "Clear all filters" %}</a>
  88. </h3>{% endif %}
  89. {% for spec in cl.filter_specs %}{% admin_list_filter cl spec %}{% endfor %}
  90. </div>
  91. {% endif %}
  92. {% endblock %}
  93. </div>
  94. </div>
  95. {% if cl.has_filters %}
  96. <script>
  97. (function() {
  98. var storageKey = 'admin-filters-collapsed';
  99. var toggle = document.getElementById('changelist-filter-toggle');
  100. if (!toggle) return;
  101. function applyState() {
  102. var collapsed = localStorage.getItem(storageKey) === 'true';
  103. document.body.classList.toggle('filters-collapsed', collapsed);
  104. toggle.textContent = collapsed ? toggle.dataset.showLabel : toggle.dataset.hideLabel;
  105. toggle.setAttribute('aria-expanded', collapsed ? 'false' : 'true');
  106. }
  107. toggle.addEventListener('click', function() {
  108. var collapsed = !document.body.classList.contains('filters-collapsed');
  109. localStorage.setItem(storageKey, collapsed ? 'true' : 'false');
  110. applyState();
  111. });
  112. applyState();
  113. })();
  114. </script>
  115. {% endif %}
  116. {% endblock %}