|
<!DOCTYPE html> |
|
<html> |
|
<head> |
|
<!-- This is the config to be used --> |
|
<script> |
|
MuraCaaSConfig={ |
|
siteid:'caas', |
|
endpoint:'http://localhost:8080', |
|
CaaSContainerSelector:'body' |
|
}; |
|
</script> |
|
|
|
<!-- This is include the main Mura.js lib --> |
|
<script src="http://localhost:8080/core/modules/v1/core_assets/js/mura.js"></script> |
|
|
|
<!-- This is a simple template for Mura to use for it's content. This could be another file --> |
|
<script id="mura-template-default" type="text/x-mura-template"> |
|
<div class="mura-nav"> |
|
<h3>Primary Nav</h3> |
|
<ul class="mura-primary-nav"></ul> |
|
<h3>Crumb Nav</h3> |
|
<ul class="mura-crumb-nav"></ul> |
|
<h3>Child Nav</h3> |
|
<ul class="mura-child-nav"></ul> |
|
</div> |
|
<div class="mura-content"></div> |
|
<div class="mura-region-container" data-region="maincontent"></div> |
|
<div class="mura-html-queues"></div> |
|
</script> |
|
|
|
<!-- This init's Mura.js and renders the content. This could be another file --> |
|
<script> |
|
Mura.init(MuraCaaSConfig); |
|
|
|
Mura(function(){ |
|
Mura.loader() |
|
.loadcss(Mura.endpoint + '/core/modules/v1/core_assets/css/mura.7.1.min.css') |
|
.loadcss(Mura.endpoint + '/core/modules/v1/core_assets/css/mura.7.1.skin.css'); |
|
|
|
function buildNav(container,parentid){ |
|
|
|
container.html(''); |
|
|
|
if(parentid=='00000000000000000000000000000000001'){ |
|
container.html('<li><a href="./#">Home</a></li>'); |
|
} |
|
|
|
Mura.getFeed('content') |
|
.where() |
|
.prop('parentid').isEQ(parentid) |
|
.getQuery() |
|
.then(function(collection){ |
|
collection.forEach(function(item){ |
|
container.append('<li><a href="' + item.get('url') + '">' + item.get('menutitle') + '</a></li>'); |
|
}); |
|
}) |
|
} |
|
|
|
function renderNav(container,collection){ |
|
container.html(''); |
|
collection.forEach(function(item){ |
|
container.append('<li><a href="' + item.get('url') + '">' + item.get('menutitle') + '</a></li>'); |
|
}); |
|
} |
|
|
|
function buildCrumbs(content){ |
|
content.get('crumbs').then(function(collection){ |
|
collection.get('items').reverse() |
|
renderNav( Mura('.mura-crumb-nav'),collection); |
|
}) |
|
} |
|
function render(){ |
|
let hash= location.hash || '#'; |
|
|
|
Mura.renderFilename( |
|
hash.split('#')[1], |
|
Mura.getQueryStringParams() |
|
).then(function(content){ |
|
|
|
Mura('.mura-content').html(content.get('body')); |
|
Mura('.mura-html-queues').html(content.get('htmlheadqueue') + content.get('htmlfootqueue')); |
|
|
|
Mura.extend(Mura,content.get('config')); |
|
|
|
Mura('.mura-region-container').each(function(){ |
|
var item=Mura(this); |
|
item.html( |
|
content.renderDisplayRegion( |
|
item.data('region') |
|
) |
|
); |
|
}) |
|
|
|
|
|
if(content.hasParent() |
|
&& content.get('type') != 'Folder' |
|
&& content.get('type') != 'Calendar'){ |
|
buildNav( |
|
Mura('.mura-child-nav'), |
|
content.get('contentid') |
|
); |
|
} else { |
|
Mura('.mura-child-nav').html(''); |
|
} |
|
|
|
buildCrumbs(content); |
|
|
|
Mura(document).processMarkup(); |
|
|
|
}); |
|
} |
|
|
|
Mura(Mura.CaaSContainerSelector).append(Mura('#mura-template-default').html()); |
|
|
|
buildNav( |
|
Mura('.mura-primary-nav'), |
|
'00000000000000000000000000000000001' |
|
); |
|
|
|
render(); |
|
|
|
Mura(window).on('hashchange', render); |
|
|
|
}); |
|
</script> |
|
</head> |
|
<body> |
|
</body> |
|
</html> |