This commit is contained in:
Toks
2013-05-26 10:25:00 -04:00
parent 70616dd1a7
commit 9a2dce89aa
2 changed files with 12 additions and 2 deletions

View File

@@ -32,6 +32,7 @@ Danbooru.Note = {
"dragstart resizestart",
function(e) {
var $note_box_inner = $(e.currentTarget);
$note_box_inner.find(".note-box-inner-border").addClass("unsaved");
Danbooru.Note.dragging = true;
Danbooru.Note.clear_timeouts();
Danbooru.Note.Body.hide_all();
@@ -356,12 +357,15 @@ Danbooru.Note = {
},
success_handler: function(data, status, xhr) {
if (data.html_id) {
if (data.html_id) { // new note
var $note_body = Danbooru.Note.Body.find(data.html_id);
var $note_box = Danbooru.Note.Box.find(data.html_id);
$note_body.data("id", String(data.id)).attr("data-id", data.id);
$note_box.data("id", String(data.id)).attr("data-id", data.id);
$note_box.find(".note-box-inner-border").removeClass("unsaved");
} else {
var $note_box = Danbooru.Note.Box.find(data.id);
$note_box.find(".note-box-inner-border").removeClass("unsaved");
}
},
@@ -403,6 +407,8 @@ Danbooru.Note = {
var id = $this.data("id");
var $note_body = Danbooru.Note.Body.find(id);
var text = $textarea.val();
var $note_box = Danbooru.Note.Box.find(id);
$note_box.find(".note-box-inner-border").addClass("unsaved");
Danbooru.Note.Body.set_text($note_body, "Loading...");
$.get("/note_previews.json", {body: text}).success(function(data) {
Danbooru.Note.Body.set_text($note_body, data.body);

View File

@@ -31,7 +31,11 @@ class NotesController < ApplicationController
def update
@note = Note.find(params[:id])
@note.update_attributes(params[:note])
respond_with(@note)
respond_with(@note) do |format|
format.json do
render :json => @note.to_json
end
end
end
def destroy