Commits

Anonymous committed 1e2ede1

fixes for inlines

Comments (0)

Files changed (2)

media/js/admin/CollapsedInlineFieldsets.js

         $(this).addClass("collapsed");
         $(this).find('h2:first').attr("class", "collapse-toggle");
     });
-    $('div[name="inlinegroup"] h2.collapse-toggle:first').bind("click", function(){
+    $('div[name="inlinegroup"]').each(function(i) {
+      $(this).find('h2.collapse-toggle:first').bind("click", function(){
         $(this).parent().toggleClass('collapsed');
+      });
     });
-    $('div[name="inlinegrouptabular"] h2.collapse-toggle:first').bind("click", function(){
+    $('div[name="inlinegrouptabular"] h2.collapse-toggle').bind("click", function(){
         $(this).parent().toggleClass('collapsed');
     });
     
     /// OPEN STACKEDINLINE WITH ERRORS
-    $('div[name="inlinerelated"]').find('div[class*="errors"]:first').each(function(i) {
+    $('div[name="inlinerelated"]').find('div[class*="errors"]:first').end().each(function(i) {
         /// toggle each inlinerelated with error-rows inside
-        $(this).parent().parent().toggleClass("collapsed");
+        $(this).toggleClass("collapsed");
     });
-    $('div[name="inlinegroup"]').find('div[class*="errors"]:first').each(function(i) {
+    $('div[name="inlinegroup"]').find('div[class*="errors"]:first,.error').end().each(function(i) {
         /// toggle each inlinegroup with error-rows inside
-        $(this).parent().parent().parent().toggleClass("collapsed");
+        $(this).parent().toggleClass("collapsed");
     });
     /// OPEN TABULARINLINE WITH ERRORS
     $('div[name="inlinerelatedtabular"]').find('td[class*="error"]:first').each(function(i) {

media/js/admin/Inline.js

                 predelete_flag = $(this).find('input[name*="DELETE"]:checked').length;
                 if (input_values == "") {
                     /// clear order-field for empty items
-                    $(this).find('input[id*="order"]').val('');
+                    $(this).find('input[id*="order"]').each(function() { this.setAttribute('value', ''); });
                 } else if (predelete_flag) {
                     /// reset order-field for predelete-item
                     $(this).find('input[id*="order"]').val(predelete_counter);