From 0ab19401899c3e3846d4133dcb5ee8d330577a64 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Theys?= Date: Fri, 26 Apr 2019 10:55:35 +0000 Subject: [PATCH] [IMP] base,web: adapt kanban image following image tools changes Since the images are not guaranteed to be square anymore, the kanban image had to be adapted to better handle the different image ratios. Also the placeholder has been moved into the actual image div instead of being a separate div that acted differently. The avatar placeholder was white... displayed on top of white. Now it's grey so we can actually see it. task-1958000 PR: #31811 --- .../src/js/views/kanban/kanban_record.js | 14 +++----- addons/web/static/src/scss/kanban_view.scss | 14 +++++++- odoo/addons/base/static/img/avatar_grey.png | Bin 0 -> 2485 bytes odoo/addons/base/views/res_partner_views.xml | 30 ++++++------------ 4 files changed, 26 insertions(+), 32 deletions(-) create mode 100644 odoo/addons/base/static/img/avatar_grey.png diff --git a/addons/web/static/src/js/views/kanban/kanban_record.js b/addons/web/static/src/js/views/kanban/kanban_record.js index 2794d871e67..70afa09c066 100644 --- a/addons/web/static/src/js/views/kanban/kanban_record.js +++ b/addons/web/static/src/js/views/kanban/kanban_record.js @@ -177,21 +177,19 @@ var KanbanRecord = Widget.extend({ * @param {string} model the name of the model * @param {string} field the name of the field * @param {integer} id the id of the resource - * @param {integer} cache the cache duration, in seconds - * @param {Object} options + * @param {string} placeholder * @returns {string} the url of the image */ - _getImageURL: function (model, field, id, cache, options) { - options = options || {}; + _getImageURL: function (model, field, id, placeholder) { id = (_.isArray(id) ? id[0] : id) || false; - field = options.preview_image || field; + placeholder = placeholder || "/web/static/src/img/placeholder.png"; var isCurrentRecord = this.modelName === model && this.recordData.id === id; var url; if (isCurrentRecord && this.record[field] && this.record[field].raw_value && !utils.is_bin_size(this.record[field].raw_value)) { // Use magic-word technique for detecting image type url = 'data:image/' + this.file_type_magic_word[this.record[field].raw_value[0]] + ';base64,' + this.record[field].raw_value; } else if (!model || !field || !id || (isCurrentRecord && this.record[field] && !this.record[field].raw_value)) { - url = "/web/static/src/img/placeholder.png"; + url = placeholder; } else { var session = this.getSession(); var params = { @@ -202,10 +200,6 @@ var KanbanRecord = Widget.extend({ if (isCurrentRecord) { params.unique = this.record.__last_update && this.record.__last_update.value.replace(/[^0-9]/g, ''); } - if (cache !== undefined) { - // Set the cache duration in seconds. - params.cache = parseInt(cache, 10); - } url = session.url('/web/image', params); } return url; diff --git a/addons/web/static/src/scss/kanban_view.scss b/addons/web/static/src/scss/kanban_view.scss index e2c550f0a42..7ab56e2bbb3 100644 --- a/addons/web/static/src/scss/kanban_view.scss +++ b/addons/web/static/src/scss/kanban_view.scss @@ -146,7 +146,15 @@ margin-right: $o-kanban-inside-hgutter*2; flex: 1 0 $o-kanban-image-fill-width; min-height: 95px; - background: {size: cover; position: center }; + background: { + size: cover; + position: center; + repeat: no-repeat; + }; + + &.o_kanban_image_full { + background-size: contain; + } } // Adapt default 'o_kanban_image' element if present. @@ -158,6 +166,10 @@ flex: 0 0 $o-kanban-image-width; min-height: $o-kanban-image-width; align-self: baseline; + background: { + repeat: no-repeat; + position: center; + } // On medium screen size, align 'o_kanban_image' to 'o_kanban_image_fill_left' elements. @include media-breakpoint-up(md) { diff --git a/odoo/addons/base/static/img/avatar_grey.png b/odoo/addons/base/static/img/avatar_grey.png new file mode 100644 index 0000000000000000000000000000000000000000..db05e744f7cf783859e088c36101d72a261d7375 GIT binary patch literal 2485 zcma)8c~sKb7k6?aMsXu^!O1OyQPYZXNv!xPZit0jX)fiY;X>t#npT#GIz@ecN{%>6ftA6XG!0jL-gC$-Qeu!M`9?oj=;RTi#B$!$sH0* zaw!dYZLDRtXOWc;G~M`aF_Nn(Sw`+`1u8| zNtT{o?;~Z-C#wkA_E`AJlWa`MYs1W`k;!<3GKE6P7T+quF%RZr`a5r zSt{MzxHsOj+UGIZVR-T(SzjiT2_^>xvP&$M-XA@3JhZA=k-JsP9{39IHZiZdy81cy zk81MqwWWEd=$fW&fsl+>r{W5zg>x6`-^C>THHe3fNQ|v}bT= z%|R(w`bQyd#aZt~b!_N`{>#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OOGL}AQ9eXl)`47!E)?jFBu;?J6_ouu( zP{Vs4kIl~;j$|0CbQCqMc$p;(ppRK-Bd-BhwcdWj+^V{2trDA_p8mvbvK+vp9tGBc z*L!!_BsAip6@^iCu}OKA3s8b-vq|T(yFIPCP{X2?mBH^(?G_0{cy9McVgC(N_jBjZ zpHDcG{+LG?7#kl~lq~;Byq#uFgnw9ET)Y?RW9I>y9lVCx-NMEXb};ZaspI;p1JlYh zQ_HLln`zZc3v%GOV2~>dj9l|Q+FBpo?YY}U$WBg8eZl2&X^~%OfGyz)hvN#$cP|_m zS#RJ05SNI4{kz4tUPsK8lJ<(YCBJZYg0A3NC{;32xUjLd%t@NxK^={;Ikx*31h(IS zQT1FRk(4xlcWbUvZ)RW7Q*U@@NzKD$|G(PWeQw`)IytZd+P3*h30QekZ7dCYbSRjQ vu-xm`(|hc2*NK0nIbd4zce(?jSJ%Py&lRr@-@N$#TlVFS^Kz~SPF(&EiDIhW literal 0 HcmV?d00001 diff --git a/odoo/addons/base/views/res_partner_views.xml b/odoo/addons/base/views/res_partner_views.xml index d11fa33b479..ffb6395a949 100644 --- a/odoo/addons/base/views/res_partner_views.xml +++ b/odoo/addons/base/views/res_partner_views.xml @@ -502,37 +502,25 @@ - +
- -
+ + + + +
-
+
- - - - - Delivery - - - Invoice - - - - Logo - - - Avatar - - + +