From 5a030db3eb77b6d80187f8ae1a64303b2f50391d Mon Sep 17 00:00:00 2001 From: qsm-odoo Date: Wed, 19 Oct 2016 17:41:10 +0200 Subject: [REF] website, web_editor: refactor ace editor Stop using ugly code for ace editor. * Really close the ace editor by changing its display property thanks to the dedicated do_show and do_hide method. * Make the common part of ace editors (website, web_studio) consistent so that the extensions are really small. * Do not do RPC to retrieve data already retrieved (now, there is only one unique RPC when the editor starts an one RPC per view changed on save). * Fix born-dead code so that the website editor starts automatically if the URL contains its associated hash and loads the correct view * Better handle errors (previous behavior only worked partially and only on chrome): - Jump to the error line and make it red. - Do not open a Dialog with mostly incomprehensible message but allow to open it on click of the error marker. - Do not save any changed file if one contains an error. - Do not allow formatting a file if it contains an error (show the error instead). * Do not use different routes to get the same content (remove the /website/customize_template_get route as it returns the same content as /web_editor/customize_template_get route). Note: in a further commit this route will be refactored. * In a general way, use consistent method names and behaviors / comment the code / lint files / ... * Open the code to extensions (so that it may later load other data than XML). Note: this refactoring allowed to fix bugs in previous odoo versions but this commit message will not detail them. --- .../static/src/less/web_editor.ui.components.less | 29 ++++++++++++++++------ 1 file changed, 22 insertions(+), 7 deletions(-) (limited to 'addons/web_editor/static/src/less/web_editor.ui.components.less') diff --git a/addons/web_editor/static/src/less/web_editor.ui.components.less b/addons/web_editor/static/src/less/web_editor.ui.components.less index 44f3923c35e..de2c49ea5d2 100644 --- a/addons/web_editor/static/src/less/web_editor.ui.components.less +++ b/addons/web_editor/static/src/less/web_editor.ui.components.less @@ -126,6 +126,7 @@ color: white; .o-flex-display(); .o-flex-flow(column, nowrap); + opacity: 0.97; .o_ace_view_editor_title { .o-flex(0, 0, auto); @@ -164,15 +165,29 @@ .o-flex(1, 1, auto); .ace_gutter { cursor: ew-resize; + + .ace_gutter-cell.o_error { + position: relative; + &::after { + .o-position-absolute(-100%, 0, -100%, 0); + .ace-line-error-mixin(); + } + } + } + .ace_scroller.o_error::after { + .o-position-absolute(0, auto, 0, 0); + width: 3px; + .ace-line-error-mixin(); } - } - &.oe_ace_open { - opacity: 0.97; - } - &.oe_ace_closed { - z-index: -1000; - opacity: 0; + .ace-line-error-mixin() { + content: ""; + z-index: 1000; + display: block; + background-color: @brand-danger; + opacity: 0.5; + pointer-events: none; + } } } -- cgit v1.2.3