Profile tweaks; display more posts

This commit is contained in:
Sacha Greif 2014-09-01 09:52:40 +09:00
parent 21c6dc6854
commit d25f644c2c
5 changed files with 10 additions and 5 deletions

View file

@ -121,7 +121,7 @@
{{#each comments}}
<tr>
<td><a href="/posts/{{postId}}/">{{postTitle}}</a></td>
<td>{{body}}</td>
<td>{{{htmlBody}}}</td>
<td>{{formatDate createdAt "MM/DD/YYYY, HH:mm"}}</td>
</tr>
{{/each}}

View file

@ -51,7 +51,8 @@ Template[getTemplate('user_profile')].helpers({
// extend comments with each commented post
var extendedComments = comments.map(function (comment) {
var post = Posts.findOne(comment.postId);
comment.postTitle = post.title;
if(post) // post might not be available anymore
comment.postTitle = post.title;
return comment;
});
return extendedComments

View file

@ -16,7 +16,7 @@ getParameters = function (terms) {
}
};
var parameters = baseParameters;
var view = dashToCamel(terms.view);
var view = !!terms.view ? dashToCamel(terms.view) : 'top'; // if view is not defined, default to "top"
// get query parameters according to current view
if(typeof viewParameters[view] !== 'undefined')

View file

@ -1,3 +1,5 @@
var daysPerPage = 5;
var coreSubscriptions = new SubsManager({
// cache recent 50 subscriptions
cacheLimit: 50,
@ -10,7 +12,7 @@ var coreSubscriptions = new SubsManager({
PostsDailyController = RouteController.extend({
template: getTemplate('posts_daily'),
onBeforeAction: function() {
this.days = this.params.days ? this.params.days : 3;
this.days = this.params.days ? this.params.days : daysPerPage;
// this.days = Session.get('postsDays') ? Session.get('postsDays') : 3;
var terms = {

View file

@ -1,3 +1,5 @@
var daysPerPage = 5;
var getPosts = function (date) {
var terms = {
view: 'digest',
@ -34,7 +36,7 @@ Template[getTemplate('postsDaily')].helpers({
return getPosts(this.date);
},
loadMoreUrl: function () {
var count = parseInt(Session.get('postsDays')) + 3;
var count = parseInt(Session.get('postsDays')) + daysPerPage;
return '/daily/' + count;
}
});