0
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2025-02-17 23:44:39 -05:00

Moved delete post confirm alert to new modal format

This commit is contained in:
Matthew Harrison-Jones 2013-08-05 10:16:31 +01:00
parent 30a64b0a4d
commit 98dbf8e7ce
3 changed files with 51 additions and 24 deletions

View file

@ -0,0 +1 @@
{{content.text}}

View file

@ -182,9 +182,11 @@
// Initiate functions for buttons here so models don't get tied up. // Initiate functions for buttons here so models don't get tied up.
this.acceptModal = function () { this.acceptModal = function () {
this.model.options.confirm.accept.func(); this.model.options.confirm.accept.func();
self.removeItem();
}; };
this.rejectModal = function () { this.rejectModal = function () {
this.model.options.confirm.reject.func(); this.model.options.confirm.reject.func();
self.removeItem();
}; };
shortcut.remove("ESC"); shortcut.remove("ESC");
$(document).off('click', '.modal-background'); $(document).off('click', '.modal-background');

View file

@ -141,30 +141,54 @@
deletePost: function (e) { deletePost: function (e) {
e.preventDefault(); e.preventDefault();
if (window.confirm('Are you sure you want to delete this post?')) { var self = this,
var self = this, title = self.model.get('title');
title = self.model.get('title'); this.addSubview(new Ghost.Views.Modal({
model: {
self.model.destroy({ options: {
wait: true close: false,
}).then(function () { confirm: {
self.addSubview(new Ghost.Views.NotificationCollection({ accept: {
model: [{ func: function () {
type: 'success', self.model.destroy({
message: 'Your post: ' + title + ' has been deleted', wait: true
status: 'passive' }).then(function () {
}] self.addSubview(new Ghost.Views.NotificationCollection({
})); model: [{
}, function () { type: 'success',
self.addSubview(new Ghost.Views.NotificationCollection({ message: 'Your post: ' + title + ' has been deleted',
model: [{ status: 'passive'
type: 'error', }]
message: 'Your post: ' + title + ' has not been deleted.', }));
status: 'passive' }, function () {
}] self.addSubview(new Ghost.Views.NotificationCollection({
})); model: [{
}); type: 'error',
} message: 'Your post: ' + title + ' has not been deleted.',
status: 'passive'
}]
}));
});
},
text: "Yes"
},
reject: {
func: function () {
return true;
},
text: "No"
}
},
type: "action",
style: "wide",
animation: 'fadeIn'
},
content: {
template: 'blank',
title: 'Are you sure you want to delete this post?'
}
}
}));
}, },
editPost: function (e) { editPost: function (e) {