diff options
| author | Romain Derie <rde@odoo.com> | 2020-12-08 18:33:07 +0000 |
|---|---|---|
| committer | Romain Derie <rde@odoo.com> | 2021-01-11 15:25:16 +0000 |
| commit | 80592abda266ef3f9f463854c3101eb3f728087b (patch) | |
| tree | 29363916c75ed116f30b7c09c8a430e2c84b0866 /addons/web_editor/static/src | |
| parent | db0b65e547defe3d49c1a31c4671f546aa5156e8 (diff) | |
[FIX] web_editor, website: prevent multiple click on save
Clicking on save on html editor is taking quite some time. The user might think
something is not happening and need to click again.
If he does click again, 2 write RPC will be sent, making the COW business code
being triggered twice, ultimately leading to create 2 COW.
Instead of
A
/ \
B B'
It will be
A
/ | \
B B' B'
With as many B' than there is click on save.
This commit adds a generic helper to make a button load/spin.
closes odoo/odoo#63417
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
Diffstat (limited to 'addons/web_editor/static/src')
| -rw-r--r-- | addons/web_editor/static/src/js/common/ace.js | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/addons/web_editor/static/src/js/common/ace.js b/addons/web_editor/static/src/js/common/ace.js index 4bbaf5f8fdd..769b4f33023 100644 --- a/addons/web_editor/static/src/js/common/ace.js +++ b/addons/web_editor/static/src/js/common/ace.js @@ -5,6 +5,7 @@ var ajax = require('web.ajax'); var config = require('web.config'); var concurrency = require('web.concurrency'); var core = require('web.core'); +var dom = require('web.dom'); var Dialog = require('web.Dialog'); var Widget = require('web.Widget'); var localStorage = require('web.local_storage'); @@ -911,8 +912,9 @@ var ViewEditor = Widget.extend({ * * @private */ - _onSaveClick: function () { - this._saveResources(); + _onSaveClick: function (ev) { + const restore = dom.addButtonLoadingEffect(ev.currentTarget); + this._saveResources().guardedCatch(restore); }, /** * Called when the user wants to switch from xml to scss or vice-versa -> |
