Fix Ctrl-S saving

Refactored into separate button handler that passes the status.
Although, it doesn't look like the status is on the button element any
more.
This commit is contained in:
Jacob Gable 2013-09-01 19:38:06 -05:00
parent d2cafe87b6
commit 67901ff699

View File

@ -60,7 +60,7 @@
events: {
'click [data-set-status]': 'handleStatus',
'click .js-post-button': 'updatePost'
'click .js-post-button': 'handlePostButton'
},
statusMap: {
@ -144,14 +144,22 @@
$('body').find('.overlay:visible').fadeOut();
},
updatePost: function (e) {
if (e) { e.preventDefault(); }
handlePostButton: function (e) {
e.preventDefault();
var status = $(e.currentTarget).attr("data-status");
this.updatePost(status);
},
updatePost: function (status) {
var self = this,
model = this.model,
$currentTarget = $(e.currentTarget),
status = $currentTarget.attr('data-status'),
prevStatus = model.get('status');
// Default to same status if not passed in
status = status || prevStatus;
if (status === 'publish-on') {
return Ghost.notifications.addItem({
type: 'alert',