mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-11-03 20:45:58 +01:00
added filter:topic.thread_tools for creating custom admin functionality in topics view
This commit is contained in:
@@ -181,6 +181,11 @@
|
||||
<li><a href="#" class="fork_thread"><i class="fa fa-fw fa-code-fork"></i> [[topic:thread_tools.fork]]</a></li>
|
||||
<li class="divider"></li>
|
||||
<li><a href="#" class="delete_thread"><span class="text-error"><i class="fa fa-fw fa-trash-o"></i> [[topic:thread_tools.delete]]</span></a></li>
|
||||
<!-- BEGIN thread_tools -->
|
||||
<li>
|
||||
<a href="#" class="{thread_tools.class}"><i class="fa fa-fw {thread_tools.icon}"></i> {thread_tools.title}</a>
|
||||
</li>
|
||||
<!-- END thread_tools -->
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
@@ -208,6 +213,11 @@
|
||||
<li><a href="#" class="fork_thread"><i class="fa fa-fw fa-code-fork"></i> [[topic:thread_tools.fork]]</a></li>
|
||||
<li class="divider"></li>
|
||||
<li><a href="#" class="delete_thread"><span class="text-error"><i class="fa fa-fw fa-trash-o"></i> [[topic:thread_tools.delete]]</span></a></li>
|
||||
<!-- BEGIN thread_tools -->
|
||||
<li>
|
||||
<a href="#" class="{thread_tools.class}"><i class="fa fa-fw {thread_tools.icon}"></i> {thread_tools.title}</a>
|
||||
</li>
|
||||
<!-- END thread_tools -->
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -826,7 +826,13 @@ var async = require('async'),
|
||||
Topics.getPageCount(tid, current_user, next);
|
||||
}
|
||||
|
||||
async.parallel([getTopicData, getTopicPosts, getPrivileges, getCategoryData, getPageCount], function(err, results) {
|
||||
function getThreadTools(next) {
|
||||
Plugins.fireHook('filter:topic.thread_tools', [], function(err, threadTools) {
|
||||
next(err, threadTools);
|
||||
});
|
||||
}
|
||||
|
||||
async.parallel([getTopicData, getTopicPosts, getPrivileges, getCategoryData, getPageCount, getThreadTools], function(err, results) {
|
||||
if (err) {
|
||||
winston.error('[Topics.getTopicWithPosts] Could not retrieve topic data: ', err.message);
|
||||
return callback(err);
|
||||
@@ -835,7 +841,8 @@ var async = require('async'),
|
||||
var topicData = results[0],
|
||||
privileges = results[2],
|
||||
categoryData = results[3],
|
||||
pageCount = results[4];
|
||||
pageCount = results[4],
|
||||
threadTools = results[5];
|
||||
|
||||
callback(null, {
|
||||
'topic_name': topicData.title,
|
||||
@@ -852,6 +859,7 @@ var async = require('async'),
|
||||
'unreplied': parseInt(topicData.postcount, 10) === 1,
|
||||
'topic_id': tid,
|
||||
'expose_tools': privileges.editable ? 1 : 0,
|
||||
'thread_tools': threadTools,
|
||||
'disableSocialButtons': meta.config.disableSocialButtons !== undefined ? parseInt(meta.config.disableSocialButtons, 10) !== 0 : false,
|
||||
'posts': results[1]
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user