Rough cut of line-level comments.
Changes
--- a/review/web_media/comments.js Thu Oct 22 18:27:11 2009 -0400
+++ b/review/web_media/comments.js Thu Oct 22 19:08:08 2009 -0400
@@ -1,11 +1,18 @@
$(function() {
- $("form").hide();
+ $("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");
return false;
});
+
+ $("tr.rem, tr.add, tr.con").click(function(event) {
+ $(event.target).closest("tr").addClass("comment-line-selected");
+ $(event.target).closest("tr").next("tr.comment-line").fadeIn("fast");
+ return false;
+ });
});
\ No newline at end of file
--- a/review/web_media/style.css Thu Oct 22 18:27:11 2009 -0400
+++ b/review/web_media/style.css Thu Oct 22 19:08:08 2009 -0400
@@ -47,6 +47,9 @@
table tr td.last {
text-align: right;
}
+table tr form * {
+ margin: 0em;
+}
/* Review pages. */
div.filename-header {
@@ -85,6 +88,9 @@
}
div#comment-file form {
}
+tr.comment-line-selected {
+ background-color: #FBEAD0;
+}
/* Diffs. */
div.diff {
@@ -93,6 +99,9 @@
div.diff table tr {
white-space: pre;
}
+div.diff table tr.comment-line {
+ white-space: normal;
+}
table tr.add {
background: #DBF3D1;
}
--- a/review/web_templates/review.html Thu Oct 22 18:27:11 2009 -0400
+++ b/review/web_templates/review.html Thu Oct 22 19:08:08 2009 -0400
@@ -69,7 +69,7 @@
<tr class="skipped">
<td><code>… skipped ${ skipped_count } lines …</code></td>
</tr>
- $ kind = 'rem' if line[0] == '-' else 'add' if line[0] == '+' else ''
+ $ kind = 'rem' if line[0] == '-' else 'add' if line[0] == '+' else 'con'
<tr class="${ kind }">
<td class="diff-line"><code>${ line[1:] or ' ' }</code></td>
</tr>
@@ -82,9 +82,24 @@
<div class="message">${ comment.message }</div>
</div>
</td></tr>
+ <tr class="comment-line">
+ <td>
+ <form id="comment-line-form" method="post" action="">
+ <div class="field">
+ <label for="body">Add a comment on this line:</label>
+ <textarea cols="60" rows="6" name="body"></textarea>
+ </div>
+ <div class="buttons">
+ <input type="submit" class="button" value="Submit" />
+ </div>
+ <input type="hidden" name="filename" value="${ filename }" />
+ <input type="hidden" name="lines" value="${ n }" />
+ </form>
+ </td>
+ </tr>
$ previous_n = n
- $if previous_n < diff['max']:
- $ skipped_count = diff['max'] - previous_n
+ $if previous_n < max_line:
+ $ skipped_count = max_line - previous_n
<tr class="skipped">
<td><code>… skipped ${ skipped_count } lines …</code></td>
</tr>
--- a/review/web_ui.py Thu Oct 22 18:27:11 2009 -0400
+++ b/review/web_ui.py Thu Oct 22 19:08:08 2009 -0400
@@ -62,10 +62,12 @@
i = web.input()
body = i['body']
filename = i['filename'] if 'filename' in i else ''
+ lines = i['lines'].split(',') if 'lines' in i else ''
+ print filename, lines
if body:
rcset = _rd[node_short]
- rcset.add_comment(body, filename)
+ rcset.add_comment(body, filename, lines)
raise web.seeother('/review/%s/' % node_short)