Browse Source

Move module description to README [FIX] rst line endings [IMP] Comment on arbitrary media subtype

pull/1279/merge
Stefan Rijnhart 10 years ago
committed by OCA-git-bot
parent
commit
d7ff0036ce
  1. 18
      web_tree_image/README.rst
  2. 17
      web_tree_image/__openerp__.py
  3. 1
      web_tree_image/static/src/js/web_tree_image.js

18
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,
"/<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,'

17
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, \
"/<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',

1
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});

Loading…
Cancel
Save