mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-11-17 11:11:04 +01:00
closes #513
This commit is contained in:
@@ -42,8 +42,13 @@ define(function() {
|
||||
|
||||
loadMoreEl.addEventListener('click', function() {
|
||||
if (this.className.indexOf('disabled') === -1) {
|
||||
var topics = document.querySelectorAll('.topics li[data-tid]'),
|
||||
lastTid = parseInt(topics[topics.length - 1].getAttribute('data-tid'));
|
||||
var topics = document.querySelectorAll('.topics li[data-tid]');
|
||||
|
||||
if(!topics.length) {
|
||||
return;
|
||||
}
|
||||
|
||||
var lastTid = parseInt(topics[topics.length - 1].getAttribute('data-tid'));
|
||||
|
||||
this.innerHTML = '<i class="icon-refresh icon-spin"></i> Retrieving topics';
|
||||
socket.emit('api:admin.topics.getMore', {
|
||||
|
||||
@@ -307,6 +307,7 @@
|
||||
var conditional = makeConditionalRegex(namespace + d);
|
||||
|
||||
var conditionalBlock = conditional.exec(template);
|
||||
console.log(conditionalBlock);
|
||||
|
||||
if (conditionalBlock !== null) {
|
||||
conditionalBlock = conditionalBlock[0].split('<!-- ELSE -->');
|
||||
|
||||
@@ -1,6 +1,12 @@
|
||||
<h1>Topics</h1>
|
||||
<hr />
|
||||
|
||||
<!-- IF notopics -->
|
||||
<div class="alert alert-warning" id="category-no-topics">
|
||||
<strong>There are no topics.</strong>
|
||||
</div>
|
||||
<!-- ENDIF notopics -->
|
||||
|
||||
<ul class="topics">
|
||||
<!-- BEGIN topics -->
|
||||
<li data-tid="{topics.tid}" data-locked="{topics.locked}" data-pinned="{topics.pinned}" data-deleted="{topics.deleted}">
|
||||
@@ -19,6 +25,8 @@
|
||||
<!-- END topics -->
|
||||
</ul>
|
||||
|
||||
<!-- IF showLoadMore -->
|
||||
<div class="text-center">
|
||||
<button id="topics_loadmore" class="btn btn-primary btn-lg">Load More Topics</button>
|
||||
</div>
|
||||
<!-- ENDIF showLoadMore -->
|
||||
|
||||
@@ -246,7 +246,9 @@ var user = require('./../user.js'),
|
||||
app.get('/topics', function (req, res) {
|
||||
topics.getAllTopics(10, null, function (topics) {
|
||||
res.json({
|
||||
topics: topics
|
||||
topics: topics,
|
||||
notopics: topics.length === 0,
|
||||
showLoadMore: topics.length > 0
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user