]> git.ipfire.org Git - thirdparty/bugzilla.git/commitdiff
Bug 1215501 - [modal ui only?] When moving a bug to a different product and removing...
authorDavid Lawrence <dkl@mozilla.com>
Tue, 6 Dec 2016 20:18:08 +0000 (20:18 +0000)
committerDavid Lawrence <dkl@mozilla.com>
Tue, 6 Dec 2016 20:18:08 +0000 (20:18 +0000)
extensions/BugModal/template/en/default/bug_modal/new_product_groups.html.tmpl
extensions/BugModal/web/bug_modal.js

index d3e4c457418873b002b1c523649223f559563323..2f1787b75f78761d8ad2fb0b7be0bc07f171e4cb 100644 (file)
   #%]
 
 [% PROCESS group_list
-    group_set = groups.invalid
-    label     = "Groups that are not valid for the '" _ product.name _ "' product:"
-    enabled   = 0
-    disabled  = 1
+    type     = "invalid"
+    label    = "Groups that are not valid for the '" _ product.name _ "' product:"
+    enabled  = 0
+    disabled = 1
 %]
 [% PROCESS group_list
-    group_set = groups.mandatory
-    label     = "Mandatory '" _ product.name _ "' groups:"
-    enabled   = 1
-    disabled  = 1
+    type     = "mandatory"
+    label    = "Mandatory '" _ product.name _ "' groups:"
+    enabled  = 1
+    disabled = 1
 %]
 [% PROCESS group_list
-    group_set = groups.optional
-    label     = "Optional '" _ product.name _ "' groups:"
-    enabled   = 1
-    disabled  = 0
+    type     = "optional"
+    label    = "Optional '" _ product.name _ "' groups:"
+    enabled  = 1
+    disabled = 0
 %]
 <input type="hidden" name="group_verified" value="1">
 
 [% BLOCK group_list %]
-  [% RETURN UNLESS group_set.size %]
+  [% RETURN UNLESS groups.$type.size %]
   [% FILTER collapse %]
     <div>
       <div>
         [% label FILTER html %]
       </div>
 
-      [% FOREACH g = group_set %]
+      [% FOREACH g = groups.$type %]
         <div>
           [% IF g.checked %]
             <input type="hidden" name="defined_groups" value="[% g.name FILTER html %]">
@@ -51,7 +51,8 @@
             id="group_[% g.id FILTER none %]"
             [%= IF enabled %]name="groups"[% END %]
             [%= "checked" IF g.checked %]
-            [%= "disabled" IF disabled %]>
+            [%= "disabled" IF disabled %]
+            [%= 'data-mandatory="1"' IF type == "mandatory" %]>
           <label for="group_[% g.id FILTER none %]" [%= IF disabled %]class="group-disabled"[% END %]>
             [% g.description FILTER html %]
           </label>
index 1282ff838b44078fb31e743f937adb938cb18d2f..a2e7be0c703aa252a587d3d26aae794d5bd44dba 100644 (file)
@@ -1173,12 +1173,16 @@ $(function() {
 
                     // update groups
                     var dirtyGroups = [];
+                    var any_groups_checked = 0;
                     $('#module-security').find('input[name=groups]').each(function() {
                         var that = $(this);
                         var defaultChecked = !!that.attr('checked');
                         if (defaultChecked !== that.is(':checked')) {
                             dirtyGroups.push({ name: that.val(), value: that.is(':checked') });
                         }
+                        if (that.is(':checked')) {
+                            any_groups_checked = 1;
+                        }
                     });
                     $('#module-security .module-content')
                         .html(data.groups)
@@ -1186,6 +1190,16 @@ $(function() {
                     $.each(dirtyGroups, function() {
                         $('#module-security').find('input[value=' + this.name + ']').prop('checked', this.value);
                     });
+                    // clear any default groups if user was making bug public
+                    // unless the group is mandatory for the new product
+                    if (!any_groups_checked) {
+                        $('#module-security').find('input[name=groups]').each(function() {
+                            var that = $(this);
+                            if (!that.data('mandatory')) {
+                                that.prop('checked', false);
+                            }
+                        });
+                    }
                 },
                 function() {
                     $('#product-throbber').hide();