mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-11-12 00:45:47 +01:00
removing recent replies code + tpls from the core in favour of widget system
This commit is contained in:
@@ -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;
|
||||
});
|
||||
@@ -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>
|
||||
|
||||
|
||||
@@ -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 -->
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user