diff --git a/public/src/forum/category.js b/public/src/forum/category.js index 70b0bcae4e..e9777904ab 100644 --- a/public/src/forum/category.js +++ b/public/src/forum/category.js @@ -53,6 +53,8 @@ define(['composer', 'forum/pagination'], function(composer, pagination) { } Category.onNewTopic = function(data) { + $(window).trigger('filter:categories.new_topic', data); + var html = templates.prepare(templates['category'].blocks['topics']).parse({ topics: [data] }); @@ -89,6 +91,8 @@ define(['composer', 'forum/pagination'], function(composer, pagination) { $('#topics-container span.timeago').timeago(); app.createUserTooltips(); + + $(window).trigger('action:categories.new_topic.loaded'); }); } diff --git a/public/src/templates.js b/public/src/templates.js index e4dbb0f69a..0018b1e974 100644 --- a/public/src/templates.js +++ b/public/src/templates.js @@ -281,7 +281,7 @@ } function makeRegex(block) { - return new RegExp("[\\s\\S]*", 'g'); + return new RegExp("([\\s\\S]*?)", 'g'); } function makeConditionalRegex(block) { diff --git a/public/templates/category.tpl b/public/templates/category.tpl index 4e5308d04b..fff8a220f5 100644 --- a/public/templates/category.tpl +++ b/public/templates/category.tpl @@ -44,10 +44,8 @@ diff --git a/public/templates/popular.tpl b/public/templates/popular.tpl index 5aa10628b4..f2c2f59362 100644 --- a/public/templates/popular.tpl +++ b/public/templates/popular.tpl @@ -32,13 +32,8 @@

- - - - - - {topics.title} - + + {topics.title}

diff --git a/public/templates/recent.tpl b/public/templates/recent.tpl index d09d2f5201..025cffef17 100644 --- a/public/templates/recent.tpl +++ b/public/templates/recent.tpl @@ -33,13 +33,8 @@

- - - - - - {topics.title} - + + {topics.title}

diff --git a/public/templates/topic.tpl b/public/templates/topic.tpl index 4666bc639e..20c8cb4b29 100644 --- a/public/templates/topic.tpl +++ b/public/templates/topic.tpl @@ -181,6 +181,11 @@
  • [[topic:thread_tools.fork]]
  • [[topic:thread_tools.delete]]
  • + +
  • + {thread_tools.title} +
  • + @@ -208,6 +213,11 @@
  • [[topic:thread_tools.fork]]
  • [[topic:thread_tools.delete]]
  • + +
  • + {thread_tools.title} +
  • + diff --git a/public/templates/unread.tpl b/public/templates/unread.tpl index dcdf0dbe9f..6ec77b3668 100644 --- a/public/templates/unread.tpl +++ b/public/templates/unread.tpl @@ -26,13 +26,8 @@

    - - - - - - {topics.title} - + + {topics.title}

    diff --git a/src/topics.js b/src/topics.js index 3080afa9cf..35cc490fb0 100644 --- a/src/topics.js +++ b/src/topics.js @@ -780,7 +780,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); @@ -789,7 +795,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, @@ -806,6 +813,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] });