ebc5f7c7a6b7

Add cancel links to comment/signoff forms to hide them.
[view raw] [browse files]
author Steve Losh <steve@stevelosh.com>
date Sun, 02 May 2010 16:28:22 -0400
parents 9d032dbf867d
children f5bdfc1d952f
branches/tags (none)
files review/web_media/comments.js review/web_media/style.css review/web_templates/changeset.html

Changes

--- a/review/web_media/comments.js	Sat May 01 13:51:22 2010 -0400
+++ b/review/web_media/comments.js	Sun May 02 16:28:22 2010 -0400
@@ -3,13 +3,19 @@
     $("div > form").hide();
     $("tr:has(form)").hide();
     
-    $("p.comment-activate a").click(function(event) {
-        $(event.target).hide();
-        $(event.target).closest("div").children("form").fadeIn("fast");
+    
+    $("span.cancel a").click(function(event) {
+        $(event.target).closest("div.input").children(".activate").children("a").show();
+        $(event.target).parents("form").hide();
         return false;
     });
     
-    $("p.signoff-activate a").click(function(event) {
+    $("span.cancel-line a").live("click", function(event) {
+        $(event.target).closest("tr").remove();
+        return false;
+    });
+    
+    $(".input .activate a").click(function(event) {
         $(event.target).hide();
         $(event.target).closest("div").children("form").fadeIn("fast");
         return false;
@@ -29,6 +35,7 @@
                         </div>\n\
                         <div class="buttons">\n\
                             <input type="submit" class="button" value="Submit" />\n\
+                            <span class="cancel-line"><a href="">Cancel</a></span>\n\
                         </div>\n\
                         <input type="hidden" name="filename" value="<<<FILENAME>>>" />\n\
                         <input type="hidden" name="lines" value="<<<LINENUMBER>>>" />\n\
--- a/review/web_media/style.css	Sat May 01 13:51:22 2010 -0400
+++ b/review/web_media/style.css	Sun May 02 16:28:22 2010 -0400
@@ -184,3 +184,8 @@
 div.diff .comment {
     margin-bottom: 0em;
 }
+
+.debug {
+    border: 2px solid green;
+    background-color: red;
+}
\ No newline at end of file
--- a/review/web_templates/changeset.html	Sat May 01 13:51:22 2010 -0400
+++ b/review/web_templates/changeset.html	Sun May 02 16:28:22 2010 -0400
@@ -20,8 +20,8 @@
     {% endfor %}
     
     {% if not read_only %}
-        <div id="comment-review">
-            <p class="comment-activate"><a href="">Add a comment on this changeset</a></p>
+        <div id="comment-review" class="input">
+            <p class="activate"><a href="">Add a comment on this changeset</a></p>
             <form id="comment-review-form" method="post" action="">
                 <div class="field">
                     <label for="body">Add a comment on this changeset:</label>
@@ -29,6 +29,7 @@
                 </div>
                 <div class="buttons">
                     <input type="submit" class="button" value="Submit" />
+                    <span class="cancel"><a href="#">Cancel</a></span>
                 </div>
             </form>
         </div>
@@ -50,8 +51,8 @@
     {% endfor %}
     
     {% if not read_only %}
-        <div id="signoff-review">
-            <p class="signoff-activate">
+        <div id="signoff-review" class="input">
+            <p class="activate">
                 {% if cu_signoff %}
                     <a href="#">Change your signoff</a>
                 {% else %}
@@ -70,6 +71,7 @@
                 </div>
                 <div class="buttons">
                     <input type="submit" class="button" value="Submit" />
+                    <span class="cancel"><a href="#">Cancel</a></span>
                 </div>
             </form>
         </div>
@@ -100,8 +102,8 @@
                 {% endfor %}
                 
                 {% if not read_only %}
-                    <div id="comment-file">
-                        <p class="comment-activate"><a href="">Add a comment on this file</a></p>
+                    <div id="comment-file" class="input">
+                        <p class="activate"><a href="">Add a comment on this file</a></p>
                         
                         <form id="comment-file-form" method="post" action="">
                             <div class="field">
@@ -110,6 +112,7 @@
                             </div>
                             <div class="buttons">
                                 <input type="submit" class="button" value="Submit" />
+                                <span class="cancel"><a href="#">Cancel</a></span>
                             </div>
                             <input type="hidden" name="filename" value="{{ filename }}" />
                         </form>