I am doing a Sharepoint project where I am displaying all subsites in a list on the home screen. I have set them up in a Microsoft Metro/Tiles design, so that each subsite represent one tile.
I am now trying to make these tiles differate in color, based on what kind of site template the subsite it represents is based on. Blue for blank site, red for wiki etc. The problem is I can't seem to access each subsites template property. Does anyone have a clue on how it could be performed? I'll attach the important parts of the code:
var sites;
ExecuteOrDelayUntilScriptLoaded(loadSites, 'SP.js');
function loadSites()
{
var context = new SP.ClientContext.get_current();
if(context != undefined && context != null) {
var web = context.get_web();
this.sites = web.getSubwebsForCurrentUser(null);
context.load(this.sites);
context.executeQueryAsync(
Function.createDelegate(this, this.onSuccess),
Function.createDelegate(this, this.onFailed));
}
function onSuccess()
{
var items = this.sites.getEnumerator();
var menuNavContent = '';
var contentNavContent = '';
var templates = '';
menuNavContent += '<div id="applist">';
menuNavContent += '<h1>Sites</h1>';
menuNavContent += '<ul class="apps">';
contentNavContent += '<div id="appbox">';
contentNavContent += '<ul class="apps">';
var counter = 1;
while(items.moveNext())
{
try
{
var item = items.get_current();
var itemUrl = item.get_serverRelativeUrl();
var title = item.get_title();
var lastItemModified = getModifiedDateString(new Date(item.get_lastItemModifiedDate()));
Any takers? :D
Best regards, Olav Gundersen