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

[ui] Display data-objects relationship's target in a dedicated section of the relationship tab

And hide them from the default tab
parent 361e3f279f7c
......@@ -503,6 +503,9 @@ msgstr ""
msgid "New SEDArestrictionValue"
msgstr ""
msgid "Relationship target of"
msgstr ""
msgid "SEDA 2.0 export"
msgstr ""
......@@ -2582,6 +2585,10 @@ msgstr ""
msgid "This SEDArestrictionValue:"
msgstr ""
msgid ""
"This object is also used as a relationship target of the following entities"
msgstr ""
msgid "add a Agent"
msgstr ""
......
......@@ -506,6 +506,9 @@ msgstr ""
msgid "New SEDArestrictionValue"
msgstr ""
msgid "Relationship target of"
msgstr "Cible des relations"
msgid "SEDA 2.0 export"
msgstr ""
......@@ -2585,6 +2588,11 @@ msgstr ""
msgid "This SEDArestrictionValue:"
msgstr ""
msgid ""
"This object is used as a relationship target of the following entities"
msgstr ""
"Cet objet est utilisé comme cible des relations suivantes :"
msgid "add a Agent"
msgstr ""
......
......@@ -19,7 +19,7 @@ import json
from logilab.mtconverter import xml_escape
from cubicweb import tags
from cubicweb import tags, view
from cubicweb.predicates import match_form_params, is_instance
from cubicweb.web.views import uicfg, tabs
......@@ -89,6 +89,8 @@ for etype in ('SEDABinaryDataObject', 'SEDAPhysicalDataObject'):
{'rvid': 'seda.reledit.complexlink',
'novalue_label': _('<unauthorized>')})
pvs.tag_object_of(('*', 'seda_target', etype), 'hidden') # in the relationship tab
def uri_cardinality_vocabulary(form, field):
req = form._cw
......@@ -184,6 +186,13 @@ class DataObjectRelationsTab(tabs.PrimaryTab):
if rset:
self._cw.view('list', rset=rset, parent=entity, w=self.w, tabid=self.__regid__,
subvid='seda.listitem')
rset = entity.related('seda_target', 'object')
if rset:
self.w(u'<h2>{0}</h2>'.format(self._cw._('Relationship target of')))
self.w(u'<div>{0}</div>'.format(
self._cw._('This object is used as a relationship target of the following '
'entities')))
self._cw.view('list', rset=rset, subvid='seda.relationship.reverse', w=self.w)
class RelationshipBusinessValueLinkEntityView(viewlib.BusinessValueLinkEntityView):
......@@ -204,6 +213,21 @@ class RelationshipBusinessValueLinkEntityView(viewlib.BusinessValueLinkEntityVie
return value
class RelationshipReverseEntityView(view.EntityView):
__regid__ = 'seda.relationship.reverse'
__select__ = is_instance('SEDARelationship')
def entity_call(self, entity):
target = entity.seda_relationship[0]
self.w(tags.a(target.dc_title(), href=target.absolute_url()))
if entity.seda_type_relationship:
concept = entity.seda_type_relationship[0]
msg = self._cw._(', of relationship type %s') % concept.label()
else:
msg = self._cw._(', no relationship type specified')
self.w(xml_escape(msg))
class AttachmentBusinessValueEntityView(viewlib.BusinessValueEntityView):
__select__ = is_instance('SEDAAttachment')
......
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