]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-2327 improve CSS
authorsimonbrandhof <simon.brandhof@gmail.com>
Fri, 22 Apr 2011 15:27:28 +0000 (17:27 +0200)
committersimonbrandhof <simon.brandhof@gmail.com>
Fri, 22 Apr 2011 15:34:27 +0000 (17:34 +0200)
sonar-server/src/main/webapp/WEB-INF/app/helpers/reviews_helper.rb
sonar-server/src/main/webapp/WEB-INF/app/models/review.rb
sonar-server/src/main/webapp/WEB-INF/app/views/resource/_violation.html.erb
sonar-server/src/main/webapp/WEB-INF/app/views/reviews/_review.html.erb [new file with mode: 0644]
sonar-server/src/main/webapp/WEB-INF/app/views/reviews/_show.html.erb
sonar-server/src/main/webapp/WEB-INF/app/views/reviews/index.html.erb
sonar-server/src/main/webapp/stylesheets/style.css

index 7c51816f33348c7b6ef87fc64bd01e14b3607d2c..2cf6e97b6eef65207f74bd09805267a4a7590906 100644 (file)
 #
 module ReviewsHelper
   
-  def options_for_project_select
-    options=[['Any', '']]
-    projects=Project.find(:all, :select => 'id,name', :conditions => ['enabled=? AND scope=? AND qualifier IN (?)', true, 'PRJ', ['TRK', 'VW','SVW']], :order => 'name ASC')
-    projects.each do |project|
-      options<<[project.name, project.id]
-    end
-    options_for_select(options, @projects)
+  def projects_for_select
+    Project.find(:all, :select => 'id,name,long_name', :conditions => ['enabled=? AND scope=? AND qualifier IN (?)', true, 'PRJ', ['TRK', 'VW','SVW']], :order => 'name ASC')
   end
   
 end
index 4d5b6b5e4433c81e94d89fb4c5576a9966d35574..0e45f87f94b10ff61a371c8733d4b5fdfde59187 100644 (file)
@@ -50,8 +50,19 @@ class Review < ActiveRecord::Base
     return STATUS_OPEN
   end
     
-  def source?
-    resource!=nil && resource.last_snapshot!=nil && resource.last_snapshot.source!=nil
+  def on_project?
+    resource_id==project_id
+  end
+  
+  def rule
+    @rule ||= 
+      begin
+        rule_failure ? rule_failure.rule : nil
+      end
+  end
+  
+  def comments
+    review_comments
   end
 
   private
index 1fec9f4e7bc2c22e1621d3ebd38136a2d12db28d..84b476fa9ac99e9912c34946ea234be2773f37b5 100644 (file)
@@ -80,7 +80,7 @@
     
   </div>
 
-  <div class="comment">
+  <div class="discussionComment first">
     <%= h(violation.message) -%>
   </div>
 
@@ -89,7 +89,7 @@
       last_comment = current_open_review.review_comments.last
       current_open_review.review_comments.each do |review_comment|
   %>
-  <div class="comment">
+  <div class="discussionComment">
     <% duration=Date.today - review_comment.created_at.to_date %>
     <h4><%= image_tag("reviews/comment.png") -%> &nbsp;<b><%= review_comment.user.name -%></b> (<%= duration==0 ? 'today' : "#{duration} days ago" -%>)
     <% if review_comment == last_comment && current_user && current_user.id == review_comment.user.id %>
