mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-02-24 23:48:13 -05:00
add "delete post" button to the PSM (#649)
closes https://github.com/TryGhost/Ghost/issues/8332 - moves `toggleDeletePostModal` action from the `edit` controller to the `editor-base-controller` mixin - adds delete button to the bottom of the PSM unless it's a new post - adds `deletePost` attribute to `gh-post-settings-menu` to allow a delete post action to be passed in
This commit is contained in:
parent
aaed8d9cf4
commit
14e26f79ac
5 changed files with 21 additions and 11 deletions
|
@ -388,6 +388,12 @@ export default Component.extend(SettingsMenuMixin, {
|
|||
if (tag.get('isNew')) {
|
||||
tag.destroyRecord();
|
||||
}
|
||||
},
|
||||
|
||||
deletePost() {
|
||||
if (this.get('deletePost')) {
|
||||
this.get('deletePost')();
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
|
|
@ -1,12 +1,4 @@
|
|||
import Controller from 'ember-controller';
|
||||
import EditorControllerMixin from 'ghost-admin/mixins/editor-base-controller';
|
||||
|
||||
export default Controller.extend(EditorControllerMixin, {
|
||||
showDeletePostModal: false,
|
||||
|
||||
actions: {
|
||||
toggleDeletePostModal() {
|
||||
this.toggleProperty('showDeletePostModal');
|
||||
}
|
||||
}
|
||||
});
|
||||
export default Controller.extend(EditorControllerMixin);
|
||||
|
|
|
@ -35,6 +35,7 @@ export default Mixin.create({
|
|||
|
||||
showLeaveEditorModal: false,
|
||||
showReAuthenticateModal: false,
|
||||
showDeletePostModal: false,
|
||||
|
||||
application: injectController(),
|
||||
notifications: injectService(),
|
||||
|
@ -539,8 +540,8 @@ export default Mixin.create({
|
|||
},
|
||||
|
||||
updateTitle() {
|
||||
let currentTitle = this.model.get('title');
|
||||
let newTitle = this.model.get('titleScratch').trim();
|
||||
let currentTitle = this.get('model.title');
|
||||
let newTitle = this.get('model.titleScratch').trim();
|
||||
|
||||
if (currentTitle === newTitle) {
|
||||
return;
|
||||
|
@ -557,6 +558,12 @@ export default Mixin.create({
|
|||
}
|
||||
},
|
||||
|
||||
toggleDeletePostModal() {
|
||||
if (!this.get('model.isNew')) {
|
||||
this.toggleProperty('showDeletePostModal');
|
||||
}
|
||||
},
|
||||
|
||||
toggleReAuthenticateModal() {
|
||||
this.toggleProperty('showReAuthenticateModal');
|
||||
},
|
||||
|
|
|
@ -113,6 +113,10 @@
|
|||
</label>
|
||||
</div>
|
||||
|
||||
{{#unless model.isNew}}
|
||||
<button type="button" class="gh-btn gh-btn-link gh-btn-sm gh-btn-icon tag-delete-button" {{action "deletePost"}}><span>{{inline-svg "trash"}} Delete Post</span></button>
|
||||
{{/unless}}
|
||||
|
||||
</form>
|
||||
</div>{{! .settings-menu-content }}
|
||||
</div>{{! .post-settings-menu }}
|
||||
|
|
|
@ -82,5 +82,6 @@
|
|||
showSettingsMenu=application.showSettingsMenu
|
||||
closeNavMenu=(action "closeNavMenu")
|
||||
closeMenus=(action "closeMenus")
|
||||
deletePost=(action "toggleDeletePostModal")
|
||||
}}
|
||||
{{/liquid-wormhole}}
|
||||
|
|
Loading…
Add table
Reference in a new issue