From c7fb34c23f9642633ce16307861e42b8579e0e22 Mon Sep 17 00:00:00 2001 From: psychobunny Date: Fri, 21 Feb 2014 16:02:48 -0500 Subject: [PATCH 1/5] new client-side hooks: filter:categories.new_topic, action:categories.new_topic.loaded --- public/src/forum/category.js | 4 ++++ 1 file changed, 4 insertions(+) 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'); }); } From e9c7de951b3dec8d4e6f588ae053c47e8cc54cd3 Mon Sep 17 00:00:00 2001 From: psychobunny Date: Fri, 21 Feb 2014 16:08:43 -0500 Subject: [PATCH 2/5] moved pin and lock out of .topic-title --- public/templates/category.tpl | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) 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 @@ From 32ac3d94d24b40f8a5db38e88ed4937737fd5338 Mon Sep 17 00:00:00 2001 From: psychobunny Date: Fri, 21 Feb 2014 16:15:33 -0500 Subject: [PATCH 3/5] moved pin and lock out of .topic-title in popular/recent/unread --- public/templates/popular.tpl | 9 ++------- public/templates/recent.tpl | 9 ++------- public/templates/unread.tpl | 9 ++------- 3 files changed, 6 insertions(+), 21 deletions(-) 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/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}

From 6f7243f42f358396fd93be7af29806475404f8e2 Mon Sep 17 00:00:00 2001 From: psychobunny Date: Fri, 21 Feb 2014 16:46:58 -0500 Subject: [PATCH 4/5] fixed a bug running multiple blocks in one template on an empty array --- public/src/templates.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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) { From 2ec6dd1d141cd9283a1fd0e94f0dec4e7f668732 Mon Sep 17 00:00:00 2001 From: psychobunny Date: Fri, 21 Feb 2014 16:47:40 -0500 Subject: [PATCH 5/5] added filter:topic.thread_tools for creating custom admin functionality in topics view --- public/templates/topic.tpl | 10 ++++++++++ src/topics.js | 12 ++++++++++-- 2 files changed, 20 insertions(+), 2 deletions(-) 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/src/topics.js b/src/topics.js index 6ad23bee70..046593e253 100644 --- a/src/topics.js +++ b/src/topics.js @@ -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] });