Commit b1c4dbc3 authored by Fabien Morin's avatar Fabien Morin

In multi relation field non editalbe mode, display link on each value in the field instead of the

plane icon. This make much more easier to go on an element from the multi relation_field
list (you don't need to go on the Jump Relation view to be able to select one
value).
The behaviour of editable multi relation fields (the most used in erp5) is not
changed.

Reviewed by romain.


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@38054 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 8e1755db
......@@ -303,11 +303,30 @@ class MultiRelationStringFieldWidget(Widget.LinesTextAreaWidget,
def render_view(self, field, value, REQUEST=None, render_prefix=None):
"""
Render read only field.
XXX Improved rendering required
"""
html_string = self.default_widget_rendering_instance.render_view(
field, value, REQUEST=REQUEST)
html_string = ''
here = REQUEST['here']
portal_url = getToolByName(here, 'portal_url')
portal_url_string = portal_url()
if (value not in ((), [], None, '')) and \
field.get_value('allow_jump'):
string_list = []
base_category = field.get_value('base_category')
portal_type = map(lambda x:x[0],field.get_value('portal_type'))
kw = {}
for k, v in field.get_value('parameter_list') :
kw[k] = v
accessor_name = 'get%sValueList' % ''.join([part.capitalize() for part in base_category.split('_')])
jump_reference_list = getattr(here, accessor_name)(portal_type=portal_type, filter=kw)
if len(jump_reference_list):
for jump_reference in jump_reference_list:
string_list.append('<a href="%s">%s</a>' % \
(jump_reference.absolute_url(),
jump_reference.getTitle()))
html_string = '<br />'.join(string_list)
else:
html_string = self.default_widget_rendering_instance.render_view(field,
value, REQUEST=REQUEST)
if REQUEST is None:
REQUEST = get_request()
relation_html_string = self.render_relation_link(field, value, REQUEST)
......
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