From e497db67805f6be1ee733c06c171022ec39600fa Mon Sep 17 00:00:00 2001 From: Stefan Rijnhart Date: Mon, 8 Dec 2014 10:28:21 +0100 Subject: [PATCH] [RFR] Move module description to README [FIX] rst line endings [IMP] Comment on arbitrary media subtype --- web_tree_image/README.rst | 18 ++++++++++++++++++ web_tree_image/__openerp__.py | 17 ----------------- web_tree_image/static/src/js/web_tree_image.js | 1 + 3 files changed, 19 insertions(+), 17 deletions(-) create mode 100644 web_tree_image/README.rst diff --git a/web_tree_image/README.rst b/web_tree_image/README.rst new file mode 100644 index 00000000..502be0d8 --- /dev/null +++ b/web_tree_image/README.rst @@ -0,0 +1,18 @@ +Display images and icons in tree view +===================================== + +This module defines a tree image widget, to be used with either binary fields +or (function) fields of type character. Use widget='tree_image' in your view +definition. Optionally, set a 'height' tag. Default height is 16px. + +If you use the widget with a character field, the content of the field can be +any of the following: + +* the absolute or relative location of an image. For example, + "//static/src/img/youricon.png" + +* a standard icon from the web distribution, without path or extension, For + example, 'gtk-open' + +* A dynamic image in a data url base 64 format. Prefix with + 'data:image/png;base64,' diff --git a/web_tree_image/__openerp__.py b/web_tree_image/__openerp__.py index 134f9514..ae8c726d 100644 --- a/web_tree_image/__openerp__.py +++ b/web_tree_image/__openerp__.py @@ -25,23 +25,6 @@ "name": "Show images in tree views", "version": "1.0", "author": "Therp BV", - "description": """\ -This module defines a tree image widget, to be used with either binary fields -or (function) fields of type character. Use widget='tree_image' in your view -definition. Optionally, set a 'height' tag. Default height is 16px. - -If you use the widget with a character field, the content of the field can be -any of the following: - -* the absolute or relative location of an image. For example, \ -"//static/src/img/youricon.png" - -* a standard icon from the web distribution, without path or extension, For \ -example, 'gtk-open' - -* A dynamic image in a data url base 64 format. Prefix with \ -'data:image/png;base64,' - """, 'url': 'https://github.com/OCA/Web', 'depends': [ 'web', diff --git a/web_tree_image/static/src/js/web_tree_image.js b/web_tree_image/static/src/js/web_tree_image.js index f161a2d5..1ecaab6e 100644 --- a/web_tree_image/static/src/js/web_tree_image.js +++ b/web_tree_image/static/src/js/web_tree_image.js @@ -32,6 +32,7 @@ openerp.web_tree_image = function (instance) { var value = row_data[this.id].value, src; if (this.type === 'binary') { if (value && value.substr(0, 10).indexOf(' ') === -1) { + // The media subtype (png) seems to be arbitrary src = "data:image/png;base64," + value; } else { src = instance.session.url('/web/binary/image', {model: options.model, field: this.id, id: options.id});