This commit is contained in:
Toks
2013-05-08 08:57:50 -04:00
parent 5ba524b29f
commit 48d95cfae3
3 changed files with 23 additions and 3 deletions

View File

@@ -360,7 +360,11 @@ Danbooru.Note = {
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);
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);
$note_body.show();
});
$this.dialog("close");
if (id.match(/\d/)) {
@@ -386,8 +390,11 @@ Danbooru.Note = {
var id = $this.data("id");
var $note_body = Danbooru.Note.Body.find(id);
var text = $textarea.val();
Danbooru.Note.Body.set_text($note_body, text);
$note_body.show();
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);
$note_body.show();
});
},
cancel: function() {

View File

@@ -0,0 +1,12 @@
class NotePreviewsController < ApplicationController
respond_to :json
def show
@body = DText.sanitize(params[:body].to_s)
respond_with(@body) do |format|
format.json do
render :json => {:body => @body}.to_json
end
end
end
end

View File

@@ -120,6 +120,7 @@ Danbooru::Application.routes.draw do
end
end
resources :note_versions, :only => [:index]
resource :note_previews, :only => [:show]
resources :pools do
member do
put :revert