Commit 430271e0 authored by Tim Rogers's avatar Tim Rogers

MGU-746 hideInNav setting from page rules

parent 994655cd
......@@ -156,6 +156,7 @@ module.exports = function(parentPath, slingConnector, options, cb){
var component = componentRegistry.get(type), includeIt=false;
var title = pageRules.title || (component?component.title:"");
var parts = type.split("/"), componentClass, longName=[];
var hideInNav = pageRules.hideInNav;
for (var i = parts.length; i-- > 0 && !componentClass; ){
if(/^(content|pages|layouts)$/.test(parts[i])){componentClass=parts[i];}
}
......@@ -179,10 +180,10 @@ module.exports = function(parentPath, slingConnector, options, cb){
if(pageName==="*" && pageRules.allowed){
_.each(pageRules.allowed, (options, allowedName)=>{
byCategory[category].push({ type:type, componentClass, longName:longName.join(" / "), icon: componentIcons[componentClass], title: options.title || title, name: allowedName, unavailable:existingChildren.indexOf(allowedName)>-1?"unavailable":false });
byCategory[category].push({ type:type, componentClass, longName:longName.join(" / "), icon: componentIcons[componentClass], title: options.title || title, name: allowedName, unavailable:existingChildren.indexOf(allowedName)>-1?"unavailable":false, hideInNav });
});
}else{
byCategory[category].push({ type:type, componentClass, longName:longName.join(" / "), icon: componentIcons[componentClass], title, name: (pageName==="*" ? "" : pageName), unavailable:existingChildren.indexOf(pageName)>-1?"unavailable":false });
byCategory[category].push({ type:type, componentClass, longName:longName.join(" / "), icon: componentIcons[componentClass], title, name: (pageName==="*" ? "" : pageName), unavailable:existingChildren.indexOf(pageName)>-1?"unavailable":false, hideInNav });
}
allTypes.push(id);
}
......
......@@ -19,7 +19,7 @@
<div class="col s12 m8">
<div class="collection">
{{#each options }}
<a href="javascript:;" class="collection-item {{#if unavailable}}unavailable{{/if}}" title="{{longName}}" data-type="{{type}}" data-merge-marker="{{@root.writeMergeMetaMarking}}" data-title="{{title}}" data-name="{{name}}"><i class="material-icons tiny">{{icon}}</i><span class="title">{{title}}</span>{{#if name}}<span class="name"> &nbsp; &nbsp; Path name:&nbsp; <i>{{name}}</i></span>{{#if unavailable}}<span class="name" style="text-decoration:none;color:#999;">&nbsp;(already exists)</span>{{/if}}{{/if}}</a>
<a href="javascript:;" class="collection-item {{#if unavailable}}unavailable{{/if}}" title="{{longName}}" data-type="{{type}}" data-merge-marker="{{@root.writeMergeMetaMarking}}" data-title="{{title}}" data-name="{{name}}" data-hide-in-nav="{{hideInNav}}"><i class="material-icons tiny">{{icon}}</i><span class="title">{{title}}</span>{{#if name}}<span class="name"> &nbsp; &nbsp; Path name:&nbsp; <i>{{name}}</i></span>{{#if unavailable}}<span class="name" style="text-decoration:none;color:#999;">&nbsp;(already exists)</span>{{/if}}{{/if}}</a>
{{/each}}
</div>
</div>
......
......@@ -10,7 +10,7 @@ module.exports = function addRequest(options){
var dialogUrl = view.appsMount + "blacklight/edit/dialogs/add-child-page";
var componentTemplateUrl = view.appsMount + "blacklight/edit/component/template-content";
var parentPath = view.path(), pathName;
var $addPathNameField, $addTitleField, resourceType, writeTemplateLocally=false;
var $addPathNameField, $addTitleField, resourceType, hideInNav, writeTemplateLocally=false;
var $addDialog = buildDialog({
saveText:"Add Page",
......@@ -38,6 +38,7 @@ module.exports = function addRequest(options){
resourceType = $selected.data("type");
pathName = $selected.data("name");
var title = $selected.data("title");
hideInNav = $selected.data("hideInNav");
$addDialog.loadBody({url:dialogUrl, data:{step2: true, title:pathName?title:"", pathName:pathName, parentPath:parentPath, resourceType:resourceType}, title:"Add New Page: " + title})
.then(function(data, $dialogBody){
......@@ -100,7 +101,11 @@ module.exports = function addRequest(options){
fd.append("jcr:content/jcr:primaryType", "cq:PageContent");
fd.append("jcr:content/jcr:title", title);
fd.append("jcr:content/sling:resourceType", resourceType || "blacklight/edit/page/new");
if(hideInNav) {
fd.append("jcr:content/hideInNav", hideInNav);
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment