为什么“段落引用组件”显示空的图块(Geometrixx示例)?

时间:2014-01-08 15:21:31

标签: java javascript cq5 sling

我使用“段落引用组件”来包含页面/子页面。为什么这个组件显示空的瓷砖(参见附件中的Geometrixx图片)?是否可以配置空格子不显示?

enter image description here

2 个答案:

答案 0 :(得分:2)

Reference组件显示外部段落系统的内容(即来自不同页面的parsys)。它的浏览对话框由左侧的页面树和显示属于右侧所选页面的段落系统的图块组成。

附加图片显示选中联系页面的对话框。显然,这个页面包含3个段落系统。第一个可能是主要的parsys,包含填充了联系信息的文本组件。我认为第二个和第三个瓷砖是空白的有两个原因:

我不认为有一个开箱即用的配置允许隐藏这些空的parsys tile。

答案 1 :(得分:1)

从上面的 Tomek的答案扩展,参考组件使用paragraphreference xtype,该类型在/libs/cq/ui/widgets/source/widgets/form/ParagraphReference.js下定义。

如果创建叠加层,则应该能够更改空解析器的已定义行为。在ParagraphReference.js中定义的xtype中,有一个函数onSelectPage

function(node, event) {
    this.proxy.api["read"].url =
        CQ.HTTP.externalize(node.getPath() + ".paragraphs.json", true);
    this.store.reload();
}

由此看来,CQ似乎正在使用paragraphs选择器从页面中取回特定内容,例如看看“/content/geometrixx/en.paragraphs.json”。以下是此请求返回的示例JSON对象:

