mirror of https://github.com/OCA/web.git
[RFR] Move module description to README
[FIX] rst line endings [IMP] Comment on arbitrary media subtypepull/57/head
parent
3109fada7f
commit
e497db6780
|
@ -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,
|
||||
"/<module>/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,'
|
|
@ -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, \
|
||||
"/<module>/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',
|
||||
|
|
|
@ -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});
|
||||
|
|
Loading…
Reference in New Issue