From 31767092885793b4c3aade4838a7200d18a27a81 Mon Sep 17 00:00:00 2001 From: rr- Date: Sun, 31 Jul 2016 23:55:22 +0200 Subject: [PATCH] client/posts: clear messages before submit Saving the post twice resulted in two 'Post saved!' messages. --- client/js/controllers/post_controller.js | 1 + client/js/controls/post_edit_sidebar_control.js | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/client/js/controllers/post_controller.js b/client/js/controllers/post_controller.js index 5d6440a..6e5cb9b 100644 --- a/client/js/controllers/post_controller.js +++ b/client/js/controllers/post_controller.js @@ -102,6 +102,7 @@ class PostController { _evtPostEdit(e) { this._view.sidebarControl.disableForm(); + this._view.sidebarControl.clearMessages(); const post = e.detail.post; if (e.detail.tags !== undefined) { post.tags = e.detail.tags; diff --git a/client/js/controls/post_edit_sidebar_control.js b/client/js/controls/post_edit_sidebar_control.js index 3de1b6c..edc5ac8 100644 --- a/client/js/controls/post_edit_sidebar_control.js +++ b/client/js/controls/post_edit_sidebar_control.js @@ -182,6 +182,10 @@ class PostEditSidebarControl extends events.EventTarget { views.disableForm(this._formNode); } + clearMessages() { + views.clearMessages(this._hostNode); + } + showSuccess(message) { views.showSuccess(this._hostNode, message); }