removing recent replies code + tpls from the core in favour of widget system

v1.18.x
psychobunny 11 years ago
parent 1827c8390b
commit cb986186a1

@ -37,8 +37,6 @@ define(['composer', 'forum/pagination'], function(composer, pagination) {
socket.on('event:new_topic', Category.onNewTopic); socket.on('event:new_topic', Category.onNewTopic);
socket.emit('categories.getRecentReplies', cid, renderRecentReplies);
enableInfiniteLoading(); enableInfiniteLoading();
}; };
@ -84,7 +82,6 @@ define(['composer', 'forum/pagination'], function(composer, pagination) {
} }
topic.hide().fadeIn('slow'); topic.hide().fadeIn('slow');
socket.emit('categories.getRecentReplies', templates.get('category_id'), renderRecentReplies);
addActiveUser(data); 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; return Category;
}); });

@ -97,20 +97,26 @@
</div> </div>
<!-- IF topics.length --> <!-- 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 panel-default">
<div class="panel-heading">[[category:sidebar.recent_replies]]</div> <div class="panel-heading">{widgets.title}</div>
<div class="panel-body recent-replies"> <div class="panel-body">
<ul id="category_recent_replies"></ul> {widgets.html}
</div> </div>
</div> </div>
<!-- END widgets -->
</div>
<div class="col-md-3 col-xs-12 category-sidebar">
<div class="panel panel-default"> <div class="panel panel-default">
<div class="panel-heading">[[category:sidebar.active_participants]]</div> <div class="panel-heading">[[category:sidebar.active_participants]]</div>
<div class="panel-body active-users"> <div class="panel-body">
<!-- BEGIN active_users --> <div class="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> <!-- BEGIN active_users -->
<!-- END 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>
</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, uid: uid,
area: area, area: area,
data: widget.data data: widget.data
}, function(err, html){ }, function(err, data){
rendered.push({ rendered.push({
html: html html: data.html,
title: data.title
}); });
next(err); next(err);

Loading…
Cancel
Save