diff options
author | Cornelio Hopmann <hopmann@gmail.com> | 2013-11-10 04:06:22 +0400 |
---|---|---|
committer | Cornelio Hopmann <hopmann@gmail.com> | 2013-11-10 17:01:29 +0400 |
commit | 92b7c569a7d3249968108afab3a7c32c0cdcbc8c (patch) | |
tree | 76f683589be480bd84e02e8f19d4f2ed21028bf2 /app/assets/javascripts/notes.js | |
parent | fa323c0ca112aeab52869efd84f2cb137558967b (diff) |
FIX: note-original-content appending itself too many times
Diffstat (limited to 'app/assets/javascripts/notes.js')
-rw-r--r-- | app/assets/javascripts/notes.js | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/app/assets/javascripts/notes.js b/app/assets/javascripts/notes.js index 5225623c1f0..defbf81f580 100644 --- a/app/assets/javascripts/notes.js +++ b/app/assets/javascripts/notes.js @@ -233,10 +233,12 @@ var NoteList = { form.show(); var textarea = form.find("textarea"); - var p = $("<p></p>").text(textarea.val()); - var hidden_div = $('<div class="note-original-content"></div>').append(p); - form.append(hidden_div); - hidden_div.hide(); + if (form.find(".note-original-content").length === 0) { + var p = $("<p></p>").text(textarea.val()); + var hidden_div = $('<div class="note-original-content"></div>').append(p); + form.append(hidden_div); + hidden_div.hide(); + } textarea.focus(); }, @@ -532,6 +534,8 @@ var NoteList = { note_text.html(response.note).show(); var note_form = note_li.find(".note-edit-form"); + var original_content = note_form.find(".note-original-content"); + original_content.remove(); note_form.hide(); note_form.find(".btn-save").enableButton(); |