From ea4c93472879f042f8aa343d5c42fa6c2bd5cfce Mon Sep 17 00:00:00 2001 From: Damien Bouvy Date: Tue, 17 Dec 2019 16:29:13 +0000 Subject: [IMP] web: allow background-style images for custom models The `FieldBinaryImage` assumes that the image mixin is used to manage its fields - this is mostly true, until you use custom fields. This commit makes using the 'background' option of the Image widget possible by fallbacking the thumbnail field's name to the name of the field itself instead of `image_128` when we're dealing with a custom field. --- addons/web/static/src/js/fields/basic_fields.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'addons/web/static/src') diff --git a/addons/web/static/src/js/fields/basic_fields.js b/addons/web/static/src/js/fields/basic_fields.js index 996e759a70a..f2c44891ea2 100644 --- a/addons/web/static/src/js/fields/basic_fields.js +++ b/addons/web/static/src/js/fields/basic_fields.js @@ -1875,7 +1875,8 @@ var FieldBinaryImage = AbstractFieldBinary.extend({ this.$el.addClass(this.attrs.class); } - var urlThumb = this._getImageUrl(this.model, this.res_id, 'image_128', unique); + const image_field = this.field.manual ? this.name:'image_128'; + var urlThumb = this._getImageUrl(this.model, this.res_id, image_field, unique); this.$el.empty(); $img = this.$el; -- cgit v1.2.3 From 18e06fa90aadf126602e6d2ea1fff7ef13be3a73 Mon Sep 17 00:00:00 2001 From: Damien Bouvy Date: Tue, 17 Dec 2019 16:31:26 +0000 Subject: [IMP] web: kanban content container The 'new' (read: the classes not in the 'compatibility layer section') classes of the kanban views did not allow to cleanly separate an image header from a content container. This commit adds such a container, allowing a very simple layout that should work all the time for a typical 'card with left image and right content layout': ```xml
``` Before this commit, the absence of a container for the right side meant that the top/body/bottom were flex-growed in a flex-direction: row element, appearing as 3 columns instead of rows. --- addons/web/static/src/scss/kanban_view.scss | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'addons/web/static/src') diff --git a/addons/web/static/src/scss/kanban_view.scss b/addons/web/static/src/scss/kanban_view.scss index 84e52bda039..93605ab5640 100644 --- a/addons/web/static/src/scss/kanban_view.scss +++ b/addons/web/static/src/scss/kanban_view.scss @@ -58,6 +58,13 @@ width: $o-kanban-color-border-width; } + .o_kanban_record_details { + display: flex; + flex-direction: column; + justify-content: space-between; + width: 100%, + } + // Inner Sections .o_kanban_record_top, .o_kanban_record_body { margin-bottom: $o-kanban-inner-hmargin; -- cgit v1.2.3