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

[New Search v2] Content with comments rendering issue

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Major Major
    • 4.8.12, 4.9.0
    • None
    • None
    • None

      If searching for contents in main view, the rendering of comments (if activated) use:
      document.write

      But this instruction that add text in the html when called during rendering, will just blow up the whole page when called after the end of the rendering.
      So when such an inscrtruction is loaded in ajax, the whole page is blown up

          [CMS-9828] [New Search v2] Content with comments rendering issue

          Raphaël Franchet added a comment - - edited

          document.write is not a good pattern in general.

          We used it for accessibility purposes, but script and acccessility are now better friends so as a workaround you can add this in your ovverride of "cms/pages/comments/comments_3.3.xsl"

              <xsl:template name="comment-add-form-button">
                      <p>
                          <a href="javascript: comment_form_switch_{$commentUniqueId}('comment')">                                       
                              <i18n:text i18n:key="PLUGINS_CMS_CONTENT_COMMENTS_POST_DESC" i18n:catalogue="plugin.cms"/>
                          </a>
                      </p>
              </xsl:template>
          
              <xsl:template name="comment-answer-form-button">
                  <!-- Add answer button only if it's the parent comment -->
                  <xsl:if test="not(@level) or @level = 0">
          	        <p class="answer-comment">
          	          <span>
                                   <a href="javascript: comment_form_switch_{$commentUniqueId}('{@id}')">
                                       <i18n:text i18n:key="PLUGINS_CMS_CONTENT_COMMENTS_ANSWER_TITLE" i18n:catalogue="plugin.cms"/>
                                    </a>
          	          </span>
          	        </p>
                  </xsl:if>
              </xsl:template>
          
          

          Raphaël Franchet added a comment - - edited document.write is not a good pattern in general. We used it for accessibility purposes, but script and acccessility are now better friends so as a workaround you can add this in your ovverride of "cms/pages/comments/comments_3.3.xsl" <xsl:template name= "comment-add-form-button" > <p> <a href= "javascript: comment_form_switch_{$commentUniqueId}( 'comment' )" > <i18n:text i18n:key= "PLUGINS_CMS_CONTENT_COMMENTS_POST_DESC" i18n:catalogue= "plugin.cms" /> </a> </p> </xsl:template> <xsl:template name= "comment-answer-form-button" > <!-- Add answer button only if it's the parent comment --> <xsl: if test= "not(@level) or @level = 0" > <p class= "answer-comment" > <span> <a href= "javascript: comment_form_switch_{$commentUniqueId}( '{@id}' )" > <i18n:text i18n:key= "PLUGINS_CMS_CONTENT_COMMENTS_ANSWER_TITLE" i18n:catalogue= "plugin.cms" /> </a> </span> </p> </xsl: if > </xsl:template>

            Unassigned Unassigned
            raphael Raphaël Franchet
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated: