review/web_media/comments.js @ c43c4b53762b
Fix the context line bgcolor bug.
author |
Steve Losh <steve@stevelosh.com> |
date |
Sat, 27 Mar 2010 13:20:50 -0400 |
parents |
f841259cc87e |
children |
9d032dbf867d |
$(function() {
$("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.commentable,tr.add.commentable,tr.con.commentable").click(function(event) {
$(event.target).closest("tr").addClass("comment-line-selected");
var filename = $(event.target).closest("tr").find(".line-data").children(".filename").first().text();
var linenumber = $(event.target).closest("tr").find(".line-data").children(".linenumber").first().html();
var comment_form = '<tr class="comment-line">\n\
<td>\n\
<form id="comment-line-form" method="post" action="">\n\
<div class="field">\n\
<label for="body">Add a comment on this line:</label>\n\
<textarea cols="60" rows="6" name="new-comment-body"></textarea>\n\
</div>\n\
<div class="buttons">\n\
<input type="submit" class="button" value="Submit" />\n\
</div>\n\
<input type="hidden" name="filename" value="<<<FILENAME>>>" />\n\
<input type="hidden" name="lines" value="<<<LINENUMBER>>>" />\n\
</form>\n\
</td>\n\
</tr>';
comment_form = comment_form.replace('<<<FILENAME>>>', filename);
comment_form = comment_form.replace('<<<LINENUMBER>>>', linenumber);
$(event.target).closest("tr").after(comment_form);
return false;
});
});