Node.js based forum software built for the modern web
removing recent replies code + tpls from the core in favour of widget system
psychobunnycb986186a1c8
diff --git a/public/src/forum/category.js b/public/src/forum/category.jsindex fd4b6efe42..faf2375095 100644--- a/public/src/forum/category.js+++ b/public/src/forum/category.js@@ -37,8 +37,6 @@ define(['composer', 'forum/pagination'], function(composer, pagination) {socket.on('event:new_topic', Category.onNewTopic);- socket.emit('categories.getRecentReplies', cid, renderRecentReplies);-enableInfiniteLoading();};@@ -84,7 +82,6 @@ define(['composer', 'forum/pagination'], function(composer, pagination) {}topic.hide().fadeIn('slow');- socket.emit('categories.getRecentReplies', templates.get('category_id'), renderRecentReplies);addActiveUser(data);@@ -159,32 +156,5 @@ define(['composer', 'forum/pagination'], function(composer, pagination) {});}- function renderRecentReplies(err, posts) {- if (err || !posts || posts.length === 0) {- return;- }-- var recentReplies = $('#category_recent_replies');-- templates.preload_template('recentreplies', function() {-- templates['recentreplies'].parse({posts:[]});-- var html = templates.prepare(templates['recentreplies'].blocks['posts']).parse({- posts: posts- });-- translator.translate(html, function(translatedHTML) {- translatedHTML = $(translatedHTML);- translatedHTML.find('img').addClass('img-responsive');-- recentReplies.html(translatedHTML);-- $('#category_recent_replies span.timeago').timeago();- app.createUserTooltips();- });- });- };-return Category;});\ No newline at end of filediff --git a/public/templates/category.tpl b/public/templates/category.tplindex 56ed2766df..c8e3c59640 100644--- a/public/templates/category.tpl+++ b/public/templates/category.tpl@@ -97,20 +97,26 @@</div><!-- IF topics.length -->- <div class="col-md-3 col-xs-12 category-sidebar">+ <div widget-area="sidebar" class="col-md-3 col-xs-12 category-sidebar">+ <!-- BEGIN widgets --><div class="panel panel-default">- <div class="panel-heading">[[category:sidebar.recent_replies]]</div>- <div class="panel-body recent-replies">- <ul id="category_recent_replies"></ul>+ <div class="panel-heading">{widgets.title}</div>+ <div class="panel-body">+ {widgets.html}</div></div>+ <!-- END widgets -->+ </div>+ <div class="col-md-3 col-xs-12 category-sidebar"><div class="panel panel-default"><div class="panel-heading">[[category:sidebar.active_participants]]</div>- <div class="panel-body active-users">- <!-- BEGIN active_users -->- <a data-uid="{active_users.uid}" href="../../user/{active_users.userslug}"><img title="{active_users.username}" src="{active_users.picture}" class="img-rounded user-img" /></a>- <!-- END active_users -->+ <div class="panel-body">+ <div class="active-users"+ <!-- BEGIN active_users -->+ <a data-uid="{active_users.uid}" href="../../user/{active_users.userslug}"><img title="{active_users.username}" src="{active_users.picture}" class="img-rounded user-img" /></a>+ <!-- END active_users -->+ </div></div></div>diff --git a/public/templates/recentreplies.tpl b/public/templates/recentreplies.tpldeleted file mode 100644index 121211c3d6..0000000000--- a/public/templates/recentreplies.tpl+++ /dev/null@@ -1,14 +0,0 @@--<!-- BEGIN posts -->-<li data-pid="{posts.pid}" class="clearfix">- <a href="{relative_path}/user/{posts.userslug}">- <img title="{posts.username}" class="img-rounded user-img" src="{posts.picture}" />- </a>- <strong><span>{posts.username}</span></strong>- <p>{posts.content}</p>- <span class="pull-right">- <a href="{relative_path}/topic/{posts.topicSlug}#{posts.pid}">[[category:posted]]</a>- <span class="timeago" title="{posts.relativeTime}"></span>- </span>-</li>-<!-- END posts -->diff --git a/src/widgets.js b/src/widgets.jsindex ac848a0b33..d7898c465a 100644--- a/src/widgets.js+++ b/src/widgets.js@@ -21,9 +21,10 @@ var async = require('async'),uid: uid,area: area,data: widget.data- }, function(err, html){+ }, function(err, data){rendered.push({- html: html+ html: data.html,+ title: data.title});next(err);