Uploaded image for project: 'CMS'
  1. CMS
  2. CMS-7698

Default title does not work on filtered content service

    • Icon: Bug Bug
    • Resolution: Invalid
    • Icon: Major Major
    • 4.2.0
    • 4.0M10
    • None
    • None

      How to reproduce :

      • override the template "common-service-body-nonempty-content-title template of the service width this code :
        <!-- Used in common.xsl --> 
            <xsl:template name="common-service-body-nonempty-content-title">
                <xsl:call-template name="rss"/>
            
                <xsl:call-template name="common-service-body-nonempty-content-title-content">
                    <xsl:with-param name="title" select="$service-title"/>
                    <xsl:with-param name="default-title"><i18n:text i18n:key="SERVICE_FILTERED_CONTENTS_XSLT_FILES_ZOOM_LIST_LABEL" i18n:catalogue="skin.{$skin}"/></xsl:with-param>
                </xsl:call-template>    
            </xsl:template>
      • then add the filtered content service in a page without service title
        > the service should display the default title difined in the template, but it is not the case : the title is empty.

          [CMS-7698] Default title does not work on filtered content service

          Laure Lopez added a comment -

          I am not agree with that you commented. But the bug has been well resolved because the code that I give you in the description is now working.

          Laure Lopez added a comment - I am not agree with that you commented. But the bug has been well resolved because the code that I give you in the description is now working.

          I do not agree it does work but, you may have miss something.

          The "common-service-body-nonempty-content-title-content" is called twice... once to display, and once to compute the hierarchy and I think you add the default title to only the first one.
          A simplier way could be to override "common-service-body-nonempty-content-title-content" with something like the following code (then you have a single place to set the default value)

             <xsl:template name="common-service-body-nonempty-content-title-content">
                 <!-- The title to use -->
                  <xsl:param name="title"/>
                  
                  <xsl:choose>
                      <xsl:when test="$title != '' or $title">
                        	<xsl:call-template name="common-service-body-nonempty-content-title-rendering">
                              <xsl:with-param name="title" select="$title"/>
                          </xsl:call-template>
                      </xsl:when>
                      <xsl:otherwise>
                          <xsl:call-template name="common-service-body-nonempty-content-title-rendering">
                              <xsl:with-param name="title" select="'My default value'"/>
                          </xsl:call-template>            
                      </xsl:otherwise>
                  </xsl:choose>
             </xsl:template>
          

          Raphaël Franchet added a comment - I do not agree it does work but, you may have miss something. The "common-service-body-nonempty-content-title-content" is called twice... once to display, and once to compute the hierarchy and I think you add the default title to only the first one. A simplier way could be to override "common-service-body-nonempty-content-title-content" with something like the following code (then you have a single place to set the default value) <xsl:template name= "common-service-body-nonempty-content-title-content" > <!-- The title to use --> <xsl:param name= "title" /> <xsl:choose> <xsl:when test= "$title != '' or $title" > <xsl:call-template name= "common-service-body-nonempty-content-title-rendering" > <xsl:with-param name= "title" select= "$title" /> </xsl:call-template> </xsl:when> <xsl:otherwise> <xsl:call-template name= "common-service-body-nonempty-content-title-rendering" > <xsl:with-param name= "title" select= " 'My default value' " /> </xsl:call-template> </xsl:otherwise> </xsl:choose> </xsl:template>

          Laure Lopez added a comment -

          When there is a default title defined, the level of the titles of the contents inside of this service should be the same one as if it was a title entered by the contributor.

          Actually, I defined a default title on the filtered content service. If contributor entered a service title, the titles of the filtered contents have <h2> tags but if contributor does not defined any service title, the default value is used and the title of the filered contents should be always a <h2> tag

          Laure Lopez added a comment - When there is a default title defined, the level of the titles of the contents inside of this service should be the same one as if it was a title entered by the contributor. Actually, I defined a default title on the filtered content service. If contributor entered a service title, the titles of the filtered contents have <h2> tags but if contributor does not defined any service title, the default value is used and the title of the filered contents should be always a <h2> tag

            Unassigned Unassigned
            llopez Laure Lopez
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: