closes #3, add theme areas from harmony
This commit is contained in:
parent
8f488a681d
commit
7c41ac2006
69
lib/theme.js
69
lib/theme.js
@ -4,27 +4,62 @@
|
||||
const Theme = module.exports;
|
||||
|
||||
Theme.defineWidgetAreas = async function (areas) {
|
||||
const locations = ['header', 'sidebar', 'footer'];
|
||||
const templates = [
|
||||
'categories.tpl', 'category.tpl', 'topic.tpl', 'users.tpl',
|
||||
'unread.tpl', 'recent.tpl', 'popular.tpl', 'top.tpl', 'tags.tpl', 'tag.tpl',
|
||||
'login.tpl', 'register.tpl',
|
||||
];
|
||||
function capitalizeFirst(str) {
|
||||
return str.charAt(0).toUpperCase() + str.slice(1);
|
||||
}
|
||||
templates.forEach((template) => {
|
||||
locations.forEach((location) => {
|
||||
areas.push({
|
||||
name: `${capitalizeFirst(template.split('.')[0])} ${capitalizeFirst(location)}`,
|
||||
template: template,
|
||||
location: location,
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
areas = areas.concat([
|
||||
{
|
||||
name: 'MOTD',
|
||||
template: 'home.tpl',
|
||||
location: 'motd',
|
||||
},
|
||||
{
|
||||
name: 'Homepage Footer',
|
||||
template: 'home.tpl',
|
||||
location: 'footer',
|
||||
},
|
||||
{
|
||||
name: 'Category Sidebar',
|
||||
template: 'category.tpl',
|
||||
location: 'sidebar',
|
||||
},
|
||||
{
|
||||
name: 'Topic Footer',
|
||||
name: 'Main post header',
|
||||
template: 'topic.tpl',
|
||||
location: 'footer',
|
||||
location: 'mainpost-header',
|
||||
},
|
||||
{
|
||||
name: 'Main post footer',
|
||||
template: 'topic.tpl',
|
||||
location: 'mainpost-footer',
|
||||
},
|
||||
{
|
||||
name: 'Sidebar Footer',
|
||||
template: 'global',
|
||||
location: 'sidebar-footer',
|
||||
},
|
||||
{
|
||||
name: 'Brand Header',
|
||||
template: 'global',
|
||||
location: 'brand-header',
|
||||
},
|
||||
{
|
||||
name: 'About me (before)',
|
||||
template: 'account/profile.tpl',
|
||||
location: 'profile-aboutme-before',
|
||||
},
|
||||
{
|
||||
name: 'About me (after)',
|
||||
template: 'account/profile.tpl',
|
||||
location: 'profile-aboutme-after',
|
||||
},
|
||||
{
|
||||
name: 'Chat Header',
|
||||
template: 'chats.tpl',
|
||||
location: 'header',
|
||||
},
|
||||
]);
|
||||
|
||||
return areas;
|
||||
};
|
||||
|
Loading…
x
Reference in New Issue
Block a user