Commit 9d5ce58a authored by Sylvain Thénault's avatar Sylvain Thénault
Browse files

[ui] Introduce intermediary view and more consistent naming

That was not a 'business' view (which should not carry cardinality information).

On the other hand, we need sometime to override the whole list item view,
including positionning of the cardinality.
parent b47990292a4c
......@@ -86,7 +86,7 @@ class AlternativeEntityAttributeView(EntityView):
if rtype.startswith('seda_') and rtype != self.cw_extra_kwargs['rtype']:
target_rset = entity.related(rtype, role)
if target_rset:
alternatives.append(self._cw.view('', rset=target_rset))
alternatives.append(self._cw.view('seda.type_meta', rset=target_rset))
self.w(u'<div class="alternative">')
if alternatives:
self.w((' <b>%s</b> ' % self._cw._(' ALT_I18N ')).join(alternatives))
......@@ -126,9 +126,19 @@ class BusinessValueLinkEntityView(BusinessValueEntityView):
self.w(tags.a(value, href=entity.absolute_url()))
class TypedBusinessValueEntityView(EntityView):
"""Similar to but with type information, for use within alternative"""
__regid__ = ''
class LinkMetaEntityView(EntityView):
"""Glue and seda.xsdmeta views together, for use within list"""
__regid__ = 'seda.link_meta'
def entity_call(self, entity):
entity.view('', w=self.w)
entity.view('seda.xsdmeta', w=self.w, skip_one_card=True)
class TypeAndMetaEntityView(EntityView):
"""Glue entity's type, and seda.xsdmeta views together, for use within alternative
__regid__ = 'seda.type_meta'
def entity_call(self, entity):
self.w(entity.dc_type() + u' ')
......@@ -144,8 +154,7 @@ class ListItemView(EntityView):
__select__ = EntityView.__select__ & match_kwargs('parent', 'tabid')
def entity_call(self, entity, parent, tabid, edit=True, delete=True):
entity.view('', w=self.w)
entity.view('seda.xsdmeta', w=self.w)
entity.view('seda.link_meta', w=self.w)
if entity.cw_has_perm('update'):
self._cw.add_js(('cubicweb.ajax.js', 'cubes.seda.js'))
editurlparams = {
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