diff --git a/client/js/controllers/post_controller.js b/client/js/controllers/post_controller.js index 43ac8908..5d6440ab 100644 --- a/client/js/controllers/post_controller.js +++ b/client/js/controllers/post_controller.js @@ -101,7 +101,7 @@ class PostController { } _evtPostEdit(e) { - // TODO: disable form + this._view.sidebarControl.disableForm(); const post = e.detail.post; if (e.detail.tags !== undefined) { post.tags = e.detail.tags; @@ -123,11 +123,12 @@ class PostController { } post.save() .then(() => { + this._view.sidebarControl.showSuccess('Post saved.'); + this._view.sidebarControl.enableForm(); misc.disableExitConfirmation(); - // TODO: enable form }, errorMessage => { - window.alert(errorMessage); - // TODO: enable form + this._view.sidebarControl.showError(errorMessage); + this._view.sidebarControl.enableForm(); }); } diff --git a/client/js/controls/post_edit_sidebar_control.js b/client/js/controls/post_edit_sidebar_control.js index 31a69f6d..c22eaec3 100644 --- a/client/js/controls/post_edit_sidebar_control.js +++ b/client/js/controls/post_edit_sidebar_control.js @@ -144,6 +144,22 @@ class PostEditSidebarControl extends events.EventTarget { return this._formNode.querySelector( '.post-thumbnail .dropper-container'); } + + enableForm() { + views.enableForm(this._formNode); + } + + disableForm() { + views.disableForm(this._formNode); + } + + showSuccess(message) { + views.showSuccess(this._hostNode, message); + } + + showError(message) { + views.showError(this._hostNode, message); + } }; module.exports = PostEditSidebarControl;