]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-37 Improve HTML for Selenium ITs
authorFabrice Bellingard <fabrice.bellingard@sonarsource.com>
Thu, 6 Dec 2012 17:19:14 +0000 (18:19 +0100)
committerFabrice Bellingard <fabrice.bellingard@sonarsource.com>
Thu, 6 Dec 2012 17:19:42 +0000 (18:19 +0100)
- Add IDs on <a>
- Change "select2.on" to a regular ".change()"

sonar-server/src/main/webapp/WEB-INF/app/views/comparison/index.html.erb

index 0fb8461ac906ffe0fe9090b9e779870285bd8335..dbac84ef89bc4e4a85e14ad3d73e77b4785764ed 100644 (file)
             <script>
               // we don't want this parameter to be submitted, so we set its name to ''
               $j('#new_metric').attr('name', '');
-              $j('#new_metric').on("change", function (e) {
-                if (e.val != null) {
+              $j('#new_metric').change(function (event) {
+                var metric = event.target.value;
+                if (metric != null) {
                   var currentMetrics = $j('#metrics').val();
                   if (currentMetrics.length > 0) {
                     currentMetrics += ',';
                   }
-                  currentMetrics += e.val;
+                  currentMetrics += metric;
                   $j('#metrics').val(currentMetrics);
                   $j('#compare-form').submit();
                 }
               <tr>
                 <td style="vertical-align: bottom;">
                   <% if index > 0 %>
-                    <a href="#" onclick="moveLeft(<%= index -%>)"><img src="<%= ApplicationController.root_context -%>/images/controls/move_left.png" title="<%= message('comparison.move_left') -%>"/></a>
+                    <a href="#" onclick="moveLeft(<%= index -%>)" id="left-<%= index -%>"><img src="<%= ApplicationController.root_context -%>/images/controls/move_left.png" title="<%= message('comparison.move_left') -%>"/></a>
                   <% else %>
                     <img src="<%= ApplicationController.root_context -%>/images/transparent_16.gif"/>
                   <% end %>
                   <span class="note"><%= human_short_date s.created_at -%></span>
 
                   <div style="width: 100%; text-align: center;">
-                    <a href="#" onclick="removeFromList(<%= index -%>, $j('#sids'))"><img src="<%= ApplicationController.root_context -%>/images/cross-gray.png" title="<%= message('comparison.remove_resource') -%>"/></a>
+                    <a href="#" onclick="removeFromList(<%= index -%>, $j('#sids'))" id="del-r-<%= index -%>"><img src="<%= ApplicationController.root_context -%>/images/cross-gray.png" title="<%= message('comparison.remove_resource') -%>"/></a>
                   </div>
                 </td>
                 <td class="thin" style="vertical-align: bottom;">
                   <% if index < last_index %>
-                    <a href="#" onclick="moveRight(<%= index -%>)"><img src="<%= ApplicationController.root_context -%>/images/controls/move_right.png" title="<%= message('comparison.move_right') -%>"/></a>
+                    <a href="#" onclick="moveRight(<%= index -%>)" id="right-<%= index -%>"><img src="<%= ApplicationController.root_context -%>/images/controls/move_right.png" title="<%= message('comparison.move_right') -%>"/></a>
                   <% else %>
                     <img src="<%= ApplicationController.root_context -%>/images/transparent_16.gif"/>
                   <% end %>
             <script>
               // we don't want this parameter to be submitted, so we set its name to ''
               $j('#new_resource').attr('name', '');
-              $j('#new_resource').on("change", function (e) {
-                if (e.val != null) {
+              $j('#new_resource').change(function (event) {
+                var id = event.target.value;
+                if (id != null) {
                   $j('#version_loading').show();
                   $j.ajax({
                     type:'GET',
                     url:'<%= ApplicationController.root_context -%>/comparison/versions?resource='
-                      + e.val + '&sids='
+                      + id + '&sids='
                       + $j('#sids').val(),
                     success:function (data) {
                       $j('#new_version').html(data);
             <select id="new_version">
             </select>
             <script>
-              $j('#new_version').on("change", function (e) {
-                if (e.val != null) {
+              $j('#new_version').change(function (event) {
+                var id = event.target.value;
+                if (id != null) {
                   var currentSnapshotIds = $j('#sids').val();
                   if (currentSnapshotIds.length > 0) {
                     currentSnapshotIds += ',';
                   }
-                  currentSnapshotIds += e.val;
+                  currentSnapshotIds += id;
                   $j('#sids').val(currentSnapshotIds);
                   $j('#compare-form').submit();
                 }
               <div style="float: left; vertical-align: bottom;"><%= m.short_name -%></div>
               <div style="float: right">
                 <% if index > 0 %>
-                  <a href="#" onclick="moveUp(<%= index -%>)"><img src="<%= ApplicationController.root_context -%>/images/controls/move_up.png" title="<%= message('comparison.move_up') -%>"/></a>
+                  <a href="#" onclick="moveUp(<%= index -%>)" id="up-<%= index -%>"><img src="<%= ApplicationController.root_context -%>/images/controls/move_up.png" title="<%= message('comparison.move_up') -%>"/></a>
                 <% end %>
                 <% if index < last_index %>
-                  <a href="#" onclick="moveDown(<%= index -%>)"><img src="<%= ApplicationController.root_context -%>/images/controls/move_down.png" title="<%= message('comparison.move_down') -%>"/></a>
+                  <a href="#" onclick="moveDown(<%= index -%>)" id="down-<%= index -%>"><img src="<%= ApplicationController.root_context -%>/images/controls/move_down.png" title="<%= message('comparison.move_down') -%>"/></a>
                 <% end %>
-                <a href="#" onclick="removeFromList(<%= index -%>, $j('#metrics'))"><img src="<%= ApplicationController.root_context -%>/images/cross-gray.png" title="<%= message('comparison.remove_metric') -%>"/></a>
+                <a href="#" onclick="removeFromList(<%= index -%>, $j('#metrics'))" id="del-m-<%= index -%>"><img src="<%= ApplicationController.root_context -%>/images/cross-gray.png" title="<%= message('comparison.remove_metric') -%>"/></a>
               </div>
             </td>