update_module.html 7.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139
  1. {% extends "admin/base_site.html" %}
  2. {% load i18n jet_tags static %}
  3. {% block extrahead %}
  4. {{ block.super }}
  5. <script type="text/javascript" src="{% static "admin/js/jquery.js" %}"></script>
  6. <script type="text/javascript" src="{% static "admin/js/jquery.init.js" %}"></script>
  7. <script type="text/javascript" src="{% static "admin/js/inlines.js" %}"></script>
  8. {% endblock %}
  9. {% if not is_popup %}
  10. {% block breadcrumbs %}
  11. <div class="breadcrumbs">
  12. <a href="{% url 'admin:index' %}">{% trans 'Home' %}</a>
  13. {% if app %}
  14. &rsaquo; <a href="{{ app.app_url }}">{% if app.name != app.app_label|capfirst|escape %}{{ app.name }}{% else %}{% trans app.app_label as app_label %}{{ app_label|capfirst|escape }}{% endif %}</a>
  15. {% endif %}
  16. &rsaquo; {{ object.title|capfirst }}
  17. </div>
  18. {% endblock %}
  19. {% endif %}
  20. {% block content %}
  21. <form action="" method="POST">
  22. <div class="changeform">
  23. {% csrf_token %}
  24. {{ form.media }}
  25. {{ settings_form.media }}
  26. {{ children_formset.media }}
  27. <ul class="changeform-tabs">
  28. <li class="changeform-tabs-item selected{% if form.errors or settings_form.errors %} errors{% endif %}">
  29. <a href="#" class="changeform-tabs-item-link" data-module-id="module_0">
  30. {% trans "General" %}
  31. </a>
  32. </li>
  33. {% if children_formset %}
  34. {% formset_has_errors children_formset as errors %}
  35. <li class="changeform-tabs-item{% if errors %} errors{% endif %}">
  36. <a href="#" class="changeform-tabs-item-link" data-module-id="module_1">
  37. {{ child_name_plural }}
  38. </a>
  39. </li>
  40. {% endif %}
  41. </ul>
  42. <div class="module selected" id="module_0">
  43. {{ form.non_field_errors }}
  44. {{ settings_form.non_field_errors }}
  45. {% if form.errors or settings_form.errors %}
  46. <fieldset class="module aligned">
  47. <p class="errornote">
  48. {% trans "Please correct the errors below." %}
  49. </p>
  50. </fieldset>
  51. {% endif %}
  52. {% include "jet.dashboard/update_module_fieldset.html" with form=form %}
  53. {% if settings_form %}
  54. {% include "jet.dashboard/update_module_fieldset.html" with form=settings_form %}
  55. {% endif %}
  56. </div>
  57. {% if children_formset %}
  58. <div class="module" id="module_1">
  59. <div class="inline-group">
  60. {{ children_formset.management_form }}
  61. {{ children_formset.non_form_errors }}
  62. <div class="stacked-inline side cf">
  63. <div class="stacked-inline-side">
  64. <div class="stacked-inline-side-top"></div>
  65. <ul class="stacked-inline-list">
  66. {% for form in children_formset %}
  67. <li class="stacked-inline-list-item{% if forloop.first %} selected{% endif %}{% if form.errors %} errors{% endif %}">
  68. <a href="#" class="stacked-inline-list-item-link" data-inline-related-id="{{ children_formset.prefix }}-{{ forloop.counter0 }}">
  69. {% if not form.initial %}
  70. <span class="icon-new"></span>
  71. {% endif %}
  72. <b>{{ child_name }}:</b>&nbsp;
  73. <span class="inline_label">
  74. #{{ forloop.counter }}
  75. </span>
  76. </a>
  77. </li>
  78. {% endfor %}
  79. <li class="stacked-inline-list-item empty">
  80. <a href="#" class="stacked-inline-list-item-link" data-inline-related-id="{{ children_formset.prefix }}-empty">
  81. <span class="icon-new"></span>
  82. <b>{{ child_name }}:</b>&nbsp;
  83. <span class="inline_label">
  84. #{{ children_formset|length }}
  85. </span>
  86. </a>
  87. </li>
  88. </ul>
  89. <div class="stacked-inline-side-bottom"></div>
  90. </div>
  91. <div class="stacked-inline-content">
  92. {% for form in children_formset %}
  93. <div class="stacked {% if forloop.first %}selected {% endif %}inline-related {% if forloop.last %} last-related{% endif %}" id="{{ children_formset.prefix }}-{{ forloop.counter0 }}">
  94. {% if form.non_field_errors %}{{ form.non_field_errors }}{% endif %}
  95. {% include "jet.dashboard/update_module_fieldset.html" with form=form %}
  96. </div>
  97. {% endfor %}
  98. {% with form=children_formset.empty_form %}
  99. <div class="stacked inline-related empty-form last-related" id="{{ children_formset.prefix }}-empty">
  100. {% if form.non_field_errors %}{{ form.non_field_errors }}{% endif %}
  101. {% include "jet.dashboard/update_module_fieldset.html" with form=form %}
  102. </div>
  103. {% endwith %}
  104. </div>
  105. </div>
  106. </div>
  107. </div>
  108. <script type="text/javascript">
  109. (function($) {
  110. $("#module_1 .inline-related").stackedFormset({
  111. prefix: '{{ children_formset.prefix }}',
  112. adminStaticPrefix: '{% static "admin/" %}',
  113. deleteText: "{% trans "Remove" %}",
  114. addText: "<span class=\"icon-add\"></span> {% blocktrans with verbose_name=child_name|capfirst %}Add another {{ verbose_name }}{% endblocktrans %}"
  115. });
  116. })(django.jQuery);
  117. </script>
  118. {% endif %}
  119. <div class="submit-row">
  120. <input type="submit" value="{% trans 'Save' %}" class="default" name="_save" />
  121. </div>
  122. </div>
  123. </form>
  124. {% endblock %}