summaryrefslogtreecommitdiff
path: root/addons/web/static/src/xml
diff options
context:
space:
mode:
authorfja-odoo <fja@odoo.com>2020-04-16 14:00:41 +0000
committerfja-odoo <fja@odoo.com>2020-05-15 11:05:00 +0000
commit99910b526ed792235a778863b993d10cf4e77cd7 (patch)
treecda8b5a4bbe7a07d8b70c3a9fbfa3505871fdb63 /addons/web/static/src/xml
parenta72c9adbe5e60ba178e431e42a81334f85786942 (diff)
[IMP] web, web_editor: integrate colorpicker in colorpalette
Stop using the colorpicker dialog in the colorpalette widget. Integrate the colorpicker widget in the colorpalette widget. Of course, the colorpicker behaviors are adapted so that no useless rerendering of the colorpalette is made on each value change. The 'reset color' button is now a button like the other colors, no need for a 'color_reset' event anymore. It is removed and replaced with a 'color_picked' event with color being an empty string. The clear button now also work on hover. Also, the topbar colorpalette for text and text background colors now has the exact same behaviour as the background colorpalette: adding color preview on hover. The colorpalette now also closes on 'enter' keypress. Part of https://github.com/odoo/odoo/pull/46088 task-2195313 closes odoo/odoo#46088 Related: odoo/enterprise#8696 Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
Diffstat (limited to 'addons/web/static/src/xml')
-rw-r--r--addons/web/static/src/xml/colorpicker.xml60
1 files changed, 23 insertions, 37 deletions
diff --git a/addons/web/static/src/xml/colorpicker.xml b/addons/web/static/src/xml/colorpicker.xml
index 957bef83146..7fb81da8711 100644
--- a/addons/web/static/src/xml/colorpicker.xml
+++ b/addons/web/static/src/xml/colorpicker.xml
@@ -3,44 +3,30 @@
<t t-name="Colorpicker">
<div class="o_colorpicker_widget">
- <div class="row">
- <div class="col-12">
- <div class="o_color_pick_area d-inline-block border">
- <div class="o_picker_pointer rounded-circle" />
- </div>
- <div class="o_color_slider d-inline-block ml-2 border">
- <div class="o_slider_pointer" />
- </div>
- <div class="o_opacity_slider d-inline-block ml-2 border" t-if="!widget.options.noTransparency">
- <div class="o_opacity_pointer" />
- </div>
+ <div class="o_color_pick_area d-inline-block border" t-att-style="widget.options.noTransparency ? 'width: 89%;' : None">
+ <div class="o_picker_pointer rounded-circle" tabindex="-1"/>
+ </div>
+ <div class="o_color_slider d-inline-block border">
+ <div class="o_slider_pointer" tabindex="-1"/>
+ </div>
+ <div class="o_opacity_slider d-inline-block border" t-if="!widget.options.noTransparency">
+ <div class="o_opacity_pointer" tabindex="-1"/>
+ </div>
+ <div class="o_color_picker_inputs">
+ <div t-if="widget.options.colorPreview" class="o_color_preview_parent">
+ <span class="rounded-0 o_color_preview"/>
+ </div>
+ <div class="o_hex_div"><input type="text" class="o_hex_input" data-color-method="hex" size="1"/>hex</div>
+ <div class="o_rgba_div">
+ <input type="text" class="o_red_input" data-color-method="rgb" size="1"/>
+ <input type="text" class="o_green_input" data-color-method="rgb" size="1"/>
+ <input type="text" class="o_blue_input" data-color-method="rgb" size="1"/>
+ <t t-if="!widget.options.noTransparency">
+ <input type="text" class="o_opacity_input" data-color-method="opacity" size="1"/>
+ RGBA
+ </t>
+ <t t-else="">RGB</t>
</div>
- <form class="col-12 o_color_picker_inputs">
- <div class="input-group">
- <div class="input-group-prepend">
- <span class="input-group-text rounded-0 o_color_preview" />
- </div>
- <input type="text" class="form-control o_hex_input" data-color-method="hex" />
- </div>
- <div class="form-row mt-2">
- <div class="col form-group">
- <label for="red">Red</label>
- <input type="text" class="form-control o_red_input" data-color-method="rgb" id="red" />
- </div>
- <div class="col form-group">
- <label for="green">Green</label>
- <input type="text" class="form-control o_green_input" data-color-method="rgb" id="green" />
- </div>
- <div class="col form-group">
- <label for="blue">Blue</label>
- <input type="text" class="form-control o_blue_input" data-color-method="rgb" id="blue" />
- </div>
- <div class="col form-group" t-if="!widget.options.noTransparency">
- <label for="opacity">Opacity %</label>
- <input type="text" class="form-control o_opacity_input" data-color-method="opacity" id="opacity" />
- </div>
- </div>
- </form>
</div>
</div>
</t>