diff --git a/sonar-server/src/main/webapp/WEB-INF/app/views/reviews/_review.html.erb b/sonar-server/src/main/webapp/WEB-INF/app/views/reviews/_review.html.erb
new file mode 100644 (file)
index 0000000..35407e6
--- /dev/null
@@ -0,0 +1,75 @@
+<div id="rev_<%= review.id -%>">
+  <div class="reportTitle">
+    <div style="float: right"><span class="violation_date">#<%= review.id.to_s -%></span></div>  
+    <h2><%= h(review.title) -%></h2>
+  </div>
+
+  <table class="reportDetails">
+        <tr>
+          <td class="key">
+            Status:    
+          </td>
+          <td  class="val">
+               <%= image_tag "status/#{review.status}.png" -%> <%= review.status -%>
+          </td>
+          <td class="key">
+         Severity:
+          </td>
+          <td  class="val">
+          <%= image_tag "priority/#{review.severity}.png" -%> <%= review.severity -%>
+          </td>
+        </tr>
+        <tr>
+          <td class="key">
+            Assignee:  
+          </td>
+          <td  class="val">
+               <%= review.assignee ? h(review.assignee.name) : '-'-%>
+          </td>
+          <td class="key">
+                 Created: 
+          </td>
+          <td  class="val">
+                 by <%= h(review.user.name) -%> at <%= l(review.created_at) -%>
+          </td>
+        </tr>
+       <% if review.rule %>
+       <tr>
+          <td class="key">
+            Rule:      
+          </td>
+          <td class="val" colspan="3">
+                 <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 => review.rule.key, :layout => 'false' -%>"><%= h(review.rule.key) -%></a>
+          </td>
+       </tr>
+       <% end %>
+       <tr>
+          <td class="key">
+            File:      
+          </td>
+          <td class="val" colspan="3">
+               <%= qualifier_icon(@review.resource) -%> 
+               <% if !review.on_project? %> <%= @review.project.long_name -%> <%= image_tag 'sep12.png' -%> <% end %>
+               <%= link_to_resource(review.resource, review.resource.long_name) %>
+          </td>
+        </tr>
+  </table>
+
+  <% if review.rule_failure %>
+    
+  <% end %>
+
+  <div class="discussion">
+        <% if review.rule_failure %>
+          <div class="discussionComment first">
+           <%= h(review.rule_failure.message) -%>
+          </div>
+        <% end %>
+        <% review.comments.each do |comment| %>
+          <div class="discussionComment">
+                <h4><%= image_tag("reviews/comment.png") -%> &nbsp;<b><%= comment.user.name -%></b> (<%= distance_of_time_in_words_to_now(comment.created_at) -%>)</h4>
+           <%= h(comment.review_text) -%>
+          </div>
+        <% end %>
+  </div>
+<div>
\ No newline at end of file
index 499fd2133634127b68b1a74e70d0b5add67bdf8d..45b8bc3a8af81242f447483ac8b1a54b14a48359 100644 (file)
@@ -1,13 +1,5 @@
-<div>
-       <a href="#" onclick="backReviews()">Back to results</a>
+<div class="marginbottom10">
+       <a href="#" onclick="backReviews()">Back to reviews</a>
 </div>
 
