working on digest

This commit is contained in:
Sacha Greif 2013-10-06 09:33:00 +09:00
parent d8070e51fa
commit 9a012cbdd0
4 changed files with 24 additions and 12 deletions

View file

@ -1,6 +1,7 @@
Router.configure({
layout: 'layout',
loadingTemplate: 'loading'
loadingTemplate: 'loading',
notFoundTemplate: 'not_found'
});
Router.map(function() {
@ -12,6 +13,16 @@ Router.map(function() {
this.route('posts_new', {path: '/new'});
this.route('posts_best', {path: '/best'});
this.route('posts_pending', {path: '/pending'});
this.route('post_digest', {
path: '/digest/:year/:month/:day',
waitOn: function() {
return Meteor.subscribe('postDigest', new Date(this.params.year, this.params.month-1, this.params.day));
},
data: function() {
return findDigestPosts(moment(new Date(this.params.year, this.params.month-1, this.params.day)));
}
});
this.route('post_page', {
path: '/posts/:_id',

View file

@ -32,16 +32,16 @@ if(Meteor.userId() != null){
// b) we know when an individual page is ready
// Single Post
Meteor.autorun(function() {
Meteor.subscribe('singlePost', Session.get('selectedPostId'), function(){
Session.set('singlePostReady', true);
});
});
// Meteor.autorun(function() {
// Meteor.subscribe('singlePost', Session.get('selectedPostId'), function(){
// Session.set('singlePostReady', true);
// });
// });
// Digest
Meteor.autorun(function() {
digestHandle = Meteor.subscribe('postDigest', Session.get('currentDate'));
});
// Meteor.autorun(function() {
// digestHandle = Meteor.subscribe('postDigest', Session.get('currentDate'));
// });
// Posts Lists
STATUS_PENDING=1;

View file

@ -3,7 +3,8 @@ Template.layout.helpers({
if(Router._current){
var currentPath = Router._current.path;
var currentRoute = _.findWhere(Router.routes, {originalPath: currentPath});
return currentRoute.name;
if(currentRoute)
return currentRoute.name;
}
},
backgroundColor: function(){

View file

@ -38,9 +38,9 @@
<a href="{{categoryLink}}" class="post-category category-{{slug}}">{{name}}</a>
{{/each}}
</h3>
<p class="post-meta"><span class="points">{{votes}} <span class="unit">{{pointsUnitDisplayText}} </span></span>by <a class="post-author" href="/users/{{userId}}">{{authorName}}</a> <span class="post-time">{{ago}}</span><span class="comments">, <a class="go-to-comments" href="{{post_pagePath this}}">{{comments}} {{commentsDisplayText}}</a></span>
<p class="post-meta"><span class="points">{{votes}} <span class="unit">{{pointsUnitDisplayText}} </span></span>by <a class="post-author" href="/users/{{userId}}">{{authorName}}</a> <span class="post-time">{{ago}}</span><span class="comments">, <a class="go-to-comments" href="/posts/{{_id}}">{{comments}} {{commentsDisplayText}}</a></span>
{{#if can_edit}}
| <a href="{{post_editPath this}}" class="edit-link goto-edit">Edit</a>
| <a href="/posts/{{_id}}/edit" class="edit-link goto-edit">Edit</a>
{{/if}}
{{#if currentUser.isAdmin}}
| status: {{status}}</span>, votes: {{votes}}, baseScore: {{baseScore}}, score: {{short_score}}, clicks: {{clicks}}