review/web_media/comments.js @ b8654f4e6386
Fix the message when cloning an existing review data store.
author |
Steve Losh <steve@stevelosh.com> |
date |
Sat, 01 May 2010 11:48:45 -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;
});
});