-<h1><%= h(@review.project.long_name) -%> | <%= h(@review.resource.long_name) -%></h1>
-
-<% if @review.source? %>
-
-<% end %>
-
-<%= @review.title -%>
-
-
+<%= render :partial => 'reviews/review', :locals => {:review => @review} -%>
\ No newline at end of file
index a2a06f63c8d45c4e7e07ee74e16382af082a985f..67707ac52f60ede2a9a4eb45b07a92037b6ab951 100644 (file)
@@ -19,7 +19,7 @@ function backReviews() {
 <div id="reviews-search">
   <h1>Reviews</h1>
   <% form_tag({:action => 'index'}, {:method => 'get'}) do %>
-   <table id="reviews-form" class="search-filter-box">
+   <table id="reviews-form" class="searchFilterBox">
         <thead>
                <tr><th colspan="6"></th></tr>
        </thead>
@@ -27,7 +27,7 @@ function backReviews() {
      <tr>
           <td width="1%" nowrap>
          <span class="note">Status</span><br/>
-                <select size="6" name="statuses[]" multiple="multiple" id="statuses" class="with-icons">
+                <select size="6" name="statuses[]" multiple="multiple" id="statuses" class="withIcons">
                        <option <%= 'selected' if @statuses.include?('') -%> value="">Any</option>
                    <option value="<%= Review::STATUS_OPEN -%>" class="status_open" <%= 'selected' if @statuses.include?(Review::STATUS_OPEN) -%>>Open</option>
             <option value="<%= Review::STATUS_CLOSED -%>" class="status_closed" <%= 'selected' if @statuses.include?(Review::STATUS_CLOSED) -%>>Closed</option>
@@ -35,11 +35,18 @@ function backReviews() {
 
        <td width="1%" nowrap>
          <span class="note">Project</span><br/>
-         <%= select_tag "projects", options_for_project_select(), :multiple => true, :size => 6 %>
+               <select size="6" name="projects[]" multiple="multiple" id="projects">
+                       <option <%= 'selected' if @projects.include?('') -%> value="">Any</option>
+                       <% projects_for_select.each do |project| 
+                               name=project.name(true)
+                       %>
+                     <option value="<%= project.id -%>" title="<%= h(name)-%>" <%= 'selected' if @projects.include?(project.id.to_s) -%>><%= h(truncate(name, :length => 20)) -%></option>
+                   <% end %>
+               </select>
        </td>
        <td width="1%" nowrap>
          <span class="note">Severity</span><br/>
-               <select size="6" name="severities[]" multiple="multiple" id="severities" class="with-icons">
+               <select size="6" name="severities[]" multiple="multiple" id="severities" class="withIcons">
           <option <%= 'selected' if @severities.include?('') -%> value="">Any</option>
           <option value="<%= Severity::BLOCKER -%>" class="sev_BLOCKER" <%= 'selected' if @severities.include?(Severity::BLOCKER) -%>>Blocker</option>
           <option value="<%= Severity::CRITICAL -%>" class="sev_CRITICAL" <%= 'selected' if @severities.include?(Severity::CRITICAL) -%>>Critical</option>
index 16eb2895a8fa3c341e7a928d83eb2f9887b5a10f..52d2e3bd5e01e2fd7aa0b7d2450a1a8d07061a7e 100644 (file)
@@ -670,17 +670,6 @@ ul.operations li img {
   margin:0;
   border: 1px solid #DDD;
 }
-.sources2 div.comment{
-  background-color:#FBFBFB;
-  margin:0;
-  padding:5px 10px;
-  border-top: 1px solid #DDD;
-  line-height: 1.5em;
-}
-.sources2 div.comment h4{
-  font-size: 90%;
-  margin-bottom: 2px;
-}
 .sources2 div.violation .actions{
   visibility: hidden;
 }
@@ -690,7 +679,7 @@ ul.operations li img {
 .sources2 div.violation .actions form {
   display: inline;
 }
-.sources2 div.vtitle{
+div.vtitle{
   background-color:#E4ECF3;
   margin:0;
   padding:0 10px;
@@ -698,7 +687,7 @@ ul.operations li img {
   text-shadow: 1px 1px 0 #FFF;
   color:#777
 }
-.sources2 div.vtitle a.action {
+div.vtitle a.action {
   color: #777;
 }
 span.rulename, span.rulename a {
@@ -818,6 +807,68 @@ span.rulename a:hover {
 
 
 
+
+
+div.reportTitle {
+       background-color: #CAE3F2;
+       color: #4B9FD5;
+       line-height: 2.2em;
+       margin: 0;
+       padding: 0 10px;
+       border: 1px solid #4B9FD5;
+}
+div.reportTitle h2 {
+       color: #4183C4;
+       font-weight: bold;
+       display: inline;
+       font-size: 100%;
+       text-shadow: 0 1px 0 #FFFFFF;
+}
+table.reportDetails {
+       width: 100%;
+       border: 0;
+}
+table.reportDetails td {
+       vertical-align: top;
+       text-align: left;
+       padding: 5px 10px;
+}
+table.reportDetails td.key {
+  white-space: nowrap; 
+  min-width: 1%;
+  color: #777;
+}
+table.reportDetails td img {
+       vertical-align: bottom;
+}
+
+div.discussion {
+       width: 100%;
+       border: 1px solid #DDDDDD;
+}
+.discussionComment.first {
+       border-top: none;
+}
+div.discussionComment {
+       background-color: #F4F4F4;
+       border-top: 1px solid #DDDDDD;
+       line-height: 1.5em;
+       margin: 0;
+       padding: 5px 10px;
+}
+div.discussionComment h4 {
+  font-size: 90%;
+  margin-bottom: 2px;
+}
+div.discussionComment h4 img {
+  vertical-align: sub;
+}
+
+
+
+
+
+
 #gwtpage {
        width: 100%;
        clear: both;
@@ -1036,18 +1087,18 @@ span.rulename a:hover {
   padding: 10px;
 }
 
-.search-filter-box {
+.searchFilterBox {
        background-color: #ECECEC;
        color: #444;
        border: 1px solid #DDD;
        margin: 0 0 10px 0;
 }
-.search-filter-box td {
+.searchFilterBox td {
        padding: 10px;
        text-align: left;
        vertical-align: top;
 }
-select.with-icons option {
+select.withIcons option {
        background-repeat: no-repeat;
        background-position: 2px 0;
        padding: 0 2px 0 22px;