]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-3242 The review buttons should not hide the violation title
authorFabrice Bellingard <bellingard@gmail.com>
Mon, 6 Feb 2012 15:23:35 +0000 (16:23 +0100)
committerFabrice Bellingard <bellingard@gmail.com>
Mon, 6 Feb 2012 15:27:34 +0000 (16:27 +0100)
sonar-server/src/main/webapp/WEB-INF/app/views/resource/_violation.html.erb
sonar-server/src/main/webapp/images/actions.png [new file with mode: 0644]
sonar-server/src/main/webapp/javascripts/resource.js
sonar-server/src/main/webapp/stylesheets/style.css

index cc4854d90b90b8920dbb088200c14142a45657a1..afd11c3d8ce261d2b430a027543e89f3b11fa100 100644 (file)
@@ -1,6 +1,4 @@
-<div id="vId<%= violation.id -%>"
-     <% if current_user -%>onmouseover="sVA(<%= violation.id -%>)" onmouseout="hVA(<%= violation.id -%>)"
-     <% end -%>>
+<div id="vId<%= violation.id -%>">
   <div class="violation">
     <div class="vtitle">
       <% if violation.review %>
@@ -18,7 +16,7 @@
       <img src="<%= ApplicationController.root_context -%>/images/sep12.png">
       &nbsp;
       <span class="rulename">
-        <a onclick="window.open(this.href,'rule','height=800,width=900,scrollbars=1,resizable=1');return false;" href="<%= url_for :controller => 'rules', :action => 'show', :id => violation.rule.key, :resource_id => @resource.id, :layout => 'false' -%>"><%= h(violation.rule.name) -%></a>
+        <a onclick="window.open(this.href,'rule','height=800,width=900,scrollbars=1,resizable=1');return false;" href="<%= url_for :controller => 'rules', :action => 'show', :id => violation.rule.key, :layout => 'false' -%>"><%= h(violation.rule.name) -%></a>
       </span>
       &nbsp;
       <img src="<%= ApplicationController.root_context -%>/images/sep12.png">
     </div>
 
     <div class="discussionComment first" id="vBody<%= violation.id -%>">
-      <% if current_user %>
-        <div style="display: none" class="vActions" id="vActions<%= violation.id -%>">
-          <%= button_to_function message('reviews.comment'), "sCF(#{violation.id})", :name => 'bComment' -%>
+      <div id="vMsg<%= violation.id -%>">
+        
+        <% if current_user %>
+          <img src="<%= ApplicationController.root_context -%>/images/actions.png" onclick="$('vActions<%= violation.id -%>').toggle();">
+          <div style="display: none" class="popup-menu" id="vActions<%= violation.id -%>" onmouseout="this.hide();"  onmouseover="this.show();">
+              <ul>
+                <li><%= link_to_function message('reviews.comment'), "sCF(#{violation.id})", :name => 'bComment' -%></li>
 
-          <% unless violation.review && violation.review.resolved? %>
-            <%= button_to_function message('reviews.assign'), "sAF(#{violation.id})", :name => 'bAssign' -%>
-          <% end %>
+                <% unless violation.review && violation.review.resolved? %>
+                <li><%= link_to_function message('reviews.assign'), "sAF(#{violation.id})", :name => 'bAssign' -%></li>
+                <% end %>
 
-          <% if !violation.switched_off? %>
-            <%= button_to_function (violation.review && violation.review.resolved? ? message('reviews.reopen') : message('reviews.resolved')),
-                                   "sCStF(#{violation.id})", :name => (violation.review && violation.review.resolved? ? 'bReopen' : 'bResolved') -%>
-          <% end %>
+                <% if !violation.switched_off? %>
+                <li><%= link_to_function (violation.review && violation.review.resolved? ? message('reviews.reopen') : message('reviews.resolved')),
+                                        "sCStF(#{violation.id})", :name => (violation.review && violation.review.resolved? ? 'bReopen' : 'bResolved') -%></li>
+                <% end %>
 
-          <% if violation.review.nil? || violation.review.can_change_false_positive_flag? %>
-            <%= button_to_function message(violation.switched_off? ? 'reviews.unflag_as_false_positive' : 'reviews.flag_as_false_positive'),
-                                   "sFPF(#{violation.id})",
-                                   :name => 'bFalsePositive' -%>
-          <% end %>
+                <% if violation.review.nil? || violation.review.can_change_false_positive_flag? %>
+                <li><%= link_to_function message(violation.switched_off? ? 'reviews.unflag_as_false_positive' : 'reviews.flag_as_false_positive'),
+                                       "sFPF(#{violation.id})",
+                                       :name => 'bFalsePositive' -%></li>
+                <% end %>
+  
+                <% unless violation.review && violation.review.resolved? %>
+                <li><%= link_to_function message('reviews.change_severity'), "sCSF(#{violation.id})", :name => 'bChangeSeverity' -%></li>
 
