These are chat archives for collectiveaccess/support

Nov 2016
Karl Becker
Nov 09 2016 09:22

Hi! I’m building a display template for Pawtucket, its working fine. One thing I cant wrap my head around is how to use the ifdef code with a typerestriction. We have different types of occurrences and I’d like pawtucket to only display those which are related with a given object. Using <unit relativeTo="ca_occurrences" restrictToTypes="occurrence_type"> works, but this still shows the heading even when no related occurrence is displayed. The <idef> tag does not take any of the options I tried to specify my occurrence type.

How do you tell <idef> to show only when a specific occurrence type is connected with the object?

This is a sample code:

{{{<ifdef code="ca_occurrences" restrictToTypes="DOESNOTWORK"><H5>Normincipit Text</H5><unit relativeTo="ca_occurrences" restrictToTypes="normincipit_text" delimiter="<br/>"><l>^ca_occurrences.preferred_labels.</l></unit></ifdef>}}}

Nov 09 2016 12:26
<ifdef> doesn't support restrictToTypes
For relationships use <ifcount>
to test for presence of values
Eg. <ifcount code="ca_occurrences" min="1">...</ifcount>
Karl Becker
Nov 09 2016 12:40
Thanks! This works fine if you put the appropriate heading inside the <unit> tag: It will only show the heading and occurrence if there is one defined.