Commit bff389a3 authored by Lu Xu's avatar Lu Xu 👀

ImageField: add title

parent e08ace32
...@@ -34,6 +34,7 @@ from OFS.Image import Image as OFSImage ...@@ -34,6 +34,7 @@ from OFS.Image import Image as OFSImage
from lxml.etree import Element from lxml.etree import Element
from lxml import etree from lxml import etree
import re import re
from zLOG import LOG
DRAW_URI = 'urn:oasis:names:tc:opendocument:xmlns:drawing:1.0' DRAW_URI = 'urn:oasis:names:tc:opendocument:xmlns:drawing:1.0'
TEXT_URI = 'urn:oasis:names:tc:opendocument:xmlns:text:1.0' TEXT_URI = 'urn:oasis:names:tc:opendocument:xmlns:text:1.0'
...@@ -104,6 +105,7 @@ class ImageFieldWidget(Widget.TextWidget): ...@@ -104,6 +105,7 @@ class ImageFieldWidget(Widget.TextWidget):
image = value image = value
alt = field.get_value('description') or \ alt = field.get_value('description') or \
field.get_value('title') field.get_value('title')
title = field.get_value('title')
css_class = field.get_value('css_class') css_class = field.get_value('css_class')
extra = field.get_value('extra') extra = field.get_value('extra')
options = {} options = {}
...@@ -119,13 +121,16 @@ class ImageFieldWidget(Widget.TextWidget): ...@@ -119,13 +121,16 @@ class ImageFieldWidget(Widget.TextWidget):
if v]) if v])
if parameters: if parameters:
image = '%s?%s' % (image, parameters) image = '%s?%s' % (image, parameters)
return Widget.render_element( x = Widget.render_element(
"img", "img",
alt=alt, alt=alt,
title=title,
src=image, src=image,
css_class=css_class, css_class=css_class,
extra=extra, extra=extra,
) )
LOG('Testing... ', 0, x)
return x
def render_odg_view(self, field, value, as_string, ooo_builder, REQUEST, def render_odg_view(self, field, value, as_string, ooo_builder, REQUEST,
render_prefix, attr_dict, local_name): render_prefix, attr_dict, local_name):
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment