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:
parent
30a64b0a4d
commit
98dbf8e7ce
3 changed files with 51 additions and 24 deletions
1
ghost/admin/tpl/modals/blank.hbs
Normal file
1
ghost/admin/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.
|
// 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');
|
||||||
|
|
|
@ -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) {
|
||||||
|
|
Loading…
Add table
Reference in a new issue