closes #3, add theme areas from harmony

This commit is contained in:
Barış Soner Uşaklı 2024-01-01 18:42:27 -05:00
parent 8f488a681d
commit 7c41ac2006

View File

@ -4,27 +4,62 @@
const Theme = module.exports; const Theme = module.exports;
Theme.defineWidgetAreas = async function (areas) { 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([ areas = areas.concat([
{ {
name: 'MOTD', name: 'Main post header',
template: 'home.tpl',
location: 'motd',
},
{
name: 'Homepage Footer',
template: 'home.tpl',
location: 'footer',
},
{
name: 'Category Sidebar',
template: 'category.tpl',
location: 'sidebar',
},
{
name: 'Topic Footer',
template: 'topic.tpl', 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; return areas;
}; };