]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-4063 When adding a criterion in the Measure Service, set the focus to this...
authorJulien Lancelot <julien.lancelot@gmail.com>
Fri, 12 Jul 2013 08:30:05 +0000 (10:30 +0200)
committerJulien Lancelot <julien.lancelot@gmail.com>
Fri, 12 Jul 2013 08:30:05 +0000 (10:30 +0200)
sonar-server/src/main/webapp/WEB-INF/app/views/measures/_sidebar.html.erb

index eca9640c027a6c596173d2ca15412d620aac738b..4f714c2eacf200425be22e9b799f1b7303bdc353 100644 (file)
         .on("change", function (e) {
             $j("#criteria-" + e.val).insertBefore($j("#more-td")).show();
 
-            if (e.val == 'lang' || e.val == 'project' || e.val == 'alert') {
-              $j("#select-" + e.val).select2("enable");
-              $j("#select-" + e.val).select2("focus");
-            } else if (e.val == 'fav') {
-              $j('#check-fav').attr('checked', 'checked');
-            } else if (e.val == 'date') {
-              $j("#criteria-" + e.val + " input[name=fromDate]").focus();
-            } else if (e.val == 'age') {
-              $j("#criteria-" + e.val + " input[name=ageMinDays]").focus();
-            } else if (e.val == 'key') {
-              $j("#criteria-" + e.val + " input").focus();
-            } else if (e.val == 'name') {
-              $j("#criteria-" + e.val + " input").focus();
-            }
-
             if (e.val == 'metric') {
               if (hiddenConditionIndexes.length > 0) {
                 var index = hiddenConditionIndexes.pop();
               }
             } else {
               // applies to any criteria except metrics
+
+              // remove disabled attribute before setting focus otherwise the focus will not be done. SONAR-4063
               $j("#criteria-" + e.val + " input").removeAttr('disabled');
+
+              if (e.val == 'lang' || e.val == 'project' || e.val == 'alert') {
+                $j("#select-" + e.val).select2("enable");
+                $j("#select-" + e.val).select2("focus");
+              } else if (e.val == 'fav') {
+                $j('#check-fav').attr('checked', 'checked');
+                $j('#check-fav').focus();
+              } else if (e.val == 'date') {
+                $j("#criteria-" + e.val + " input[name=fromDate]").focus();
+              } else if (e.val == 'age') {
+                $j("#criteria-" + e.val + " input[name=ageMinDays]").focus();
+              } else if (e.val == 'key') {
+                $j("#criteria-" + e.val + " input").focus();
+              } else if (e.val == 'name') {
+                $j("#criteria-" + e.val + " input").focus();
+              }
+
               $j("#more-criteria option[value='" + e.val + "']").remove();
             }
             $j("#more-criteria").select2("val", "");