]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-3242 improve rendering of review forms
authorsimonbrandhof <simon.brandhof@gmail.com>
Fri, 24 Feb 2012 17:42:49 +0000 (18:42 +0100)
committersimonbrandhof <simon.brandhof@gmail.com>
Fri, 24 Feb 2012 17:42:49 +0000 (18:42 +0100)
* form replaces bottom bar of actions
* improve markdown help

19 files changed:
sonar-markdown/src/main/java/org/sonar/markdown/HtmlMultilineCodeChannel.java
sonar-server/src/main/webapp/WEB-INF/app/controllers/markdown_controller.rb
sonar-server/src/main/webapp/WEB-INF/app/views/markdown/_help.html.erb [deleted file]
sonar-server/src/main/webapp/WEB-INF/app/views/markdown/_tips.html.erb [new file with mode: 0644]
sonar-server/src/main/webapp/WEB-INF/app/views/markdown/full_help.html.erb [deleted file]
sonar-server/src/main/webapp/WEB-INF/app/views/markdown/help.html.erb [new file with mode: 0644]
sonar-server/src/main/webapp/WEB-INF/app/views/project_reviews/_assign_form.html.erb
sonar-server/src/main/webapp/WEB-INF/app/views/project_reviews/_comment_form.html.erb
sonar-server/src/main/webapp/WEB-INF/app/views/resource/_violation.html.erb
sonar-server/src/main/webapp/WEB-INF/app/views/reviews/_violation_action_plan_form.html.erb
sonar-server/src/main/webapp/WEB-INF/app/views/reviews/_violation_assign_form.html.erb
sonar-server/src/main/webapp/WEB-INF/app/views/reviews/_violation_change_severity_form.html.erb
sonar-server/src/main/webapp/WEB-INF/app/views/reviews/_violation_change_status_form.html.erb
sonar-server/src/main/webapp/WEB-INF/app/views/reviews/_violation_comment_form.html.erb
sonar-server/src/main/webapp/WEB-INF/app/views/reviews/_violation_false_positive_form.html.erb
sonar-server/src/main/webapp/WEB-INF/app/views/rules_configuration/_active_rule_note.html.erb
sonar-server/src/main/webapp/WEB-INF/app/views/rules_configuration/_rule_note.html.erb
sonar-server/src/main/webapp/javascripts/resource.js
sonar-server/src/main/webapp/stylesheets/style.css

index f3a8b37d503bf79c4d8a90b2fe4bf790774f9fa8..bff8bf9bc3ff3eaee371e40fde2fa8f146ae39c2 100644 (file)
@@ -38,6 +38,8 @@ import org.sonar.channel.RegexChannel;
  * will produce:
  * {@literal<pre>}{@literal<code>}This code
  * spans on 2 lines{@literal</code>}{@literal</pre>}
