Display type of related documents #22014
This commit is contained in:
parent
236926a29e
commit
5876bfb0be
|
@ -114,7 +114,11 @@ msgstr ""
|
|||
msgid "There is no version note for this document."
|
||||
msgstr ""
|
||||
|
||||
#: ../browser/listing.py:122
|
||||
#: ../related-docs-display.pt:21
|
||||
msgid "Title"
|
||||
msgstr ""
|
||||
|
||||
#: ../browser/listing.py:150
|
||||
msgid "To read"
|
||||
msgstr ""
|
||||
|
||||
|
@ -122,6 +126,10 @@ msgstr ""
|
|||
msgid "Treating groups"
|
||||
msgstr ""
|
||||
|
||||
#: ../related-docs-display.pt:20
|
||||
msgid "Type"
|
||||
msgstr ""
|
||||
|
||||
#: ../browser/viewlets.py:92
|
||||
msgid "Validation applications"
|
||||
msgstr ""
|
||||
|
|
|
@ -112,7 +112,11 @@ msgstr ""
|
|||
msgid "There is no version note for this document."
|
||||
msgstr ""
|
||||
|
||||
#: ../browser/listing.py:122
|
||||
#: ../related-docs-display.pt:21
|
||||
msgid "Title"
|
||||
msgstr ""
|
||||
|
||||
#: ../browser/listing.py:150
|
||||
msgid "To read"
|
||||
msgstr ""
|
||||
|
||||
|
@ -120,6 +124,10 @@ msgstr ""
|
|||
msgid "Treating groups"
|
||||
msgstr ""
|
||||
|
||||
#: ../related-docs-display.pt:20
|
||||
msgid "Type"
|
||||
msgstr ""
|
||||
|
||||
#: ../browser/viewlets.py:92
|
||||
msgid "Validation applications"
|
||||
msgstr ""
|
||||
|
|
|
@ -117,7 +117,11 @@ msgstr "Il n'y a aucune demande de validation"
|
|||
msgid "There is no version note for this document."
|
||||
msgstr "Aucune version n'a encore été créée pour ce document."
|
||||
|
||||
#: ../browser/listing.py:145
|
||||
#: ../related-docs-display.pt:21
|
||||
msgid "Title"
|
||||
msgstr "Titre"
|
||||
|
||||
#: ../browser/listing.py:150
|
||||
msgid "To read"
|
||||
msgstr "À lire"
|
||||
|
||||
|
@ -125,6 +129,10 @@ msgstr "À lire"
|
|||
msgid "Treating groups"
|
||||
msgstr "Services en charge du traitement"
|
||||
|
||||
#: ../related-docs-display.pt:20
|
||||
msgid "Type"
|
||||
msgstr "Type"
|
||||
|
||||
#: ../browser/viewlets.py:92
|
||||
msgid "Validation applications"
|
||||
msgstr "Demandes de validation"
|
||||
|
|
|
@ -112,7 +112,11 @@ msgstr ""
|
|||
msgid "There is no version note for this document."
|
||||
msgstr ""
|
||||
|
||||
#: ../browser/listing.py:122
|
||||
#: ../related-docs-display.pt:21
|
||||
msgid "Title"
|
||||
msgstr ""
|
||||
|
||||
#: ../browser/listing.py:150
|
||||
msgid "To read"
|
||||
msgstr ""
|
||||
|
||||
|
@ -120,6 +124,10 @@ msgstr ""
|
|||
msgid "Treating groups"
|
||||
msgstr ""
|
||||
|
||||
#: ../related-docs-display.pt:20
|
||||
msgid "Type"
|
||||
msgstr ""
|
||||
|
||||
#: ../browser/viewlets.py:92
|
||||
msgid "Validation applications"
|
||||
msgstr ""
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
<span id="" class=""
|
||||
i18n:domain="collective.dms.basecontent"
|
||||
tal:attributes="id view/id;
|
||||
class view/klass;
|
||||
style view/style;
|
||||
|
@ -13,12 +14,24 @@
|
|||
onmouseout view/onmouseout;
|
||||
onkeypress view/onkeypress;
|
||||
onkeydown view/onkeydown;
|
||||
onkeyup view/onkeyup"><tal:block
|
||||
tal:repeat="value view/tuples"
|
||||
><a class="selected-option"
|
||||
href="#"
|
||||
tal:content="python:value[1]"
|
||||
tal:attributes="href python:value[0]"
|
||||
/><tal:block condition="not:repeat/value/end">, </tal:block
|
||||
></tal:block
|
||||
></span>
|
||||
onkeyup view/onkeyup">
|
||||
<table class="listing nosort">
|
||||
<thead>
|
||||
<th i18n:translate="">Type</th>
|
||||
<th i18n:translate="">Title</th>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tal:repeat tal:repeat="value view/tuples">
|
||||
<tr tal:define="oddrow repeat/value/odd"
|
||||
tal:attributes="class python:'odd' if oddrow else 'even'">
|
||||
<td tal:content="python:value[2]" />
|
||||
<td>
|
||||
<a href="#"
|
||||
tal:content="python:value[1]"
|
||||
tal:attributes="href python:value[0]"/>
|
||||
</td>
|
||||
</tr>
|
||||
</tal:repeat>
|
||||
</tbody>
|
||||
</table>
|
||||
</span>
|
|
@ -33,6 +33,11 @@ class RelatedDocsWidget(MultiContentTreeWidget):
|
|||
term = self.terms.getTermByToken(v)
|
||||
return term.title
|
||||
|
||||
def get_content_type(self, v):
|
||||
portal = self.context.portal_url.getPortalObject()
|
||||
document = portal.unrestrictedTraverse(v)
|
||||
return document.Type()
|
||||
|
||||
def update(self):
|
||||
super(RelatedDocsWidget, self).update()
|
||||
if self.mode == 'display':
|
||||
|
@ -42,7 +47,11 @@ class RelatedDocsWidget(MultiContentTreeWidget):
|
|||
|
||||
@CachedProperty
|
||||
def tuples(self):
|
||||
refs = [(self.get_url(x), self.get_label(x)) for x in self.value]
|
||||
refs = [(
|
||||
self.get_url(x),
|
||||
self.get_label(x),
|
||||
self.get_content_type(x),
|
||||
) for x in self.value]
|
||||
if self.display_backrefs:
|
||||
intids = getUtility(IIntIds)
|
||||
catalog = getUtility(ICatalog)
|
||||
|
@ -57,7 +66,7 @@ class RelatedDocsWidget(MultiContentTreeWidget):
|
|||
if not sm.checkPermission('View', obj):
|
||||
continue
|
||||
url = self.get_url(ref.from_path)
|
||||
tp = (url, obj.Title())
|
||||
tp = (url, obj.Title(), obj.Type())
|
||||
if tp not in refs:
|
||||
refs.append(tp)
|
||||
return refs
|
||||
|
|
Reference in New Issue