Anonymous avatar Anonymous committed ef02a5a

[svn r78] templates for edit inlines - basically, refactored tabularinline

Comments (0)

Files changed (3)

templates/admin/change_form.html

 {{ media }}
 {% if inline_admin_formsets %}
 <script type="text/javascript" src="{% admin_media_prefix %}jquery/jquery-ui-inline.packed.js"></script>
-<script type="text/javascript" src="{% admin_media_prefix %}js/admin/StackedInline.js"></script>
-<script type="text/javascript" src="{% admin_media_prefix %}js/admin/TabularInline.js"></script>
+{# <script type="text/javascript" src="{% admin_media_prefix %}js/admin/StackedInline.js"></script> #}
+{# <script type="text/javascript" src="{% admin_media_prefix %}js/admin/TabularInline.js"></script> #}
+<script type="text/javascript" src="{% admin_media_prefix %}js/admin/Inline.js"></script>
 <script type="text/javascript" src="{% admin_media_prefix %}js/admin/CollapsedInlineFieldsets.js"></script>
 {% endif %}
 {% endblock %}
 {% block content %}<div id="content-main">
 {% block object-tools %}
 {% if change %}{% if not is_popup %}
-  <ul class="object-tools"><li><a href="history/" class="historylink">{% trans "History" %}</a></li>
-  {% if has_absolute_url %}<li><a href="../../../r/{{ content_type_id }}/{{ object_id }}/" class="viewsitelink">{% trans "View on site" %}</a></li>{% endif%}
+  <ul class="object-tools"><li><a href="history/">{% trans "History" %}</a></li>
+  {% if has_absolute_url %}<li><a href="../../../r/{{ content_type_id }}/{{ object_id }}/" class="focus">{% trans "View on site" %}</a></li>{% endif%}
   </ul>
 {% endif %}{% endif %}
 {% endblock %}

templates/admin/edit_inline/stacked.html

 {% load i18n %}
+
 <div class="inline-group {% if inline_admin_formset.opts.sortable %}sortable{% endif %}" name="inlinegroup">
-<h2>{{ inline_admin_formset.opts.verbose_name_plural|title }}</h2>
-{{ inline_admin_formset.formset.management_form }}
-<ul class="inline-item-tools">
-    <li><a href="javascript://" class="openhandler" title="Open All Items"></a></li>
-    <li><a href="javascript://" class="closehandler" title="Close All Items"></a></li>
-    <li><a href="javascript://" class="addhandler" title="Add Item"></a></li>
-</ul>
-{{ inline_admin_formset.formset.non_form_errors }}
+    
+    <h2>{{ inline_admin_formset.opts.verbose_name_plural|title }}</h2>
+    <ul class="inline-item-tools">
+        <li><a href="javascript://" class="openhandler" title="Open All Items"></a></li>
+        <li><a href="javascript://" class="closehandler" title="Close All Items"></a></li>
+        <li><a href="javascript://" class="addhandler" title="Add Item"></a></li>
+    </ul>
+    
+    {{ inline_admin_formset.formset.management_form }}
+    {{ inline_admin_formset.formset.non_form_errors }}
+    
+    <div class="items">
+        {% for inline_admin_form in inline_admin_formset %}
+        <div class="inline-related" name="inlinerelated">
+            <h3><b>{{ inline_admin_formset.opts.verbose_name|title }} #{{ forloop.counter }}</b>&nbsp;&nbsp;{% if inline_admin_form.original %}{{ inline_admin_form.original }}{% endif %}</h3>
+            <ul class="inline-item-tools">
+                {% if inline_admin_formset.formset.can_delete and inline_admin_form.original %}<li>{{ inline_admin_form.deletion_field.field }}<a href="javascript://" class="deletelink" title="Delete Item"></a></li>{% else %}<li>&nbsp;</li>{% endif %}
+                {% if inline_admin_form.show_url %}<li><a href="../../../r/{{ inline_admin_form.original.content_type_id }}/{{ inline_admin_form.original.id }}/" class="viewsitelink" title="View on Site"></a></li>{% else %}<li>&nbsp;</li>{% endif %}
+                {% if inline_admin_formset.opts.sortable %} <li><a href="javascript://" class="draghandler" title="Move Item"></a></li>{% else %}<li>&nbsp;</li>{% endif %}
+            </ul>
+            {% if inline_admin_form.form.non_field_errors %}{{ inline_admin_form.form.non_field_errors }}{% endif %}
+            {% for fieldset in inline_admin_form %}
+                {% include "admin/includes/fieldset_inline.html" %}
+            {% endfor %}
+            {{ inline_admin_form.pk_field.field }}
+            {{ inline_admin_form.fk_field.field }}
+        </div>
+        {% endfor %}
+        {{ inline_admin_formset.extra_forms }}
+    </div>
+    
+    <div class="predelete-items"> </div>
+    <div class="add-item" style="display: none;"> </div>
 
-<div class="items">
-{% for inline_admin_form in inline_admin_formset %}
-<div class="inline-related" name="inlinerelated">
-  <h3><b>{{ inline_admin_formset.opts.verbose_name|title }} #{{ forloop.counter }}</b>&nbsp;&nbsp;{% if inline_admin_form.original %}{{ inline_admin_form.original }}{% endif %}</h3>
-  <ul class="inline-item-tools">
-      {% if inline_admin_formset.formset.can_delete and inline_admin_form.original %}<li>{{ inline_admin_form.deletion_field.field }}<a href="javascript://" class="deletelink" title="Delete Item"></a></li>{% endif %}
-      {% if inline_admin_form.show_url %}<li><a href="../../../r/{{ inline_admin_form.original.content_type_id }}/{{ inline_admin_form.original.id }}/" class="viewsitelink" title="View on Site"></a></li>{% endif %}
-     {% if inline_admin_formset.opts.sortable %} <li><a href="javascript://" class="draghandler" title="Move Item"></a></li>{% endif %}
-  </ul>
-  {% if inline_admin_form.form.non_field_errors %}{{ inline_admin_form.form.non_field_errors }}{% endif %} 
-  {% for fieldset in inline_admin_form %}
-    {% include "admin/includes/fieldset_inline.html" %}
-  {% endfor %}
-  {{ inline_admin_form.pk_field.field }}
-  {{ inline_admin_form.fk_field.field }}
-</div>
-{% endfor %}
-</div>
-<div class="predelete-items">
 </div>
 
+<div class="sortablehelper">
+    <h3><b>Sortable Helper</b></h3>
 </div>
-<div class="sortablehelper">
-    <h2><b>Sortable Helper</b></h2>
-</div>

templates/admin/edit_inline/tabular.html

 {% load i18n %}
+
 <div class="inline-group {% if inline_admin_formset.opts.sortable %}sortable{% endif %}" name="inlinegrouptabular">
-<h2>{{ inline_admin_formset.opts.verbose_name_plural|capfirst }}</h2>
-<ul class="inline-item-tools">
-    <li><a href="javascript://" class="addhandler" title="Add Item"></a></li>
-</ul>
 
-  <div class="tabular inline-related {% if forloop.last %}last-related{% endif %}" name="inlinerelatedtabular">
-{{ inline_admin_formset.formset.management_form }}
-<fieldset class="module">
-   {% comment %}<h2>{{ inline_admin_formset.opts.verbose_name_plural|capfirst|escape }}</h2>{% endcomment %}
-   {{ inline_admin_formset.formset.non_form_errors }}
-   {{ inline_admin_formset.opts.model.opts.order_with_respect_to }}
-   <table{% if inline_admin_formset.opts.opts.order_with_respect_to %} class="sortable"{% endif %}>
-     <thead><tr>
-     {% for field in inline_admin_formset.fields %}
-       {% if not field.is_hidden %}
-         <th>{{ field.label|capfirst }}</th>
-        {% endif %}
-     {% endfor %}
-     <th>&nbsp;</th>
-     </tr></thead>
-     
-     {% for inline_admin_form in inline_admin_formset %}
-        {% if inline_admin_form.form.non_field_errors %}
-        <tr><td colspan="{{ inline_admin_form.field_count }}">{{ inline_admin_form.form.non_field_errors }}</td></tr>
-        {% endif %}
-        <tbody class="item row1">
-        <tr>
-        <td class="original" colspan="{{ inline_admin_form.field_count }}">
-          <p><b>{{ inline_admin_formset.opts.verbose_name|title }} #{{ forloop.counter }}</b>&nbsp;&nbsp;{% if inline_admin_form.original %} {{ inline_admin_form.original }}{% endif %}</p>
-          {{ inline_admin_form.pk_field.field }}
-          {{ inline_admin_form.fk_field.field }} 
-          {% spaceless %}
-          {% for fieldset in inline_admin_form %}
-            {% for line in fieldset %}
-              {% for field in line %}
-                {% if field.is_hidden %} {{ field.field }} {% endif %}
-              {% endfor %}
+    <h2>{{ inline_admin_formset.opts.verbose_name_plural|capfirst }}</h2>
+    <ul class="inline-item-tools">
+        <li><a href="javascript://" class="addhandler" title="Add Item"></a></li>
+    </ul>
+    
+    {{ inline_admin_formset.formset.management_form }}
+    {{ inline_admin_formset.formset.non_form_errors }}
+    {{ inline_admin_formset.opts.model.opts.order_with_respect_to }}
+    
+    <div class="legend">
+        {% for field in inline_admin_formset.fields %}
+            {% if not field.is_hidden %}
+                <div class="form-cell {{ field.label|lower }}">{{ field.label|capfirst }}</div>
+            {% endif %}
+        {% endfor %}
+    </div>
+        
+    <div class="items">
+        {% for inline_admin_form in inline_admin_formset %}
+        <div class="tabular inline-related {% if forloop.last %}last-related{% endif %}" name="inlinerelatedtabular">
+            
+            {% if inline_admin_form.form.non_field_errors %}
+                <div>{{ inline_admin_form.form.non_field_errors }}</div>
+            {% endif %}
+            
+            <h3><b>{{ inline_admin_formset.opts.verbose_name|title }} #{{ forloop.counter }}</b>&nbsp;&nbsp;{% if inline_admin_form.original %} {{ inline_admin_form.original }}{% endif %}</h3>
+            
+            {% spaceless %}
+            {% for fieldset in inline_admin_form %}
+                {% for line in fieldset %}
+                    {% for field in line %}
+                        {% if field.is_hidden %} {{ field.field }} {% endif %}
+                    {% endfor %}
+                {% endfor %}
             {% endfor %}
-          {% endfor %}
-          {% endspaceless %}
-        </td>
-        <td class="inline-item-tools">
+            {% endspaceless %}
+            
             <ul class="inline-item-tools">
                 {% if inline_admin_formset.formset.can_delete and inline_admin_form.original %}<li>{{ inline_admin_form.deletion_field.field }}<a href="javascript://" class="deletelink" title="Delete Item"></a></li>{% endif %}
                 {% if inline_admin_form.show_url %}<li><a href="../../../r/{{ inline_admin_form.original.content_type_id }}/{{ inline_admin_form.original.id }}/" class="viewsitelink" title="View on Site"></a></li>{% endif %}
-               {% if inline_admin_formset.opts.sortable %} <li><a href="javascript://" class="draghandler" title="Move Item"></a></li>{% endif %}
+                {% if inline_admin_formset.opts.sortable %} <li><a href="javascript://" class="draghandler" title="Move Item"></a></li>{% endif %}
             </ul>
-        </td>
-        </tr>
-        <tr>
-        {% for fieldset in inline_admin_form %}
-          {% for line in fieldset %}
-            {% for field in line %}
-              {% comment %}<td class="{{ field.field.name }} {% if field.field.errors %} error{% endif %}">{% endcomment %}
-              <td class="{% if field.field.errors %} error{% endif %}">
-              {{ field.field }}
-              {{ field.field.errors.as_ul }}
-              </td>
+            
+            <fieldset class="module">
+            {% for fieldset in inline_admin_form %}
+                {% for line in fieldset %}
+                    {% for field in line %}
+                        {% comment %}<td class="{{ field.field.name }} {% if field.field.errors %} error{% endif %}">{% endcomment %}
+                        <div class="form-cell {{ field.field.name }} {% if field.field.errors %} error{% endif %}">
+                            {{ field.field }}
+                            {{ field.field.errors.as_ul }}
+                        </div>
+                    {% endfor %}
+                {% endfor %}
             {% endfor %}
-          {% endfor %}
+            </fieldset>
+            
+            {{ inline_admin_form.pk_field.field }}
+            {{ inline_admin_form.fk_field.field }}
+        
+        </div>
         {% endfor %}
-        <td></td>
-        </tr>
-        </tbody>
-     {% endfor %}
-   </table>
-   
-</fieldset>
-  </div>
-  
-  {# <ul class="tools"> #}
-  {#   <li><a class="add" href="">Add another {{ inline_admin_formset.opts.verbose_name|title }}</a></li> #}
-  {# </ul> #}
+    
+    </div>
+    
+    <div class="predelete-items"> </div>
+    <div class="add-item" style="display: none;"> </div>
   
 </div>
 
 <div class="sortablehelper">
-    <h2><b>Sortable Helper</b></h2>
+    <h3><b>Sortable Helper</b></h3>
 </div>
 
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.