2012-02-24 21:36:44 +01:00
|
|
|
- if note.valid?
|
|
|
|
:plain
|
2012-09-14 01:32:55 +02:00
|
|
|
// hide and reset the form
|
2012-02-24 21:36:44 +01:00
|
|
|
$(".per_line_form").hide();
|
2012-08-30 20:31:55 +02:00
|
|
|
$('.line-note-form-holder textarea').val("");
|
2012-09-14 01:32:55 +02:00
|
|
|
|
|
|
|
// find the reply button for this line
|
|
|
|
// (might not be there if this is the first note)
|
|
|
|
var trRpl = $("a.line_note_reply_link[data-line-code='#{note.line_code}']").closest("tr");
|
|
|
|
if (trRpl.size() == 0) {
|
|
|
|
// find the commented line ...
|
|
|
|
var trEl = $(".#{note.line_code}").parent();
|
|
|
|
// ... and insert the note and the reply button after it
|
2012-09-14 05:10:06 +02:00
|
|
|
trEl.after("#{escape_javascript(render "notes/per_line_reply_button", line_code: note.line_code)}");
|
2012-09-14 05:21:58 +02:00
|
|
|
trEl.after("#{escape_javascript(render "notes/per_line_note", note: note)}");
|
2012-09-14 01:32:55 +02:00
|
|
|
} else {
|
|
|
|
// instert new note before reply button
|
2012-09-14 05:21:58 +02:00
|
|
|
trRpl.before("#{escape_javascript(render "notes/per_line_note", note: note)}");
|
2012-09-14 01:32:55 +02:00
|
|
|
}
|