mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-02-24 23:48:13 -05:00
Merge pull request #2097 from zacgeis/publishbutton-fix
Disable publish button until deffered is resolved
This commit is contained in:
commit
7151692c67
1 changed files with 15 additions and 3 deletions
|
@ -220,11 +220,22 @@
|
|||
},
|
||||
|
||||
savePost: function (data) {
|
||||
var publishButton = $('.js-publish-button'),
|
||||
saved,
|
||||
enablePublish = function (deferred) {
|
||||
deferred.always(function () {
|
||||
publishButton.prop('disabled', false);
|
||||
});
|
||||
return deferred;
|
||||
};
|
||||
|
||||
publishButton.prop('disabled', true);
|
||||
|
||||
_.each(this.model.blacklist, function (item) {
|
||||
this.model.unset(item);
|
||||
}, this);
|
||||
|
||||
var saved = this.model.save(_.extend({
|
||||
saved = this.model.save(_.extend({
|
||||
title: $('#entry-title').val(),
|
||||
markdown: Ghost.currentView.getEditorValue()
|
||||
}, data));
|
||||
|
@ -232,9 +243,10 @@
|
|||
// TODO: Take this out if #2489 gets merged in Backbone. Or patch Backbone
|
||||
// ourselves for more consistent promises.
|
||||
if (saved) {
|
||||
return saved;
|
||||
return enablePublish(saved);
|
||||
}
|
||||
return $.Deferred().reject();
|
||||
|
||||
return enablePublish($.Deferred().reject());
|
||||
},
|
||||
|
||||
reportSaveSuccess: function (status, prevStatus) {
|
||||
|
|
Loading…
Add table
Reference in a new issue