mirror of
https://github.com/discourse/discourse.git
synced 2025-09-07 12:02:53 +08:00
- Support for a popup that shows similar topics - Cleaned up a lot of Javascript - Cleaned up use of Promises
50 lines
887 B
JavaScript
50 lines
887 B
JavaScript
/**
|
|
A data model representing a draft post
|
|
|
|
@class Draft
|
|
@extends Discourse.Model
|
|
@namespace Discourse
|
|
@module Discourse
|
|
**/
|
|
Discourse.Draft = Discourse.Model.extend({});
|
|
|
|
Discourse.Draft.reopenClass({
|
|
|
|
clear: function(key, sequence) {
|
|
return $.ajax({
|
|
type: 'DELETE',
|
|
url: "/draft",
|
|
data: {
|
|
draft_key: key,
|
|
sequence: sequence
|
|
}
|
|
});
|
|
},
|
|
|
|
get: function(key) {
|
|
return $.ajax({
|
|
url: '/draft',
|
|
data: { draft_key: key },
|
|
dataType: 'json'
|
|
});
|
|
},
|
|
|
|
getLocal: function(key, current) {
|
|
var local;
|
|
return current;
|
|
},
|
|
|
|
save: function(key, sequence, data) {
|
|
data = typeof data === "string" ? data : JSON.stringify(data);
|
|
return $.ajax({
|
|
type: 'POST',
|
|
url: "/draft",
|
|
data: {
|
|
draft_key: key,
|
|
data: data,
|
|
sequence: sequence
|
|
}
|
|
});
|
|
}
|
|
|
|
});
|