Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Welcome to the CollectiveAccess support forum! Here the developers and community answer questions related to use of the software. Please include the following information in every new issue posted here:

  1. Version of the software that is used, along with browser and version

  2. If the issue pertains to Providence, Pawtucket or both

  3. What steps you’ve taken to try to resolve the issue

  4. Screenshots demonstrating the issue

  5. The relevant sections of your installation profile or configuration including the codes and settings defined for your local elements.


If your question pertains to data import or export, please also include:

  1. Data sample

  2. Your mapping


Answers may be delayed for posts that do not include sufficient information.

Displaying elements based on element type with rule

Hello, I’m having a bit of difficulty implementing an <if> rule for object detail displays in Pawtucket (we are running Pawtucket version 2.0 and Providence version 1.6.1).  We have an element Description (pbcoreDescription) consisting of two sub-elements; Description Type (pbdescriptionType) and Description (pBdescription_text).  Description Type is a list element that uses the list Description Type (pbcore_description_types).  What I’d like to do is have pBdescription_text display on the object viewer *only* if the element’s Description Type is set to Abstract (abstract) from the drop-down list.  After reading these two sources, (http://docs.collectiveaccess.org/wiki/Display_Templates#Conditional_tags:_.3Cifdef.3E.2C_.3Cifnotdef.3E.2C_.3Cifcount.3E.2C_.3Cif.3E) and (http://docs.collectiveaccess.org/wiki/Cookbook_Chapter_2:_Installation_Profiles#Using_Conditional_Expressions_in_Displays), I added the following line to [our pawtucket directory]/themes/default/views/Details/ca_objects_default_html.php :

{{{<ifdef code= \"ca_objects.pbcoreDescription.pbdescriptionType =~ /abstract/\"><H6>Description:</H6><unit relativeTo="ca_objects.pbcoreDescription"><if rule= \"^pbdescriptionType =~ /abstract/\">^ca_objects.pbcoreDescription.pBdescription_text<br/></if></unit></ifdef>}}}

But, the pBdescription_text and the word “Description” in the <H6> tags never show, even for objects whose pbdescriptionType is set to Abstract in Providence.  Is there something I’m missing?

I hope all this makes sense (apologies for the similar names among the elements and lists; they were part of our installation profile), and that I included enough information!  Please let me know if I need to elaborate on anything.  

Comments

  • Hi ccas,

    Is this bundle repeatable?  Or does it accept a maximum of one entry?
  • Hi Sophie,

    At the moment, there's no reason for us to add more than one entry; but, we don't have any restrictions built into the metadata element to limit the number of entries.  Would that be part of the issue?
  • Hi ccas,

    Yes, fields that have the potential to repeat should be wrapped in <ifcount> so you can try something like:

    {{{<ifcount min="1" code="ca_objects.pbcoreDescription"><unit delimiter="<br/>"><if rule= \"^pbdescriptionType =~ /abstract/\"><H6>Description:</H6>^ca_objects.pbcoreDescription.pBdescription_text</if></unit></ifcount>}}}
  • Hi Sophie, 

    Thanks for your help! I just tried your suggested code, but I'm afraid I'm still not seeing anything.  Could there be something else I'm missing?  I did not make any changes to the element's minimum or maximum entries required in Providence.
  • In your original example, I'm not sure that a regex can be used in the initial ifdef "code" tag. I think it is expecting a metadata field name. If you get rid of that, but keep the rest of your template the same, does that work? 

    {{{<unit relativeTo="ca_objects.pbcoreDescription" delimiter="<br/>"><if rule= \"^pbdescriptionType =~ /abstract/\"><H6>Description:</H6>^ca_objects.pbcoreDescription.pBdescription_text</if></unit>}}}
Sign In or Register to comment.