Paragraphs using the tocMacro.ftl are not usable as subparagraphs or from 
nested calls
--------------------------------------------------------------------------------------

                 Key: MGNLSTK-659
                 URL: http://jira.magnolia-cms.com/browse/MGNLSTK-659
             Project: Magnolia Standard Templating Kit
          Issue Type: Bug
          Components: paragraphs
    Affects Versions: 1.3.1
            Reporter: Christian Ringele
            Assignee: Christian Ringele


The paragraphs 'stkTextImage' and 'stkLinkList' include the macro tocMarkup.ftl:
[#include "/templating-kit/paragraphs/macros/tocMarkup.ftl"/]

The macro tries to read out the pages renderable definition, but does that 
wrong:
[#assign intro = model.parent.def.mainArea.intro]

this works as long the parent model of the paragraph is a page's model.
But when the paragraph is a subparagraph, the call  model.parent will return a 
renderable definition of a paragraph and not of a page.

the correct solution is:

[#macro tocMarkup model content]

    [#assign rootDef = model.root.def!false]

    [#if rootDef.mainArea?if_exists]
        [#assign showTOC = rootDef.mainArea.intro.showTOC!false]
    [#else]
        [#assign showTOC = false]
    [/#if]

        [#assign siblings=mgnl.siblings(content)]

        [#if showTOC]
                [#assign id='id="jump' + (siblings.index + 1) + '"']
        [#else]
                [#assign id=""]
        [/#if]


[/#macro]

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://jira.magnolia-cms.com/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

----------------------------------------------------------------
For list details see
http://www.magnolia-cms.com/home/community/mailing-lists.html
To unsubscribe, E-mail to: <dev-list-unsubscr...@magnolia-cms.com>
----------------------------------------------------------------

Reply via email to