mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-11-28 05:37:34 +03:00
Merge pull request #336 from matthojo/Delete-modals
Moved delete post confirm alert to new modal format
This commit is contained in:
commit
11be64c544
1
core/client/tpl/modals/blank.hbs
Normal file
1
core/client/tpl/modals/blank.hbs
Normal file
@ -0,0 +1 @@
|
||||
{{content.text}}
|
@ -182,9 +182,11 @@
|
||||
// Initiate functions for buttons here so models don't get tied up.
|
||||
this.acceptModal = function () {
|
||||
this.model.options.confirm.accept.func();
|
||||
self.removeItem();
|
||||
};
|
||||
this.rejectModal = function () {
|
||||
this.model.options.confirm.reject.func();
|
||||
self.removeItem();
|
||||
};
|
||||
shortcut.remove("ESC");
|
||||
$(document).off('click', '.modal-background');
|
||||
|
@ -141,30 +141,54 @@
|
||||
|
||||
deletePost: function (e) {
|
||||
e.preventDefault();
|
||||
if (window.confirm('Are you sure you want to delete this post?')) {
|
||||
var self = this,
|
||||
title = self.model.get('title');
|
||||
|
||||
self.model.destroy({
|
||||
wait: true
|
||||
}).then(function () {
|
||||
self.addSubview(new Ghost.Views.NotificationCollection({
|
||||
model: [{
|
||||
type: 'success',
|
||||
message: 'Your post: ' + title + ' has been deleted',
|
||||
status: 'passive'
|
||||
}]
|
||||
}));
|
||||
}, function () {
|
||||
self.addSubview(new Ghost.Views.NotificationCollection({
|
||||
model: [{
|
||||
type: 'error',
|
||||
message: 'Your post: ' + title + ' has not been deleted.',
|
||||
status: 'passive'
|
||||
}]
|
||||
}));
|
||||
});
|
||||
}
|
||||
var self = this,
|
||||
title = self.model.get('title');
|
||||
this.addSubview(new Ghost.Views.Modal({
|
||||
model: {
|
||||
options: {
|
||||
close: false,
|
||||
confirm: {
|
||||
accept: {
|
||||
func: function () {
|
||||
self.model.destroy({
|
||||
wait: true
|
||||
}).then(function () {
|
||||
self.addSubview(new Ghost.Views.NotificationCollection({
|
||||
model: [{
|
||||
type: 'success',
|
||||
message: 'Your post: ' + title + ' has 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) {
|
||||
|
Loading…
Reference in New Issue
Block a user