diff options
| author | qsm-odoo <qsm@odoo.com> | 2017-09-24 19:21:23 +0200 |
|---|---|---|
| committer | qsm-odoo <qsm@odoo.com> | 2017-09-28 13:29:56 +0200 |
| commit | 2506a9564b548d0912b779bf3479123e9c565ddb (patch) | |
| tree | b1fc6633157cbf9763c5e01206a90886e6d13972 /addons/web/static/src/js/fields/relational_fields.js | |
| parent | 99bf9e4563d8c17be1635fc09d336b693b5ba1a1 (diff) | |
[FIX] web: review UI tag color system
- Kanban colors and tag colors are now the same
- Tag color 0 (default) is now back to be the invisible kanban one
- Same colorpicker for kanban and tags
- Define correct number of colors (12 not 13)
- Color 0 should be a neutral one (gray)
- ...
Diffstat (limited to 'addons/web/static/src/js/fields/relational_fields.js')
| -rw-r--r-- | addons/web/static/src/js/fields/relational_fields.js | 29 |
1 files changed, 13 insertions, 16 deletions
diff --git a/addons/web/static/src/js/fields/relational_fields.js b/addons/web/static/src/js/fields/relational_fields.js index 90c2b08e1e5..f518c3df354 100644 --- a/addons/web/static/src/js/fields/relational_fields.js +++ b/addons/web/static/src/js/fields/relational_fields.js @@ -1608,7 +1608,7 @@ var FieldMany2ManyTags = AbstractField.extend({ var FormFieldMany2ManyTags = FieldMany2ManyTags.extend({ events: _.extend({}, FieldMany2ManyTags.prototype.events, { 'click .badge': '_onOpenColorPicker', - 'mousedown .o_colorpicker span': '_onUpdateColor', + 'mousedown .o_colorpicker a': '_onUpdateColor', 'focusout .o_colorpicker': '_onCloseColorPicker', }), @@ -1681,22 +1681,19 @@ var KanbanFieldMany2ManyTags = FieldMany2ManyTags.extend({ var self = this; this.$el.empty().addClass('o_field_many2manytags o_kanban_tags'); _.each(this.value.data, function (m2m) { - var $tag = $('<span>') - .text(m2m.data.display_name) - .data('res_id', m2m.res_id) - .prepend('<span>') - .appendTo(self.$el); - if (self.colorField in m2m.data) { - if (m2m.data[self.colorField] === 10) { - // 10th color is invisible - $tag.hide(); - } else { - $tag.addClass('o_tag o_tag_color_' + m2m.data[self.colorField]); - } - } else { - // display tags in grey by default - $tag.addClass('o_tag o_tag_color_0'); + if (self.colorField in m2m.data && !m2m.data[self.colorField]) { + // When a color field is specified and that color is the default + // one, the kanban tag is not rendered. + return; } + + $('<span>', { + class: 'o_tag o_tag_color_' + (m2m.data[self.colorField] || 0), + text: m2m.data.display_name, + }) + .data('res_id', m2m.res_id) + .prepend('<span>') + .appendTo(self.$el); }); }, |
