index page cannot be deleted
This commit is contained in:
parent
54c7690e26
commit
eeeb4f9af6
1 changed files with 8 additions and 0 deletions
|
@ -22,10 +22,14 @@ export default class PostEditor {
|
||||||
this.post = [];
|
this.post = [];
|
||||||
this.postID = null;
|
this.postID = null;
|
||||||
this.postUUID = null;
|
this.postUUID = null;
|
||||||
|
this.postLayout = null;
|
||||||
api.authStatus();
|
api.authStatus();
|
||||||
if (document.getElementById('post-edit-index').getAttribute('data-index')) {
|
if (document.getElementById('post-edit-index').getAttribute('data-index')) {
|
||||||
this.postID = document.getElementById('post-edit-index').getAttribute('data-index');
|
this.postID = document.getElementById('post-edit-index').getAttribute('data-index');
|
||||||
this.postUUID = document.getElementById('post-edit-index').getAttribute('data-uuid');
|
this.postUUID = document.getElementById('post-edit-index').getAttribute('data-uuid');
|
||||||
|
this.postLayout = document
|
||||||
|
.getElementById('post-edit-index')
|
||||||
|
.getAttribute('data-layout');
|
||||||
}
|
}
|
||||||
if (document.getElementById('edit-post-text')) {
|
if (document.getElementById('edit-post-text')) {
|
||||||
this.editor = new TextEditor(
|
this.editor = new TextEditor(
|
||||||
|
@ -163,6 +167,10 @@ export default class PostEditor {
|
||||||
});
|
});
|
||||||
break;
|
break;
|
||||||
case EditorEvent.EDITOR_DELETE:
|
case EditorEvent.EDITOR_DELETE:
|
||||||
|
if (this.postLayout === 'index') {
|
||||||
|
notify.alert('Index cannot be deleted', false);
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (confirm("AYE! You know you're deleting this post, right?")) {
|
if (confirm("AYE! You know you're deleting this post, right?")) {
|
||||||
let id = { id: this.postUUID };
|
let id = { id: this.postUUID };
|
||||||
api.request(
|
api.request(
|
||||||
|
|
Loading…
Reference in a new issue