<%
var currentCategory = categories.filter(function(category) { return category.id === activeCategoryId; })[0] || null;
var versionNames = Util.getAvailableVersions(sections, [ currentCategory ? currentCategory.id : null ]);
var activeVersion = Util.getVersion(versionNames);
var activeSection = null;
if (activeSectionId) {
activeSection = sections.filter(function(section) { return section.id === activeSectionId; })[0] || null;
} else {
var activeCategory = categories.filter(function(category) { return category.isActive; })[0] || null;
if (activeCategory) activeSection = activeCategory.sections.filter(function(section) {
return section.name === activeVersion;
})[0] || null;
}
console.log('content version', activeVersion);
%>
<% if (!activeSection) { %>
No content available
There is no content available for version <%= activeVersion %>.
<% } else { %>
<% if (activeSection.sections.length) { %>
<% if (activeSectionId) { %>
<% activeSection.sections.forEach(function(section) { %>
<% if (section.articles.length) { %>
<% } else { %>
empty
<% } %>
<% }) %>
<% } else { %>
<% activeSection.sections.forEach(function(section) { %>
<% if (section.description) { %>
<%= section.description %>
<% } %>
<% }) %>
<% } %>
<% } else if (activeCategory && activeCategory.id === Util.getPageId()) { %>
No content available
There is no content available for version <%= activeVersion %>.
<% } %>
<% if (activeSection.articles.length) { %>
<% if (activeSection.sections.length) { %>
Articles
<% } %>
<% } %>
<% } %>