Add widget areas

main
yariplus 9 years ago committed by Julian Lam
parent 03251693ee
commit 51df742190

@ -13,4 +13,56 @@ library.getTeasers = function(data, callback) {
callback(null, data); callback(null, data);
}; };
library.defineWidgetAreas = function(areas, callback) {
areas = areas.concat([
{
name: "Categories Sidebar",
template: "categories.tpl",
location: "sidebar"
},
{
name: "Category Sidebar",
template: "category.tpl",
location: "sidebar"
},
{
name: "Topic Sidebar",
template: "topic.tpl",
location: "sidebar"
},
{
name: "Categories Header",
template: "categories.tpl",
location: "header"
},
{
name: "Category Header",
template: "category.tpl",
location: "header"
},
{
name: "Topic Header",
template: "topic.tpl",
location: "header"
},
{
name: "Categories Footer",
template: "categories.tpl",
location: "footer"
},
{
name: "Category Footer",
template: "category.tpl",
location: "footer"
},
{
name: "Topic Footer",
template: "topic.tpl",
location: "footer"
}
]);
callback(null, areas);
};
module.exports = library; module.exports = library;

@ -2,7 +2,8 @@
"id": "nodebb-theme-persona", "id": "nodebb-theme-persona",
"library": "library.js", "library": "library.js",
"hooks": [ "hooks": [
{ "hook": "filter:teasers.get", "method": "getTeasers" } { "hook": "filter:teasers.get", "method": "getTeasers" },
{ "hook": "filter:widgets.getAreas", "method": "defineWidgetAreas" }
], ],
"scripts": [ "scripts": [
"lib/persona.js", "lib/persona.js",

@ -1,7 +1,14 @@
<!-- IMPORT partials/breadcrumbs.tpl --> <!-- IMPORT partials/breadcrumbs.tpl -->
<h1 class="categories-title">[[pages:categories]]</h1> <div widget-area="header"></div>
<ul class="categories" itemscope itemtype="http://www.schema.org/ItemList"> <div class="row">
<!-- BEGIN categories --> <div class="col-lg-9 col-sm-12" no-widget-class="col-lg-12 col-sm-12" no-widget-target="sidebar">
<!-- IMPORT partials/categories/item.tpl --> <h1 class="categories-title">[[pages:categories]]</h1>
<!-- END categories --> <ul class="categories" itemscope itemtype="http://www.schema.org/ItemList">
</ul> <!-- BEGIN categories -->
<!-- IMPORT partials/categories/item.tpl -->
<!-- END categories -->
</ul>
</div>
<div widget-area="sidebar" class="col-lg-3 col-sm-12"></div>
</div>
<div widget-area="footer"></div>

@ -1,41 +1,46 @@
<div class="category"> <!-- IMPORT partials/breadcrumbs.tpl -->
<!-- IMPORT partials/breadcrumbs.tpl --> <div widget-area="header"></div>
<!-- IMPORT partials/category/subcategory.tpl --> <div class="row">
<div class="category col-lg-9 col-sm-12" no-widget-class="category col-lg-12 col-sm-12" no-widget-target="sidebar">
<!-- IF children.length --><hr class="hidden-xs"/><!-- ENDIF children.length --> <!-- IMPORT partials/category/subcategory.tpl -->
<div class="clearfix"> <!-- IF children.length --><hr class="hidden-xs"/><!-- ENDIF children.length -->
<!-- IF privileges.topics:create -->
<button id="new_topic" class="btn btn-primary">[[category:new_topic_button]]</button> <div class="clearfix">
<!-- ELSE --> <!-- IF privileges.topics:create -->
<!-- IF !loggedIn --> <button id="new_topic" class="btn btn-primary">[[category:new_topic_button]]</button>
<a href="{config.relative_path}/login" class="btn btn-primary">[[category:guest-login-post]]</a> <!-- ELSE -->
<!-- ENDIF !loggedIn --> <!-- IF !loggedIn -->
<!-- ENDIF privileges.topics:create --> <a href="{config.relative_path}/login" class="btn btn-primary">[[category:guest-login-post]]</a>
<!-- ENDIF !loggedIn -->
<span class="pull-right" component="category/controls"> <!-- ENDIF privileges.topics:create -->
<!-- IMPORT partials/category/watch.tpl -->
<!-- IMPORT partials/category/sort.tpl --> <span class="pull-right" component="category/controls">
<!-- IMPORT partials/category/tools.tpl --> <!-- IMPORT partials/category/watch.tpl -->
</span> <!-- IMPORT partials/category/sort.tpl -->
<!-- IMPORT partials/category/tools.tpl -->
</span>
</div>
<hr class="hidden-xs" />
<p class="hidden-xs">{name}</p>
<!-- IF !topics.length -->
<div class="alert alert-warning" id="category-no-topics">
[[category:no_topics]]
</div>
<!-- ENDIF !topics.length -->
<!-- IMPORT partials/topics_list.tpl -->
<!-- IF config.usePagination -->
<!-- IMPORT partials/paginator.tpl -->
<!-- ENDIF config.usePagination -->
</div> </div>
<div widget-area="sidebar" class="col-lg-3 col-sm-12"></div>
<hr class="hidden-xs" />
<p class="hidden-xs">{name}</p>
<!-- IF !topics.length -->
<div class="alert alert-warning" id="category-no-topics">
[[category:no_topics]]
</div>
<!-- ENDIF !topics.length -->
<!-- IMPORT partials/topics_list.tpl -->
<!-- IF config.usePagination -->
<!-- IMPORT partials/paginator.tpl -->
<!-- ENDIF config.usePagination -->
</div> </div>
<div widget-area="footer"></div>
<!-- IMPORT partials/move_thread_modal.tpl --> <!-- IMPORT partials/move_thread_modal.tpl -->
@ -44,4 +49,3 @@
<!-- IMPORT partials/paginator.tpl --> <!-- IMPORT partials/paginator.tpl -->
</noscript> </noscript>
<!-- ENDIF !config.usePagination --> <!-- ENDIF !config.usePagination -->

@ -1,60 +1,65 @@
<!-- IMPORT partials/breadcrumbs.tpl -->
<div widget-area="header"></div>
<div class="row"> <div class="row">
<div class="topic col-lg-12"> <div widget-area="header" class="col-sm-12"></div>
<!-- IMPORT partials/breadcrumbs.tpl --> <div class="topic col-lg-9 col-sm-12" no-widget-class="topic col-lg-12 col-sm-12" no-widget-target="sidebar">
<h1 component="post/header" class="hidden-xs" itemprop="name"> <h1 component="post/header" class="hidden-xs" itemprop="name">
<i class="pull-left fa fa-thumb-tack <!-- IF !pinned -->hidden<!-- ENDIF !pinned -->"></i> <i class="pull-left fa fa-lock <!-- IF !locked -->hidden<!-- ENDIF !locked -->"></i> <span class="topic-title" component="topic/title">{title}</span> <i class="pull-left fa fa-thumb-tack <!-- IF !pinned -->hidden<!-- ENDIF !pinned -->"></i> <i class="pull-left fa fa-lock <!-- IF !locked -->hidden<!-- ENDIF !locked -->"></i> <span class="topic-title" component="topic/title">{title}</span>
<span class="browsing-users hidden hidden-xs hidden-sm pull-right"> <span class="browsing-users hidden hidden-xs hidden-sm pull-right">
<span>[[category:browsing]]</span> <span>[[category:browsing]]</span>
<div component="topic/browsing/list" class="thread_active_users active-users inline-block"></div> <div component="topic/browsing/list" class="thread_active_users active-users inline-block"></div>
<small class="hidden"> <small class="hidden">
<i class="fa fa-users"></i> <span component="topic/browsing/count" class="user-count"></span> <i class="fa fa-users"></i> <span component="topic/browsing/count" class="user-count"></span>
</small> </small>
</span> </span>
</h1> </h1>
<div component="topic/deleted/message" class="alert alert-warning<!-- IF !deleted --> hidden<!-- ENDIF !deleted -->">[[topic:deleted_message]]</div> <div component="topic/deleted/message" class="alert alert-warning<!-- IF !deleted --> hidden<!-- ENDIF !deleted -->">[[topic:deleted_message]]</div>
<hr class="visible-xs" /> <hr class="visible-xs" />
<ul component="topic" class="posts" data-tid="{tid}" data-cid="{cid}"> <ul component="topic" class="posts" data-tid="{tid}" data-cid="{cid}">
<!-- BEGIN posts --> <!-- BEGIN posts -->
<li component="post" class="<!-- IF posts.deleted -->deleted<!-- ENDIF posts.deleted -->" <!-- IMPORT partials/data/topic.tpl -->> <li component="post" class="<!-- IF posts.deleted -->deleted<!-- ENDIF posts.deleted -->" <!-- IMPORT partials/data/topic.tpl -->>
<a component="post/anchor" data-index="{posts.index}" name="{posts.index}"></a> <a component="post/anchor" data-index="{posts.index}" name="{posts.index}"></a>
<meta itemprop="datePublished" content="{posts.timestampISO}"> <meta itemprop="datePublished" content="{posts.timestampISO}">
<meta itemprop="dateModified" content="{posts.editedISO}"> <meta itemprop="dateModified" content="{posts.editedISO}">
<!-- IMPORT partials/topic/post.tpl --> <!-- IMPORT partials/topic/post.tpl -->
<!-- IF !posts.index --> <!-- IF !posts.index -->
<div class="post-bar-placeholder"></div> <div class="post-bar-placeholder"></div>
<!-- ENDIF !posts.index --> <!-- ENDIF !posts.index -->
</li> </li>
<!-- END posts --> <!-- END posts -->
</ul> </ul>
<div class="post-bar"> <div class="post-bar">
<!-- IMPORT partials/post_bar.tpl --> <!-- IMPORT partials/post_bar.tpl -->
</div> </div>
<!-- IF config.usePagination --> <!-- IF config.usePagination -->
<!-- IMPORT partials/paginator.tpl --> <!-- IMPORT partials/paginator.tpl -->
<!-- ENDIF config.usePagination --> <!-- ENDIF config.usePagination -->
<div class="visible-xs visible-sm pagination-block text-center"> <div class="visible-xs visible-sm pagination-block text-center">
<div class="progress-bar"></div> <div class="progress-bar"></div>
<div class="wrapper"> <div class="wrapper">
<i class="fa fa-2x fa-angle-double-up pointer fa-fw pagetop"></i> <i class="fa fa-2x fa-angle-double-up pointer fa-fw pagetop"></i>
<i class="fa fa-2x fa-angle-up pointer fa-fw pageup"></i> <i class="fa fa-2x fa-angle-up pointer fa-fw pageup"></i>
<span class="pagination-text"></span> <span class="pagination-text"></span>
<i class="fa fa-2x fa-angle-down pointer fa-fw pagedown"></i> <i class="fa fa-2x fa-angle-down pointer fa-fw pagedown"></i>
<i class="fa fa-2x fa-angle-double-down pointer fa-fw pagebottom"></i> <i class="fa fa-2x fa-angle-double-down pointer fa-fw pagebottom"></i>
</div>
</div> </div>
</div> </div>
<div widget-area="sidebar" class="col-lg-3 col-sm-12"></div>
</div> </div>
</div> <div widget-area="footer"></div>
<!-- IF !config.usePagination --> <!-- IF !config.usePagination -->
<noscript> <noscript>
<!-- IMPORT partials/paginator.tpl --> <!-- IMPORT partials/paginator.tpl -->

Loading…
Cancel
Save