fixes #1504
This commit is contained in:
@@ -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() {
|
||||
|
||||
12
app/controllers/note_previews_controller.rb
Normal file
12
app/controllers/note_previews_controller.rb
Normal 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
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user