{
    "paragraphs": [{
        "path": "/content/geometrixx/en/jcr:content/par/image",
        "html": "\n\n\n\n<div class=\"genericImage\">\n\n    \n    \n\t\n\t\n\t\n\t\n\t\n\t\n\t\n\t\n\t\n\t\t\n\t\t\n\t\t\t <img src=\"/content/dam/geometrixx/portraits/jane_doe.jpg/_jcr_content/renditions/original\" alt=\"Jane Doe\" class=\"cq-dd-image\" title=\"Jane Doe\"/>\n\t\t\n\t\n    "
    }, {
        "path": "/content/geometrixx/en/jcr:content/par/title_1",
        "html": "<h2>Strategic Consulting<\/h2>\n"
    }, {
        "path": "/content/geometrixx/en/jcr:content/par/text_1",
        "html": "\n\n\n\n\n\n\n<div class=\"copy\">&lt;p&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: 12px;&quot;&gt;In&amp;nbsp;today's competitive market, organizations can face several key geometric challenges:&lt;/span&gt;&lt;/p&gt;<br>&lt;ul&gt;<br>&lt;li&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: 12px;&quot;&gt;Polyhedral Sectioning&lt;/span&gt;&lt;/li&gt;<br>&lt;li&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: 12px;&quot;&gt;Triangulation&amp;nbsp;&lt;/span&gt;&lt;/li&gt;<br>&lt;li&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: 12px;&quot;&gt;Trigonometric Calculation&lt;/span&gt;&lt;/li&gt;<br>&lt;li&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: 12px;&quot;&gt;Ruler and Compass Construction&lt;/span&gt;&lt;/li&gt;<br>&lt;/ul&gt;<br>&lt;p&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: 12px;&quot;&gt;&lt;br/&gt;<br>Geometrixx is ready to help your organization deal effectively with all these challenges through our award winning geometric consulting services.&lt;/span&gt;&lt;/p&gt;<br>&lt;p style=&quot;font-family: tahoma, arial, helvetica, sans-serif; font-size: 12px;&quot;&gt;&lt;/p&gt;<br><\/div>\n\n\n\n\n\n\n\n\n<p>\n\n\n<\/p>\n\n"
    }, {
        "path": "/content/geometrixx/en/jcr:content/par/image_0",
        "html": "\n\n\n\n<div class=\"genericImage\">\n\n    \n    \n\t\n\t\n\t\n\t\n\t\n\t\n\t\n\t\n\t\n\t\t\n\t\t\n\t\t\t <img src=\"/content/dam/geometrixx/offices/clean_room.jpg/_jcr_content/renditions/original\" alt=\"Men at Work in the Clean Room\" class=\"cq-dd-image\" title=\"Men at Work in the Clean Room\"/>\n\t\t\n\t\n    "
    }, {
        "path": "/content/geometrixx/en/jcr:content/par/title_2",
        "html": "<h2>Shape Technology<\/h2>\n"
    }, {
        "path": "/content/geometrixx/en/jcr:content/par/text_0",
        "html": "\n\n\n\n\n\n\n<div class=\"copy\"><p>The Geometrixx investment in R&amp;D has done more than solidify our industry leadership role, we have now outpaced our competitors to such an extent that we are in an altogether new space.<\/p>\n<p>This is why our high quality polygons and polyhedra provide the only turnkey solutions across the whole range of euclidean geometry. And our mathematicians are working on the next generation of fractal curves to bring you shapes that are unthinkable today.<\/p>\n<p><\/p>\n<p><\/p>\n\n\n            <\/div>\n\n\n\n\n\n\n\n\n<p>\n\n\n<\/p>\n\n"
    }, {
        "path": "/content/geometrixx/en/jcr:content/rightpar/teaser",
        "html": "<script type=\"text/javascript\">\nCQURLInfo = {\n    \"contextPath\": null,\n    \"requestPath\": '\\/content\\/geometrixx\\/en\\/jcr:content\\/rightpar\\/teaser',\n    \"selectorString\": null,\n    \"selectors\": [],\n    \"extension\": 'html',\n    \"suffix\": null,\n    \"systemId\": '5859bb1d-dee4-484f-ac0d-d83dc1c013ed',\n    \"runModes\": 'lbi,dev,publish'\n};<\/script>\n<script type=\"text/javascript\" src=\"/etc/clientlibs/foundation/librarymanager.js\"><\/script>\n<script type=\"text/javascript\">\nCQClientLibraryManager.write([{\"p\":\"/etc/clientlibs/foundation/jquery.js\",\"c\":[]},{\"p\":\"/etc/clientlibs/foundation/shared.js\",\"c\":[]},{\"p\":\"/etc/clientlibs/foundation/jquery-ui.js\",\"c\":[]},{\"p\":\"/etc/clientlibs/foundation/personalization/jcarousel.css\",\"c\":[]},{\"p\":\"/etc/clientlibs/foundation/personalization/jcarousel.js\",\"c\":[]},{\"p\":\"/etc/clientlibs/foundation/personalization.js\",\"c\":[]},{\"p\":\"/etc/clientlibs/foundation/jquery-ui/themes/default.css\",\"c\":[]},{\"p\":\"/etc/clientlibs/foundation/personalization/themes/default.css\",\"c\":[]},{\"p\":\"/etc/clientlibs/foundation/personalization/ie6/themes/default.css\",\"c\":[\"ie6\"]}],false);\n<\/script>\n<script type=\"text/javascript\">$CQ(function() {initializeTeaserLoader([{\"path\":\"/content/campaigns/geometrixx/scott-recommends\",\"name\":\"scott-recommends\",\"title\":\"Scott Recommends\",\"campainName\":\"geometrixx\",\"thumbnail\":\"/content/campaigns/geometrixx/scott-recommends/jcr:content/par/image.img.png\",\"id\":\"geometrixx_scott-recommends\",\"segments\":[\"/etc/segmentation/geometrixx/male\"],\"tags\":[]},{\"path\":\"/content/campaigns/geometrixx/yolanda-recommends\",\"name\":\"yolanda-recommends\",\"title\":\"Yolanda Recommends\",\"campainName\":\"geometrixx\",\"thumbnail\":\"/content/campaigns/geometrixx/yolanda-recommends/jcr:content/par/image.img.png\",\"id\":\"geometrixx_yolanda-recommends\",\"segments\":[\"/etc/segmentation/geometrixx/female\"],\"tags\":[]},{\"path\":\"/content/campaigns/geometrixx/default_teaser\",\"name\":\"default_teaser\",\"title\":\"Default Teaser\",\"campainName\":\"geometrixx\",\"thumbnail\":\"/content/campaigns/geometrixx/default_teaser/jcr:content/par/image.img.png\",\"id\":\"geometrixx_default_teaser\",\"segments\":[],\"tags\":[]}], \"first\", \"_content_geometrixx_en_jcr_content_rightpar_teaser\", \"false\", \"http://localhost:4502/libs/wcm/stats/tracker\", \"/content/geometrixx/en/jcr:content/rightpar/teaser\");\n        });<\/script><div id=\"_content_geometrixx_en_jcr_content_rightpar_teaser\" class=\"campaign campaign-geometrixx\"><noscript><div class=\"par parsys\"><div class=\"title section\"><h3>Get the Geometrixx App<\/h3>\n<\/div>\n<div class=\"text module shadow section imagetext\">\n\n\n\n\n\n\n<div class=\"copy\"><p>All things Geometrixx, anytime, anywhere. Our mobile app is is as groundbreaking and remarkably easy-to-use as our shapes. <\/p><p><\/p>\n\n            <\/div>\n\n\n\n\n\n\n\n\n<p>\n\n\n<\/p>\n\n<\/div>\n\n\n\n\n<div class=\"genericImage\">\n\n    \n    \n\t\n\t\n\t\n\t\n\t\n\t\n\t\n\t\n\t\n\t\t\n\t\t\n\t\t\t <img src=\"/content/dam/geometrixx/banners/mobile.jpg/_jcr_content/renditions/original\" alt=\"Geometrixx App\" class=\"cq-dd-image\" title=\"Geometrixx App\"/>\n\t\t\n\t\n    <\/div>\n<\/div>\n<\/noscript><\/div>"
    }],
    "count": 7
}

因此,可以使用此选择器通过使用paragraphs.json选择器检查当前使用空白parsys返回的页面内容(似乎您需要通过身份验证才能访问此端点)。

如果这些对象的“html”属性为空,则可以扩展覆盖版本中的onSelectPage函数,以循环遍历parsys&amp;数组。将它的“path”属性值复制到这些节点的“html”属性。