-          <% unless violation.review && violation.review.resolved? %>
-            <%= button_to_function message('reviews.change_severity'), "sCSF(#{violation.id})", :name => 'bChangeSeverity' -%>
-
-            <%= button_to_function message('reviews.link_to_action_plan'), "sAPF(#{violation.id})", :name => 'bLinkActionPlan' -%>
-          <% end %>
-        </div>
-      <% end %>
-      <div id="vMsg<%= violation.id -%>"><%= violation.html_message || '&nbsp;' -%></div>
+                <li><%= link_to_function message('reviews.link_to_action_plan'), "sAPF(#{violation.id})", :name => 'bLinkActionPlan' -%></li>
+                <% end %>
+              </ul>
+          </div>
+          &nbsp;
+          <%= image_tag 'sep12.png' -%>
+          &nbsp;
+        <% end %>
+      
+        <%= violation.html_message || '&nbsp;' -%>
+      </div>
     </div>
 
     <div class="discussionComment" id="reviewForm<%= violation.id -%>" style="display:none"></div>
diff --git a/sonar-server/src/main/webapp/images/actions.png b/sonar-server/src/main/webapp/images/actions.png
new file mode 100644 (file)
index 0000000..f0c3640
Binary files /dev/null and b/sonar-server/src/main/webapp/images/actions.png differ
index 88b6dffd7e20f635512bfa29d400d9ae6c103307..d9c49459e7e884982b39ef37433d0760ad3d9b11 100644 (file)
@@ -20,24 +20,6 @@ function loadGWT(gwtId, resourceId, resourceKey, resourceName, resourceScope, re
   modules[gwtId]();
 }
 
-// show violation actions
-function sVA(violation_id) {
-  var elt = $('vActions' + violation_id);
-  if (elt != null) {
-    elt.show();
-  }
-  return false;
-}
-
-// hide violation actions
-function hVA(violation_id) {
-  var elt = $('vActions' + violation_id);
-  if (elt != null) {
-    elt.hide();
-  }
-  return false;
-}
-
 // cancel action : hide form and refresh violation
 function cancelViolationAction(violation_id) {
   new Ajax.Updater(
index 2620e09769ad7c207501b28eed1777e2d962d179..9aad013c58e35755493cbf3c1929020e24f0e214 100644 (file)
@@ -419,6 +419,45 @@ button[disabled], .button[disabled], input[type="submit"][disabled], input[type=
   cursor: default;
 }
 
+.popup-menu {
+  background-clip: padding-box;
+  background-color: #FFFFFF;
+  border-color: rgba(0, 0, 0, 0.2);
+  border-style: solid;
+  border-width: 1px;
+  -moz-box-shadow: 0 5px 10px rgba(0, 0, 0, 0.2);
+  -webkit-box-shadow: 0 5px 10px rgba(0, 0, 0, 0.2);
+  -o-box-shadow: 0 5px 10px rgba(0, 0, 0, 0.2);
+  box-shadow: 0 5px 10px rgba(0, 0, 0, 0.2);
+  float: left;
+  margin: 0;
+  max-width: 220px;
+  min-width: 160px;
+  padding: 0px;
+  position: absolute;
+}
+
+.popup-menu li {
+  list-style-type: none !important;
+  padding: 2px 5px !important;
+  cursor: pointer !important;
+  color: red  !important;
+}
+
+.popup-menu li:hover {
+  background-color: #4b9fd5 !important;
+}
+
+.popup-menu li:hover a {
+  color: #fff !important;
+  font-weight: bold !important;
+}
+
+.popup-menu a {
+  text-decoration: none !important;
+  display: block !important;
+}
+
 /* ------------------- PAGE ------------------- */
 h1 {
   color: #444;
@@ -928,16 +967,6 @@ div.review_permalink {
   text-shadow: 1px 1px 0 #FFFFFF;
 }
 
-div.vActions {
-  position: absolute;
-  line-height: 1.5em;
-  height: 1.5em;
-  padding-right: 10px;
-  max-height: 1.5em;
-  background-color: #F4F4F4;
-  box-shadow: 10px 10px 10px #EFEFEF;
-}
-
 span.review_permalink a {
   color: #777;
   font-size: 11px;