+ *
+ * @since 2.14
  */
 class HtmlMultilineCodeChannel extends RegexChannel<MarkdownOutput> {
 
index 540a9fb6690b87adbba905a5ed3a95aefa460a74..4c4fbbc406c968dc789a03475e303a3db7f95e98 100644 (file)
@@ -21,7 +21,7 @@ class MarkdownController < ApplicationController
 
   SECTION=Navigation::SECTION_CONFIGURATION
   
-  def full_help
+  def help
   end
   
 end
\ No newline at end of file
diff --git a/sonar-server/src/main/webapp/WEB-INF/app/views/markdown/_help.html.erb b/sonar-server/src/main/webapp/WEB-INF/app/views/markdown/_help.html.erb
deleted file mode 100644 (file)
index ff1a65a..0000000
+++ /dev/null
@@ -1,23 +0,0 @@
-<div class="note" style="text-align: right; float: right;">
-  (<a onclick="window.open(this.href,'markdown','height=800,width=900,scrollbars=1,resizable=1');return false;" 
-     href="<%= url_for :controller => 'markdown', :action => 'full_help', :layout => 'false' -%>"><%= message('more') -%></a>)
-</div>
-<div style="min-width: 100px">
-<h3><%= message('help_tips') -%> </h3>
-<br/>
-<table>
-  <tr>
-    <td>*<%= message('bold') -%>*</td>
-    <td class="sep"></td>
-    <td><b><%= message('bold') -%></b></td>
-  </tr>
-  <tr>
-    <td>``<%= message('code') -%>``</td>
-    <td class="sep"></td>
-    <td><code><%= message('code') -%></code></td>
-  </tr>
-  <tr>
-    <td colspan="3">* <%= message('bulleted_point') -%></td>
-  </tr>
-</table>
-</div>
\ No newline at end of file
diff --git a/sonar-server/src/main/webapp/WEB-INF/app/views/markdown/_tips.html.erb b/sonar-server/src/main/webapp/WEB-INF/app/views/markdown/_tips.html.erb
new file mode 100644 (file)
index 0000000..9ba2794
--- /dev/null
@@ -0,0 +1,15 @@
+<div style="min-width: 100px">
+<h3><a onclick="window.open(this.href,'markdown','height=350,width=520,scrollbars=1,resizable=1');return false;"
+       href="<%= url_for :controller => 'markdown', :action => 'help', :layout => 'false' -%>"><%= message('help_tips') -%></a></h3>
+<table>
+  <tr>
+    <td>*<%= message('bold') -%>*</td>
+  </tr>
+  <tr>
+    <td>``<%= message('code') -%>``</td>
+  </tr>
+  <tr>
+    <td>* <%= message('bulleted_point') -%></td>
+  </tr>
+</table>
+</div>
\ No newline at end of file
diff --git a/sonar-server/src/main/webapp/WEB-INF/app/views/markdown/full_help.html.erb b/sonar-server/src/main/webapp/WEB-INF/app/views/markdown/full_help.html.erb
deleted file mode 100644 (file)
index 9b33bb2..0000000
+++ /dev/null
@@ -1,36 +0,0 @@
-<div id="markdown-full-help" style="width:500px">
-<h2>Markdown syntax</h2>
-
-<br/>
-
-<h3>Format text</h3>
-
-<pre class="code">
-*This text will be bold*
-</pre>
-
-<pre class="code">
-* Item 1
-* Item 2
-* Item 3
-</pre>
-
-<pre class="code">
-http://www.google.com is automatically transformed into a link.
-</pre>
-
-<h3>Code</h3>
-
-<pre class="code">
-Please check ``Lists#newArrayList()`` method.
-</pre>
-
-<pre class="code">
-``java
-public void foo() {
-  // do some logic here
-}
-``
-</pre>
-
-</div>
\ No newline at end of file
diff --git a/sonar-server/src/main/webapp/WEB-INF/app/views/markdown/help.html.erb b/sonar-server/src/main/webapp/WEB-INF/app/views/markdown/help.html.erb
new file mode 100644 (file)
index 0000000..c71c745
--- /dev/null
@@ -0,0 +1,52 @@
+<div id="markdown-full-help" style="width:500px">
+  <h2 class="spacer-bottom">Markdown Syntax</h2>
+
+  <table class="width100 table table-bordered spacer-bottom">
+    <thead>
+    <tr>
+      <th>Write :</th>
+      <th>To display :</th>
+    </tr>
+    </thead>
+    <tbody>
+    <tr class="even">
+      <td>*this text is bold*</td>
+      <td><b>this text is bold</b></td>
+    </tr>
+    <tr class="odd">
+      <td>http://sonarsource.org</td>
+      <td><a href="http://sonarsource.org">http://sonarsource.org</a></td>
+    </tr>
+    <tr class="even">
+      <td valign="top">* bulleted point</td>
+      <td class="discussionComment">
+        <ul>
+          <li>bulleted point</li>
+        </ul>
+      </td>
+    </tr>
+    <tr class="odd">
+      <td valign="top">``Lists#newArrayList()``</td>
+      <td><code>Lists#newArrayList()</code></td>
+    </tr>
+    <tr class="even">
+      <td valign="top">
+        ``<br>
+        // code on multiple lines<br>
+        public void foo() {<br>
+        &nbsp;&nbsp;// do some logic here<br>
+        }<br>
+        ``
+      </td>
+      <td valign="top"><pre style="border: 1px dashed #DDD;padding: 5px;color: #444;font-size: 12px;">
+        <code>
+// code on multiple lines
+public void foo() {
+  // do some logic here
+}
+        </code>
+      </pre>
+      </td>
+    </tr>
+  </tbody>
+</table>
index efeca053752a1f565d298156f4917cfd3bb4f2b1..67a66a1c78ccbf93e0d5d5e4fdf06ef3faf900ad 100644 (file)
@@ -13,7 +13,7 @@
       </td>
       <td class="sep"></td>
       <td style="vertical-align:top;width: 90px">
-        <%= render :partial => 'markdown/help' -%>
+        <%= render :partial => 'markdown/tips' -%>
       </td>
     </tr>
   </table>
index c470bfecc5a3f7d38e5dba3e06176245735a4eae..aeafb78549da70d5a9792da2f0994642d7f50dfe 100644 (file)
@@ -14,7 +14,7 @@
       </td>
       <td class="sep"></td>
       <td style="vertical-align:top;width: 90px">
-        <%= render :partial => 'markdown/help' -%>
+        <%= render :partial => 'markdown/tips' -%>
       </td>
     </tr>
   </table>
index 7446f2edc44d4e24dcadfa5a83ee0ff38e86449d..4598ce3bec53c9ec914c0180f9f3567dd6db3cab 100644 (file)
 
     </div>
 
-    <div class="discussionComment first" id="vBody<%= violation.id -%>">
+    <div class="discussionComment first">
       <div id="vMsg<%= violation.id -%>">
         <%= violation.html_message || '&nbsp;' -%>
       </div>
     </div>
 
-    <div class="discussionComment" id="reviewForm<%= violation.id -%>" style="display:none"></div>
-
     <%
        if violation.review
          violation.review.comments.each_with_index do |review_comment, comment_index|
        end
     %>
     <% if current_user %>
-      <div class="vFooter">
+      <div class="vActions" id="vActions<%= violation.id -%>">
         <%= link_to_function message('reviews.comment'), "sCF(#{violation.id})", :name => 'bComment', :class => 'link-action spacer-right' -%>
 
         <% unless violation.review && violation.review.resolved? %>
 
         <% unless violation.switched_off? && violation.review && violation.review.resolved? %>
         <div class="dropdown">
-          <a href="#" class="link-action link-more" onclick="$('vActions<%= violation.id -%>').toggle();return false;"><%= message('more_actions') -%></a>
-          <ul style="display: none" class="dropdown-menu" id="vActions<%= violation.id -%>" onmouseout="this.hide();" onmouseover="this.show();">
+          <a href="#" class="link-action link-more" onclick="$('more<%= violation.id -%>').toggle();return false;"><%= message('more_actions') -%></a>
+          <ul style="display: none" class="dropdown-menu" id="more<%= violation.id -%>" onmouseout="this.hide();" onmouseover="this.show();">
             <% 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 %>
       </div>
     <% end %>
+    <div class="discussionComment" id="reviewForm<%= violation.id -%>" style="display:none"></div>
   </div>
 
 </div>
\ No newline at end of file
index 40b778a58596e90c4652a9b1c8730f7a0e21e066..511c9cbc207a08b7d24abdbe03aa4ed9fe585155 100644 (file)
@@ -23,7 +23,7 @@
       </td>
       <td class="sep"></td>
       <td style="vertical-align:top;width: 90px">
-        <%= render :partial => 'markdown/help' -%>
+        <%= render :partial => 'markdown/tips' -%>
       </td>
     </tr>
   </table>
index 60fcd8ffce6ca6df45a74a46c55081033036a284..15bbd704747ea69da75b92a0630e92c68c06a23f 100644 (file)
@@ -13,7 +13,7 @@
       </td>
       <td class="sep"></td>
       <td style="vertical-align:top;width: 90px">
-        <%= render :partial => 'markdown/help' -%>
+        <%= render :partial => 'markdown/tips' -%>
       </td>
     </tr>
   </table>
index 849abb413d6a070dd9e0e447b0e6b9953ce50715..fc45d84af219b41d026f4edc0a610b5d12d0bd40 100644 (file)
@@ -15,7 +15,7 @@
       </td>
       <td class="sep"></td>
       <td style="vertical-align:top;width: 90px">
-        <%= render :partial => 'markdown/help' -%>
+        <%= render :partial => 'markdown/tips' -%>
       </td>
     </tr>
   </table>
index 745956c18cbc35c2599cd9a759c77a323dd78195..79359eeedea0b91e665e8e0d19015d3ec2ea213b 100644 (file)
@@ -9,7 +9,7 @@
       </td>
       <td class="sep"></td>
       <td style="vertical-align:top;width: 90px">
-        <%= render :partial => 'markdown/help' -%>
+        <%= render :partial => 'markdown/tips' -%>
       </td>
     </tr>
   </table>
index 0f53ad9846d50739320d8ac7b263f772e9b1dafc..51ac1848fbae83177f23a9bfea340951fde4de6e 100644 (file)
@@ -15,7 +15,7 @@
       </td>
       <td class="sep"></td>
       <td style="vertical-align:top;width: 90px">
-        <%= render :partial => 'markdown/help' -%>
+        <%= render :partial => 'markdown/tips' -%>
       </td>
     </tr>
   </table>
index 2cebbd3ffad3e35a0f96ec880b9990130e5ea75b..5d9e06f03da97cca9e8982280a66daee20ec5ac1 100644 (file)
@@ -19,7 +19,7 @@
       </td>
       <td class="sep"></td>
       <td style="vertical-align:top;width: 90px">
-        <%= render :partial => 'markdown/help' -%>
+        <%= render :partial => 'markdown/tips' -%>
       </td>
     </tr>
   </table>
index 79370fd0b1051450a31619eb5ebd36ca6141004e..de2963c8799f52db87e91a25108c0d289ad9c4f8 100644 (file)
@@ -46,7 +46,7 @@
                     onkeyup="if (this.value=='') $('<%= submit_active_note_update_button_id -%>').disabled=true; else $('<%= submit_active_note_update_button_id -%>').disabled=false;"><%= h(note.plain_text) if note -%></textarea>
         </td>
         <td class="markdown-help">
-          <%= render :partial => 'markdown/help' -%>
+          <%= render :partial => 'markdown/tips' -%>
         </td>
       </tr>
     <tr>
index 672b88d5fbf6229e949729f077740231141e5e19..e8ae9b7b3d1b6113a370a47970a236a0be7c643e 100644 (file)
@@ -40,7 +40,7 @@
           <textarea name="text" id="<%= note_textarea_id -%>" rows="10" style="width:100%"><%= h(note.plain_text) if note -%></textarea>
         </td>
         <td class="markdown-help nowrap">
-          <%= render :partial => 'markdown/help' -%>
+          <%= render :partial => 'markdown/tips' -%>
         </td>
       </tr>
     <tr>
index e5d3acaba0ae496355d90c95fa7d1406caffb4b3..1223897743ac4ff3940dd1ff77ce6effee9c6123 100644 (file)
@@ -33,7 +33,7 @@ function cancelViolationAction(violation_id) {
 }
 
 function hideMoreViolationActions(violation_id) {
-  var popup = $('vActions' + violation_id);
+  var popup = $('more' + violation_id);
   if (popup != null) {
     popup.hide();
   }
@@ -48,7 +48,7 @@ function sCF(violation_id) {
         asynchronous:true,
         evalScripts:true,
         onComplete:function (request) {
-          $('vBody' + violation_id).remove();
+          $('vActions' + violation_id).remove();
           $('reviewForm' + violation_id).show();
           $('commentText' + violation_id).focus();
         }
@@ -65,7 +65,7 @@ function sCSF(violation_id) {
         asynchronous:true,
         evalScripts:true,
         onComplete:function (request) {
-          $('vBody' + violation_id).remove();
+          $('vActions' + violation_id).remove();
           $('reviewForm' + violation_id).show();
           $('selectSeverity' + violation_id).focus();
         }
@@ -82,7 +82,7 @@ function sCStF(violation_id) {
         asynchronous:true,
         evalScripts:true,
         onComplete:function (request) {
-          $('vBody' + violation_id).remove();
+          $('vActions' + violation_id).remove();
           $('reviewForm' + violation_id).show();
           $('commentText' + violation_id).focus();
         }
@@ -99,7 +99,7 @@ function sFPF(violation_id) {
         asynchronous:true,
         evalScripts:true,
         onComplete:function (request) {
-          $('vBody' + violation_id).remove();
+          $('vActions' + violation_id).remove();
           $('reviewForm' + violation_id).show();
           $('commentText' + violation_id).focus();
         }
@@ -116,7 +116,7 @@ function sAF(violation_id) {
         asynchronous:true,
         evalScripts:true,
         onComplete:function (request) {
-          $('vBody' + violation_id).remove();
+          $('vActions' + violation_id).remove();
           $('reviewForm' + violation_id).show();
           $('assignee_login').focus();
         }
@@ -133,7 +133,7 @@ function sAPF(violation_id) {
         asynchronous:true,
         evalScripts:true,
         onComplete:function (request) {
-          $('vBody' + violation_id).remove();
+          $('vActions' + violation_id).remove();
           $('reviewForm' + violation_id).show();
           $('action_plan').focus();
         }
index d85f39419e9f389478c7a037a51a510027dde455..ec4912a167ccdc3158e0fb6ef9fc339aa945b068 100644 (file)
@@ -886,7 +886,7 @@ div.vtitle img {
   vertical-align: text-bottom;
 }
 
-div.vFooter {
+div.vActions {
   padding: 5px 10px;
   border-top: 1px solid #DDD;
   background-color: #EFEFEF;
@@ -1142,7 +1142,7 @@ table.reviewDetails td img {
   vertical-align: bottom;
 }
 
-div.discussion {
+.discussion {
   width: 100%;
   border: 1px solid #DDDDDD;
 }
@@ -1151,7 +1151,7 @@ div.discussion {
   border-top: none;
 }
 
-div.discussionComment {
+.discussionComment {
   background-color: #EFEFEF;
   border-top: 1px solid #DDDDDD;
   line-height: 1.5em;
@@ -1159,18 +1159,24 @@ div.discussionComment {
   padding: 5px 10px;
 }
 
-div.discussionComment h4 {
+.discussionComment h4 {
   font-size: 90%;
   margin-bottom: 2px;
 }
 
-div.discussionComment h4 img {
+.discussionComment h4 img {
   vertical-align: sub;
 }
 
-div.discussionComment li {
+.discussionComment li {
   list-style: square inside;
 }
+.discussionComment pre {
+  padding: 10px;
+  border: 1px dashed #DDD;
+  color: #444;
+  font-size: 12px;
+}
 
 div.comment-excerpt {
   background-color: transparent;