From b55893d96de2493db62a2125d31fa9c8b1c8b109 Mon Sep 17 00:00:00 2001 From: albert Date: Sat, 10 Sep 2011 15:29:55 -0400 Subject: [PATCH] fixed tn notes --- app/assets/javascripts/notes.js | 6 +++++- app/views/notes/_note.html.erb | 2 +- app/views/posts/partials/show/_notes.html.erb | 3 --- 3 files changed, 6 insertions(+), 5 deletions(-) delete mode 100644 app/views/posts/partials/show/_notes.html.erb diff --git a/app/assets/javascripts/notes.js b/app/assets/javascripts/notes.js index 6ba61a8aa..55b0a3816 100644 --- a/app/assets/javascripts/notes.js +++ b/app/assets/javascripts/notes.js @@ -196,6 +196,8 @@ Danbooru.Note = { }, set_text: function($note_body, text) { + text = text.replace('', '

'); + text = text.replace('', '

'); $note_body.html(text); Danbooru.Note.Body.resize($note_body); Danbooru.Note.Body.bound_position($note_body); @@ -235,7 +237,7 @@ Danbooru.Note = { }); if ($note_body.html() !== "Click to edit") { - $textarea.val($note_body.html()); + $textarea.val($note_body.data("original-body")); } $dialog = $('
'); @@ -301,6 +303,7 @@ Danbooru.Note = { var $note_body = Danbooru.Note.Body.find(id); var $note_box = Danbooru.Note.Box.find(id); var text = $textarea.val(); + $note_body.data("original-body", text); Danbooru.Note.Body.set_text($note_body, text); $this.dialog("close"); @@ -413,6 +416,7 @@ Danbooru.Note = { $("div#note-container").append($note_box); $("div#note-container").append($note_body); + $note_body.data("original-body", text); Danbooru.Note.Box.scale($note_box); Danbooru.Note.Box.resize_inner_border($note_box); Danbooru.Note.Body.set_text($note_body, text); diff --git a/app/views/notes/_note.html.erb b/app/views/notes/_note.html.erb index c805e9a07..3c9d2503a 100644 --- a/app/views/notes/_note.html.erb +++ b/app/views/notes/_note.html.erb @@ -1 +1 @@ -<%= content_tag(:article, note.body, "data-width" => note.width, "data-height" => note.height, "data-x" => note.x, "data-y" => note.y, "data-id" => note.id) %> +<%= content_tag(:article, raw(note.body), "data-width" => note.width, "data-height" => note.height, "data-x" => note.x, "data-y" => note.y, "data-id" => note.id) %> diff --git a/app/views/posts/partials/show/_notes.html.erb b/app/views/posts/partials/show/_notes.html.erb deleted file mode 100644 index e88caea55..000000000 --- a/app/views/posts/partials/show/_notes.html.erb +++ /dev/null @@ -1,3 +0,0 @@ -<% notes.each do |note| %> - <%= content_tag(:article, "", "data-width" => note.width, "data-height" => note.height, "data-x" => note.x, "data-y" => note.y, "data-body" => note.body, "data-id" => note.id) %> -<% end %>