closes #831, user profile changes
parent
3c63b135c7
commit
574e981de9
@ -0,0 +1,52 @@
|
||||
define(['forum/accountheader'], function(header) {
|
||||
var AccountPosts = {},
|
||||
loadingMore = false;
|
||||
|
||||
AccountPosts.init = function() {
|
||||
header.init();
|
||||
|
||||
app.enableInfiniteLoading(function() {
|
||||
if(!loadingMore) {
|
||||
loadMore();
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
function loadMore() {
|
||||
loadingMore = true;
|
||||
socket.emit('posts.loadMoreUserPosts', {
|
||||
uid: $('.account-username-box').attr('data-uid'),
|
||||
after: $('.user-favourite-posts').attr('data-nextstart')
|
||||
}, function(err, data) {
|
||||
if(err) {
|
||||
return app.alertError(err.message);
|
||||
}
|
||||
|
||||
if (data.posts && data.posts.length) {
|
||||
onTopicsLoaded(data.posts);
|
||||
$('.user-favourite-posts').attr('data-nextstart', data.nextStart);
|
||||
}
|
||||
|
||||
loadingMore = false;
|
||||
});
|
||||
}
|
||||
|
||||
function onTopicsLoaded(posts) {
|
||||
var html = templates.prepare(templates['accountposts'].blocks['posts']).parse({
|
||||
posts: posts
|
||||
});
|
||||
|
||||
translator.translate(html, function(translatedHTML) {
|
||||
|
||||
$('#category-no-topics').remove();
|
||||
|
||||
html = $(translatedHTML);
|
||||
$('.user-favourite-posts').append(html);
|
||||
$('span.timeago').timeago();
|
||||
app.createUserTooltips();
|
||||
app.makeNumbersHumanReadable(html.find('.human-readable-number'));
|
||||
});
|
||||
}
|
||||
|
||||
return AccountPosts;
|
||||
});
|
@ -0,0 +1,41 @@
|
||||
<div class="well favourites">
|
||||
<div class="account-username-box clearfix" data-userslug="{userslug}" data-uid="{uid}">
|
||||
|
||||
</div>
|
||||
|
||||
<!-- IF !posts.length -->
|
||||
<div class="alert alert-warning">[[topic:favourites.has_no_favourites]]</div>
|
||||
<!-- ENDIF !posts.length -->
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-12 user-favourite-posts" data-nextstart="{nextStart}">
|
||||
<!-- BEGIN posts -->
|
||||
<div class="topic-row panel panel-default clearfix">
|
||||
<div class="panel-body">
|
||||
<a href="../../user/{posts.userslug}">
|
||||
<img title="{posts.username}" class="img-rounded user-img" src="{posts.picture}">
|
||||
</a>
|
||||
|
||||
<a href="../../user/{posts.userslug}">
|
||||
<strong><span>{posts.username}</span></strong>
|
||||
</a>
|
||||
<p>{posts.content}</p>
|
||||
|
||||
<div>
|
||||
<small>
|
||||
<span class="pull-right">
|
||||
<a href="../../topic/{posts.tid}/#{posts.pid}">posted</a>
|
||||
in
|
||||
<a href="../../category/{posts.categorySlug}">
|
||||
<i class="fa {posts.categoryIcon}"></i> {posts.categoryName}
|
||||
</a>
|
||||
<span class="timeago" title="{posts.relativeTime}"></span>
|
||||
</span>
|
||||
</small>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- END posts -->
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
Loading…
Reference in New Issue