mirror of
https://github.com/vale981/Vulcan
synced 2025-03-06 01:51:40 -05:00
extracting digest into its own package
This commit is contained in:
parent
c07c18c9e1
commit
75bd8d9920
35 changed files with 549 additions and 240 deletions
|
@ -69,8 +69,8 @@ telescope-newsletter
|
||||||
telescope-daily
|
telescope-daily
|
||||||
telescope-update-prompt
|
telescope-update-prompt
|
||||||
telescope-kadira
|
telescope-kadira
|
||||||
|
|
||||||
telescope-notifications
|
telescope-notifications
|
||||||
|
telescope-digest
|
||||||
|
|
||||||
# Accounts Templates
|
# Accounts Templates
|
||||||
useraccounts:unstyled
|
useraccounts:unstyled
|
||||||
|
|
|
@ -114,6 +114,7 @@ telescope-api@0.0.0
|
||||||
telescope-base@0.0.0
|
telescope-base@0.0.0
|
||||||
telescope-daily@0.0.0
|
telescope-daily@0.0.0
|
||||||
telescope-datetimepicker@1.0.3
|
telescope-datetimepicker@1.0.3
|
||||||
|
telescope-digest@0.1.0
|
||||||
telescope-email@0.2.9
|
telescope-email@0.2.9
|
||||||
telescope-embedly@0.2.9
|
telescope-embedly@0.2.9
|
||||||
telescope-i18n@0.0.0
|
telescope-i18n@0.0.0
|
||||||
|
|
|
@ -1,69 +0,0 @@
|
||||||
Template[getTemplate('posts_digest')].created = function(){
|
|
||||||
$(document).unbind('keyup'); //remove any potential existing bindings to avoid duplicates
|
|
||||||
var currentDate=moment(Session.get('currentDate')).startOf('day');
|
|
||||||
var today=moment(new Date()).startOf('day');
|
|
||||||
$(document).bind('keyup', 'left', function(){
|
|
||||||
Router.go($('.prev-link').attr('href'));
|
|
||||||
});
|
|
||||||
$(document).bind('keyup', 'right', function(){
|
|
||||||
if(isAdmin(Meteor.user()) || today.diff(currentDate, 'days') > 0)
|
|
||||||
Router.go($('.next-link').attr('href'));
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
Template[getTemplate('posts_digest')].helpers({
|
|
||||||
post_item: function () {
|
|
||||||
return getTemplate('post_item');
|
|
||||||
},
|
|
||||||
postsListIncoming: function () {
|
|
||||||
return getTemplate('postsListIncoming');
|
|
||||||
},
|
|
||||||
hasPosts: function(){
|
|
||||||
if(this.posts) // XXX
|
|
||||||
return !!this.posts.count();
|
|
||||||
},
|
|
||||||
currentDate: function(){
|
|
||||||
var currentDate=moment(Session.get('currentDate'));
|
|
||||||
var today=moment(new Date());
|
|
||||||
var diff=today.diff(currentDate, 'days');
|
|
||||||
if(diff === 0)
|
|
||||||
return i18n.t("today");
|
|
||||||
if(diff === 1)
|
|
||||||
return i18n.t("yesterday");
|
|
||||||
return currentDate.format("dddd, MMMM Do YYYY");
|
|
||||||
},
|
|
||||||
previousDateURL: function(){
|
|
||||||
var currentDate=moment(Session.get('currentDate'));
|
|
||||||
var newDate=currentDate.subtract(1, 'days');
|
|
||||||
return getDigestURL(newDate);
|
|
||||||
},
|
|
||||||
showPreviousDate: function(){
|
|
||||||
// TODO
|
|
||||||
return true;
|
|
||||||
},
|
|
||||||
nextDateURL: function(){
|
|
||||||
var currentDate=moment(Session.get('currentDate'));
|
|
||||||
var newDate=currentDate.add('days', 1);
|
|
||||||
return getDigestURL(newDate);
|
|
||||||
},
|
|
||||||
showNextDate: function(){
|
|
||||||
var currentDate=moment(Session.get('currentDate')).startOf('day');
|
|
||||||
var today=moment(new Date()).startOf('day');
|
|
||||||
return isAdmin(Meteor.user()) || (today.diff(currentDate, 'days') > 0)
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
Template[getTemplate('posts_digest')].rendered = function(){
|
|
||||||
var distanceFromTop = 0;
|
|
||||||
$('.post').each(function(){
|
|
||||||
distanceFromTop += $(this).height();
|
|
||||||
});
|
|
||||||
distanceFromTop+=55;
|
|
||||||
Session.set('distanceFromTop', distanceFromTop);
|
|
||||||
$('body').css('min-height',distanceFromTop+160);
|
|
||||||
$('.more-button').css('top', distanceFromTop+"px");
|
|
||||||
}
|
|
||||||
|
|
||||||
Template[getTemplate('posts_digest')].created = function() {
|
|
||||||
Session.set('listPopulatedAt', new Date());
|
|
||||||
};
|
|
|
@ -47,15 +47,6 @@
|
||||||
// Post deleted
|
// Post deleted
|
||||||
"your_post_has_been_deleted": "Dein Link wurde gelöscht.",
|
"your_post_has_been_deleted": "Dein Link wurde gelöscht.",
|
||||||
|
|
||||||
// Post digest
|
|
||||||
"the_top_5_posts_of_each_day": "Die Top-5-Links eines jeden Tages.",
|
|
||||||
"previous_day": "Einen Tag zurück",
|
|
||||||
"next_day": "Einen Tag vor",
|
|
||||||
"sorry_no_posts_for_today": "Heute gibt es keine Links.",
|
|
||||||
"sorry_no_posts_for": "Keine Links für",
|
|
||||||
"today": "Heute",
|
|
||||||
"yesterday": "Gestern",
|
|
||||||
|
|
||||||
// Post submit & edit
|
// Post submit & edit
|
||||||
"created": "Erstellt",
|
"created": "Erstellt",
|
||||||
"title": "Titel",
|
"title": "Titel",
|
||||||
|
|
|
@ -120,15 +120,6 @@
|
||||||
// Post deleted
|
// Post deleted
|
||||||
"your_post_has_been_deleted": "Your post has been deleted.",
|
"your_post_has_been_deleted": "Your post has been deleted.",
|
||||||
|
|
||||||
// Post digest
|
|
||||||
"the_top_5_posts_of_each_day": "The top 5 posts of each day.",
|
|
||||||
"previous_day": "Previous Day",
|
|
||||||
"next_day": "Next Day",
|
|
||||||
"sorry_no_posts_for_today": "Sorry, no posts for today",
|
|
||||||
"sorry_no_posts_for": "Sorry, no posts for",
|
|
||||||
"today": "Today",
|
|
||||||
"yesterday": "Yesterday",
|
|
||||||
|
|
||||||
// Post submit & edit
|
// Post submit & edit
|
||||||
"created": "Created",
|
"created": "Created",
|
||||||
"title": "Title",
|
"title": "Title",
|
||||||
|
|
|
@ -48,14 +48,6 @@
|
||||||
// Post deleted
|
// Post deleted
|
||||||
"your_post_has_been_deleted": "Tu post ha sido borrado.",
|
"your_post_has_been_deleted": "Tu post ha sido borrado.",
|
||||||
|
|
||||||
// Post digest
|
|
||||||
"the_top_5_posts_of_each_day": "Los 5 mejores posts de cada día",
|
|
||||||
"previous_day": "Dia anterior",
|
|
||||||
"next_day": "Dia siguiente",
|
|
||||||
"sorry_no_posts_for_today": "Lo sentimos, no hay post para hoy",
|
|
||||||
"today": "Hoy",
|
|
||||||
"yesterday": "Ayer",
|
|
||||||
|
|
||||||
// Post submit & edit
|
// Post submit & edit
|
||||||
"created": "Creado",
|
"created": "Creado",
|
||||||
"title": "Título",
|
"title": "Título",
|
||||||
|
|
|
@ -114,15 +114,6 @@
|
||||||
// Post deleted
|
// Post deleted
|
||||||
"your_post_has_been_deleted": "Votre post a été supprimé.",
|
"your_post_has_been_deleted": "Votre post a été supprimé.",
|
||||||
|
|
||||||
// Post digest
|
|
||||||
"the_top_5_posts_of_each_day": "5 meilleurs post par jours",
|
|
||||||
"previous_day": "Jour précédent",
|
|
||||||
"next_day": "Jour suivant",
|
|
||||||
"sorry_no_posts_for_today": "Désolé, aucun post aujourd'hui",
|
|
||||||
"sorry_no_posts_for": "Désolé, aucun post pour",
|
|
||||||
"today": "Aujourd'hui",
|
|
||||||
"yesterday": "Hier",
|
|
||||||
|
|
||||||
// Post submit & edit
|
// Post submit & edit
|
||||||
"created": "Crée",
|
"created": "Crée",
|
||||||
"title": "Titre",
|
"title": "Titre",
|
||||||
|
|
|
@ -47,15 +47,6 @@
|
||||||
// Post deleted
|
// Post deleted
|
||||||
"your_post_has_been_deleted": "Il tuo post è stato rimosso.",
|
"your_post_has_been_deleted": "Il tuo post è stato rimosso.",
|
||||||
|
|
||||||
// Post digest
|
|
||||||
"the_top_5_posts_of_each_day": "I 5 migliori post di ogni giorno.",
|
|
||||||
"previous_day": "Giorno Precedente",
|
|
||||||
"next_day": "Giorno Successivo",
|
|
||||||
"sorry_no_posts_for_today": "Ci spiace, non ci sono post per oggi",
|
|
||||||
"sorry_no_posts_for": "Ci spiace, non ci sono post per",
|
|
||||||
"today": "Oggi",
|
|
||||||
"yesterday": "Ieri",
|
|
||||||
|
|
||||||
// Post submit & edit
|
// Post submit & edit
|
||||||
"created": "Creato",
|
"created": "Creato",
|
||||||
"title": "Titolo",
|
"title": "Titolo",
|
||||||
|
|
|
@ -49,15 +49,6 @@
|
||||||
// Post deleted
|
// Post deleted
|
||||||
"your_post_has_been_deleted": "Your post has been deleted.",
|
"your_post_has_been_deleted": "Your post has been deleted.",
|
||||||
|
|
||||||
// Post digest
|
|
||||||
"the_top_5_posts_of_each_day": "The top 5 posts of each day.",
|
|
||||||
"previous_day": "Previous Day",
|
|
||||||
"next_day": "Next Day",
|
|
||||||
"sorry_no_posts_for_today": "Sorry, no posts for today",
|
|
||||||
"sorry_no_posts_for": "Sorry, no posts for",
|
|
||||||
"today": "Today",
|
|
||||||
"yesterday": "Yesterday",
|
|
||||||
|
|
||||||
// Post submit & edit
|
// Post submit & edit
|
||||||
"created": "Создан",
|
"created": "Создан",
|
||||||
"title": "Заголовок",
|
"title": "Заголовок",
|
||||||
|
|
|
@ -47,15 +47,6 @@
|
||||||
// Post deleted
|
// Post deleted
|
||||||
"your_post_has_been_deleted": "Paylaşımınız silindi",
|
"your_post_has_been_deleted": "Paylaşımınız silindi",
|
||||||
|
|
||||||
// Post digest
|
|
||||||
"the_top_5_posts_of_each_day": "Her günün en üst 5 paylaşımı",
|
|
||||||
"previous_day": "Önceki gün",
|
|
||||||
"next_day": "Sonraki gün",
|
|
||||||
"Sorry, no posts for today": "Özür dileriz, bugün bir paylaşım yok",
|
|
||||||
"sorry_no_posts_for_today": "Özür dileriz, paylaşım yok",
|
|
||||||
"today": "Bugün",
|
|
||||||
"yesterday": "Dün",
|
|
||||||
|
|
||||||
// Post submit & edit
|
// Post submit & edit
|
||||||
"created": "Oluşturuldu",
|
"created": "Oluşturuldu",
|
||||||
"title": "Başlık",
|
"title": "Başlık",
|
||||||
|
|
|
@ -48,14 +48,6 @@
|
||||||
// Post deleted
|
// Post deleted
|
||||||
"your_post_has_been_deleted": "你的帖子已经被删除",
|
"your_post_has_been_deleted": "你的帖子已经被删除",
|
||||||
|
|
||||||
// Post digest
|
|
||||||
"the_top_5_posts_of_each_day": "每天前5名的帖子",
|
|
||||||
"previous_day": "前一天",
|
|
||||||
"next_day": "后一天",
|
|
||||||
"sorry_no_posts_for_today": "抱歉今天没有新的帖子",
|
|
||||||
"today": "今天",
|
|
||||||
"yesterday": "昨天",
|
|
||||||
|
|
||||||
// Post submit & edit
|
// Post submit & edit
|
||||||
"created": "创建",
|
"created": "创建",
|
||||||
"title": "标题",
|
"title": "标题",
|
||||||
|
|
|
@ -23,13 +23,6 @@ getAuthorName = function(item){
|
||||||
scrollPageTo = function(selector){
|
scrollPageTo = function(selector){
|
||||||
$('body').scrollTop($(selector).offset().top);
|
$('body').scrollTop($(selector).offset().top);
|
||||||
};
|
};
|
||||||
getDigestURL = function(moment){
|
|
||||||
return Router.routes['posts_digest'].path({
|
|
||||||
year: moment.year(),
|
|
||||||
month: moment.month() + 1,
|
|
||||||
day: moment.date()
|
|
||||||
});
|
|
||||||
};
|
|
||||||
getDateRange= function(pageNumber){
|
getDateRange= function(pageNumber){
|
||||||
var now = moment(new Date());
|
var now = moment(new Date());
|
||||||
var dayToDisplay=now.subtract(pageNumber-1, 'days');
|
var dayToDisplay=now.subtract(pageNumber-1, 'days');
|
||||||
|
|
|
@ -76,48 +76,6 @@ PostsPendingController = PostsListController.extend({
|
||||||
view: 'pending'
|
view: 'pending'
|
||||||
});
|
});
|
||||||
|
|
||||||
// Controller for post digest
|
|
||||||
|
|
||||||
PostsDigestController = RouteController.extend({
|
|
||||||
template: getTemplate('posts_digest'),
|
|
||||||
waitOn: function() {
|
|
||||||
// if day is set, use that. If not default to today
|
|
||||||
var currentDate = this.params.day ? new Date(this.params.year, this.params.month-1, this.params.day) : new Date(),
|
|
||||||
terms = {
|
|
||||||
view: 'digest',
|
|
||||||
after: moment(currentDate).startOf('day').toDate(),
|
|
||||||
before: moment(currentDate).endOf('day').toDate()
|
|
||||||
};
|
|
||||||
return [
|
|
||||||
coreSubscriptions.subscribe('postsList', terms),
|
|
||||||
coreSubscriptions.subscribe('postsListUsers', terms)
|
|
||||||
];
|
|
||||||
},
|
|
||||||
data: function() {
|
|
||||||
var currentDate = this.params.day ? new Date(this.params.year, this.params.month-1, this.params.day) : Session.get('today'),
|
|
||||||
terms = {
|
|
||||||
view: 'digest',
|
|
||||||
after: moment(currentDate).startOf('day').toDate(),
|
|
||||||
before: moment(currentDate).endOf('day').toDate()
|
|
||||||
},
|
|
||||||
parameters = getPostsParameters(terms);
|
|
||||||
Session.set('currentDate', currentDate);
|
|
||||||
|
|
||||||
parameters.find.createdAt = { $lte: Session.get('listPopulatedAt') };
|
|
||||||
var posts = Posts.find(parameters.find, parameters.options);
|
|
||||||
|
|
||||||
// Incoming posts
|
|
||||||
parameters.find.createdAt = { $gt: Session.get('listPopulatedAt') };
|
|
||||||
var postsIncoming = Posts.find(parameters.find, parameters.options);
|
|
||||||
|
|
||||||
return {
|
|
||||||
incoming: postsIncoming,
|
|
||||||
posts: posts
|
|
||||||
};
|
|
||||||
},
|
|
||||||
fastRender: true
|
|
||||||
});
|
|
||||||
|
|
||||||
// Controller for post pages
|
// Controller for post pages
|
||||||
|
|
||||||
PostPageController = RouteController.extend({
|
PostPageController = RouteController.extend({
|
||||||
|
@ -190,20 +148,6 @@ Meteor.startup(function () {
|
||||||
controller: PostsPendingController
|
controller: PostsPendingController
|
||||||
});
|
});
|
||||||
|
|
||||||
// TODO: enable /category/new, /category/best, etc. views
|
|
||||||
|
|
||||||
// Digest
|
|
||||||
|
|
||||||
Router.route('/digest/:year/:month/:day', {
|
|
||||||
name: 'posts_digest',
|
|
||||||
controller: PostsDigestController
|
|
||||||
});
|
|
||||||
|
|
||||||
Router.route('/digest', {
|
|
||||||
name: 'posts_digest_default',
|
|
||||||
controller: PostsDigestController
|
|
||||||
});
|
|
||||||
|
|
||||||
// Post Page
|
// Post Page
|
||||||
|
|
||||||
Router.route('/posts/:_id', {
|
Router.route('/posts/:_id', {
|
||||||
|
|
|
@ -55,11 +55,7 @@ viewNav = [
|
||||||
{
|
{
|
||||||
route: 'posts_best',
|
route: 'posts_best',
|
||||||
label: 'best'
|
label: 'best'
|
||||||
},
|
}
|
||||||
{
|
|
||||||
route: 'posts_digest_default',
|
|
||||||
label: 'digest'
|
|
||||||
}
|
|
||||||
];
|
];
|
||||||
|
|
||||||
// ------------------------------------- Views -------------------------------- //
|
// ------------------------------------- Views -------------------------------- //
|
||||||
|
@ -99,21 +95,6 @@ viewParameters.pending = function (terms) {
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
viewParameters.digest = function (terms) {
|
|
||||||
return {
|
|
||||||
find: {
|
|
||||||
postedAt: {
|
|
||||||
$gte: terms.after,
|
|
||||||
$lt: terms.before
|
|
||||||
}
|
|
||||||
},
|
|
||||||
options: {
|
|
||||||
sort: {sticky: -1, baseScore: -1, limit: 0}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
heroModules = [];
|
heroModules = [];
|
||||||
|
|
||||||
footerModules = [];
|
footerModules = [];
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
{
|
{
|
||||||
"translation_function_name": "__",
|
"translation_function_name": "__",
|
||||||
"helper_name": "_"
|
"helper_name": "_",
|
||||||
|
"namespace": "project"
|
||||||
}
|
}
|
|
@ -15,22 +15,19 @@ Package.onUse(function (api) {
|
||||||
// automatic (let the package specify where it's needed)
|
// automatic (let the package specify where it's needed)
|
||||||
|
|
||||||
api.use([
|
api.use([
|
||||||
'telescope-base',
|
'tap:i18n', // internationalization package
|
||||||
'telescope-lib',
|
'iron:router', // routing package
|
||||||
'telescope-i18n',
|
'telescope-base', // basic Telescope hooks and objects
|
||||||
'tap:i18n'
|
'telescope-lib', // useful functions
|
||||||
|
'telescope-i18n' // internationalization wrapper
|
||||||
]);
|
]);
|
||||||
|
|
||||||
// both
|
|
||||||
|
|
||||||
api.use([
|
|
||||||
//
|
|
||||||
], ['client','server']);
|
|
||||||
|
|
||||||
// client
|
// client
|
||||||
|
|
||||||
api.use([
|
api.use([
|
||||||
//
|
'jquery', // useful for DOM interactions
|
||||||
|
'underscore', // JavaScript swiss army knife library
|
||||||
|
'templating' // required for client-side templates
|
||||||
], ['client']);
|
], ['client']);
|
||||||
|
|
||||||
// server
|
// server
|
||||||
|
|
|
@ -7,8 +7,6 @@ var coreSubscriptions = new SubsManager({
|
||||||
expireIn: 30
|
expireIn: 30
|
||||||
});
|
});
|
||||||
|
|
||||||
// note: FastRender not defined here?
|
|
||||||
|
|
||||||
PostsDailyController = RouteController.extend({
|
PostsDailyController = RouteController.extend({
|
||||||
template: function() {
|
template: function() {
|
||||||
return getTemplate('postsDaily');
|
return getTemplate('postsDaily');
|
||||||
|
|
|
@ -8,7 +8,8 @@ Package.onUse(function (api) {
|
||||||
'iron:router',
|
'iron:router',
|
||||||
'meteorhacks:fast-render',
|
'meteorhacks:fast-render',
|
||||||
'meteorhacks:subs-manager',
|
'meteorhacks:subs-manager',
|
||||||
'tap:i18n'
|
'tap:i18n',
|
||||||
|
'telescope-digest'
|
||||||
], ['client', 'server']);
|
], ['client', 'server']);
|
||||||
|
|
||||||
api.use([
|
api.use([
|
||||||
|
@ -29,8 +30,6 @@ Package.onUse(function (api) {
|
||||||
'lib/client/stylesheets/daily.css',
|
'lib/client/stylesheets/daily.css',
|
||||||
], ['client']);
|
], ['client']);
|
||||||
|
|
||||||
api.add_files(['lib/server/publications.js'], ['server']);
|
|
||||||
|
|
||||||
api.add_files([
|
api.add_files([
|
||||||
"i18n/de.i18n.json",
|
"i18n/de.i18n.json",
|
||||||
"i18n/en.i18n.json",
|
"i18n/en.i18n.json",
|
||||||
|
|
|
@ -212,6 +212,10 @@
|
||||||
"telescope-base",
|
"telescope-base",
|
||||||
"0.0.0"
|
"0.0.0"
|
||||||
],
|
],
|
||||||
|
[
|
||||||
|
"telescope-digest",
|
||||||
|
"0.1.0"
|
||||||
|
],
|
||||||
[
|
[
|
||||||
"telescope-i18n",
|
"telescope-i18n",
|
||||||
"0.0.0"
|
"0.0.0"
|
||||||
|
|
1
packages/telescope-digest/.gitignore
vendored
Normal file
1
packages/telescope-digest/.gitignore
vendored
Normal file
|
@ -0,0 +1 @@
|
||||||
|
.build*
|
9
packages/telescope-digest/i18n/de.i18n.json
Normal file
9
packages/telescope-digest/i18n/de.i18n.json
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
{
|
||||||
|
"the_top_5_posts_of_each_day": "Die Top-5-Links eines jeden Tages.",
|
||||||
|
"previous_day": "Einen Tag zurück",
|
||||||
|
"next_day": "Einen Tag vor",
|
||||||
|
"sorry_no_posts_for_today": "Heute gibt es keine Links.",
|
||||||
|
"sorry_no_posts_for": "Keine Links für",
|
||||||
|
"today": "Heute",
|
||||||
|
"yesterday": "Gestern"
|
||||||
|
}
|
9
packages/telescope-digest/i18n/en.i18n.json
Normal file
9
packages/telescope-digest/i18n/en.i18n.json
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
{
|
||||||
|
"the_top_5_posts_of_each_day": "The top 5 posts of each day.",
|
||||||
|
"previous_day": "Previous Day",
|
||||||
|
"next_day": "Next Day",
|
||||||
|
"sorry_no_posts_for_today": "Sorry, no posts for today",
|
||||||
|
"sorry_no_posts_for": "Sorry, no posts for",
|
||||||
|
"today": "Today",
|
||||||
|
"yesterday": "Yesterday"
|
||||||
|
}
|
8
packages/telescope-digest/i18n/es.i18n.json
Normal file
8
packages/telescope-digest/i18n/es.i18n.json
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
{
|
||||||
|
"the_top_5_posts_of_each_day": "Los 5 mejores posts de cada día",
|
||||||
|
"previous_day": "Dia anterior",
|
||||||
|
"next_day": "Dia siguiente",
|
||||||
|
"sorry_no_posts_for_today": "Lo sentimos, no hay post para hoy",
|
||||||
|
"today": "Hoy",
|
||||||
|
"yesterday": "Ayer"
|
||||||
|
}
|
9
packages/telescope-digest/i18n/fr.i18n.json
Normal file
9
packages/telescope-digest/i18n/fr.i18n.json
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
{
|
||||||
|
"the_top_5_posts_of_each_day": "5 meilleurs post par jours",
|
||||||
|
"previous_day": "Jour précédent",
|
||||||
|
"next_day": "Jour suivant",
|
||||||
|
"sorry_no_posts_for_today": "Désolé, aucun post aujourd'hui",
|
||||||
|
"sorry_no_posts_for": "Désolé, aucun post pour",
|
||||||
|
"today": "Aujourd'hui",
|
||||||
|
"yesterday": "Hier"
|
||||||
|
}
|
9
packages/telescope-digest/i18n/it.i18n.json
Normal file
9
packages/telescope-digest/i18n/it.i18n.json
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
{
|
||||||
|
"the_top_5_posts_of_each_day": "I 5 migliori post di ogni giorno.",
|
||||||
|
"previous_day": "Giorno Precedente",
|
||||||
|
"next_day": "Giorno Successivo",
|
||||||
|
"sorry_no_posts_for_today": "Ci spiace, non ci sono post per oggi",
|
||||||
|
"sorry_no_posts_for": "Ci spiace, non ci sono post per",
|
||||||
|
"today": "Oggi",
|
||||||
|
"yesterday": "Ieri"
|
||||||
|
}
|
9
packages/telescope-digest/i18n/tr.i18n.json
Normal file
9
packages/telescope-digest/i18n/tr.i18n.json
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
{
|
||||||
|
"the_top_5_posts_of_each_day": "Her günün en üst 5 paylaşımı",
|
||||||
|
"previous_day": "Önceki gün",
|
||||||
|
"next_day": "Sonraki gün",
|
||||||
|
"Sorry, no posts for today": "Özür dileriz, bugün bir paylaşım yok",
|
||||||
|
"sorry_no_posts_for_today": "Özür dileriz, paylaşım yok",
|
||||||
|
"today": "Bugün",
|
||||||
|
"yesterday": "Dün"
|
||||||
|
}
|
8
packages/telescope-digest/i18n/zh-CN.i18n.json
Normal file
8
packages/telescope-digest/i18n/zh-CN.i18n.json
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
{
|
||||||
|
"the_top_5_posts_of_each_day": "每天前5名的帖子",
|
||||||
|
"previous_day": "前一天",
|
||||||
|
"next_day": "后一天",
|
||||||
|
"sorry_no_posts_for_today": "抱歉今天没有新的帖子",
|
||||||
|
"today": "今天",
|
||||||
|
"yesterday": "昨天"
|
||||||
|
}
|
|
@ -0,0 +1,73 @@
|
||||||
|
Meteor.startup(function () {
|
||||||
|
|
||||||
|
Template[getTemplate('posts_digest')].created = function(){
|
||||||
|
$(document).unbind('keyup'); //remove any potential existing bindings to avoid duplicates
|
||||||
|
var currentDate=moment(Session.get('currentDate')).startOf('day');
|
||||||
|
var today=moment(new Date()).startOf('day');
|
||||||
|
$(document).bind('keyup', 'left', function(){
|
||||||
|
Router.go($('.prev-link').attr('href'));
|
||||||
|
});
|
||||||
|
$(document).bind('keyup', 'right', function(){
|
||||||
|
if(isAdmin(Meteor.user()) || today.diff(currentDate, 'days') > 0)
|
||||||
|
Router.go($('.next-link').attr('href'));
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
Template[getTemplate('posts_digest')].helpers({
|
||||||
|
post_item: function () {
|
||||||
|
return getTemplate('post_item');
|
||||||
|
},
|
||||||
|
postsListIncoming: function () {
|
||||||
|
return getTemplate('postsListIncoming');
|
||||||
|
},
|
||||||
|
hasPosts: function(){
|
||||||
|
if(this.posts) // XXX
|
||||||
|
return !!this.posts.count();
|
||||||
|
},
|
||||||
|
currentDate: function(){
|
||||||
|
var currentDate=moment(Session.get('currentDate'));
|
||||||
|
var today=moment(new Date());
|
||||||
|
var diff=today.diff(currentDate, 'days');
|
||||||
|
if(diff === 0)
|
||||||
|
return i18n.t("today");
|
||||||
|
if(diff === 1)
|
||||||
|
return i18n.t("yesterday");
|
||||||
|
return currentDate.format("dddd, MMMM Do YYYY");
|
||||||
|
},
|
||||||
|
previousDateURL: function(){
|
||||||
|
var currentDate=moment(Session.get('currentDate'));
|
||||||
|
var newDate=currentDate.subtract(1, 'days');
|
||||||
|
return getDigestURL(newDate);
|
||||||
|
},
|
||||||
|
showPreviousDate: function(){
|
||||||
|
// TODO
|
||||||
|
return true;
|
||||||
|
},
|
||||||
|
nextDateURL: function(){
|
||||||
|
var currentDate=moment(Session.get('currentDate'));
|
||||||
|
var newDate=currentDate.add('days', 1);
|
||||||
|
return getDigestURL(newDate);
|
||||||
|
},
|
||||||
|
showNextDate: function(){
|
||||||
|
var currentDate=moment(Session.get('currentDate')).startOf('day');
|
||||||
|
var today=moment(new Date()).startOf('day');
|
||||||
|
return isAdmin(Meteor.user()) || (today.diff(currentDate, 'days') > 0)
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
Template[getTemplate('posts_digest')].rendered = function(){
|
||||||
|
var distanceFromTop = 0;
|
||||||
|
$('.post').each(function(){
|
||||||
|
distanceFromTop += $(this).height();
|
||||||
|
});
|
||||||
|
distanceFromTop+=55;
|
||||||
|
Session.set('distanceFromTop', distanceFromTop);
|
||||||
|
$('body').css('min-height',distanceFromTop+160);
|
||||||
|
$('.more-button').css('top', distanceFromTop+"px");
|
||||||
|
}
|
||||||
|
|
||||||
|
Template[getTemplate('posts_digest')].created = function() {
|
||||||
|
Session.set('listPopulatedAt', new Date());
|
||||||
|
};
|
||||||
|
|
||||||
|
});
|
26
packages/telescope-digest/lib/digest.js
Normal file
26
packages/telescope-digest/lib/digest.js
Normal file
|
@ -0,0 +1,26 @@
|
||||||
|
viewNav.push({
|
||||||
|
route: 'posts_digest_default',
|
||||||
|
label: 'digest'
|
||||||
|
});
|
||||||
|
|
||||||
|
viewParameters.digest = function (terms) {
|
||||||
|
return {
|
||||||
|
find: {
|
||||||
|
postedAt: {
|
||||||
|
$gte: terms.after,
|
||||||
|
$lt: terms.before
|
||||||
|
}
|
||||||
|
},
|
||||||
|
options: {
|
||||||
|
sort: {sticky: -1, baseScore: -1, limit: 0}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
getDigestURL = function(moment){
|
||||||
|
return Router.routes['posts_digest'].path({
|
||||||
|
year: moment.year(),
|
||||||
|
month: moment.month() + 1,
|
||||||
|
day: moment.date()
|
||||||
|
});
|
||||||
|
};
|
57
packages/telescope-digest/lib/routes.js
Normal file
57
packages/telescope-digest/lib/routes.js
Normal file
|
@ -0,0 +1,57 @@
|
||||||
|
// Controller for post digest
|
||||||
|
|
||||||
|
PostsDigestController = RouteController.extend({
|
||||||
|
template: getTemplate('posts_digest'),
|
||||||
|
waitOn: function() {
|
||||||
|
// if day is set, use that. If not default to today
|
||||||
|
var currentDate = this.params.day ? new Date(this.params.year, this.params.month-1, this.params.day) : new Date(),
|
||||||
|
terms = {
|
||||||
|
view: 'digest',
|
||||||
|
after: moment(currentDate).startOf('day').toDate(),
|
||||||
|
before: moment(currentDate).endOf('day').toDate()
|
||||||
|
};
|
||||||
|
return [
|
||||||
|
coreSubscriptions.subscribe('postsList', terms),
|
||||||
|
coreSubscriptions.subscribe('postsListUsers', terms)
|
||||||
|
];
|
||||||
|
},
|
||||||
|
data: function() {
|
||||||
|
var currentDate = this.params.day ? new Date(this.params.year, this.params.month-1, this.params.day) : Session.get('today'),
|
||||||
|
terms = {
|
||||||
|
view: 'digest',
|
||||||
|
after: moment(currentDate).startOf('day').toDate(),
|
||||||
|
before: moment(currentDate).endOf('day').toDate()
|
||||||
|
},
|
||||||
|
parameters = getPostsParameters(terms);
|
||||||
|
Session.set('currentDate', currentDate);
|
||||||
|
|
||||||
|
parameters.find.createdAt = { $lte: Session.get('listPopulatedAt') };
|
||||||
|
var posts = Posts.find(parameters.find, parameters.options);
|
||||||
|
|
||||||
|
// Incoming posts
|
||||||
|
parameters.find.createdAt = { $gt: Session.get('listPopulatedAt') };
|
||||||
|
var postsIncoming = Posts.find(parameters.find, parameters.options);
|
||||||
|
|
||||||
|
return {
|
||||||
|
incoming: postsIncoming,
|
||||||
|
posts: posts
|
||||||
|
};
|
||||||
|
},
|
||||||
|
fastRender: true
|
||||||
|
});
|
||||||
|
|
||||||
|
Meteor.startup(function () {
|
||||||
|
|
||||||
|
// Digest
|
||||||
|
|
||||||
|
Router.route('/digest/:year/:month/:day', {
|
||||||
|
name: 'posts_digest',
|
||||||
|
controller: PostsDigestController
|
||||||
|
});
|
||||||
|
|
||||||
|
Router.route('/digest', {
|
||||||
|
name: 'posts_digest_default',
|
||||||
|
controller: PostsDigestController
|
||||||
|
});
|
||||||
|
|
||||||
|
});
|
5
packages/telescope-digest/package-tap.i18n
Normal file
5
packages/telescope-digest/package-tap.i18n
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
{
|
||||||
|
"translation_function_name": "__",
|
||||||
|
"helper_name": "_",
|
||||||
|
"namespace": "project"
|
||||||
|
}
|
84
packages/telescope-digest/package.js
Normal file
84
packages/telescope-digest/package.js
Normal file
|
@ -0,0 +1,84 @@
|
||||||
|
Package.describe({
|
||||||
|
summary: 'Telescope digest package',
|
||||||
|
version: '0.1.0',
|
||||||
|
name: 'telescope-digest'
|
||||||
|
});
|
||||||
|
|
||||||
|
Npm.depends({
|
||||||
|
// NPM package dependencies
|
||||||
|
});
|
||||||
|
|
||||||
|
Package.onUse(function (api) {
|
||||||
|
|
||||||
|
// --------------------------- 1. Meteor packages dependencies ---------------------------
|
||||||
|
|
||||||
|
// automatic (let the package specify where it's needed)
|
||||||
|
|
||||||
|
api.use([
|
||||||
|
'telescope-base',
|
||||||
|
'telescope-lib',
|
||||||
|
'telescope-i18n',
|
||||||
|
'tap:i18n',
|
||||||
|
'iron:router'
|
||||||
|
]);
|
||||||
|
|
||||||
|
// client
|
||||||
|
|
||||||
|
api.use([
|
||||||
|
'jquery',
|
||||||
|
'underscore',
|
||||||
|
'templating'
|
||||||
|
], ['client']);
|
||||||
|
|
||||||
|
// server
|
||||||
|
|
||||||
|
api.use([
|
||||||
|
//
|
||||||
|
], ['server']);
|
||||||
|
|
||||||
|
// ---------------------------------- 2. Files to include ----------------------------------
|
||||||
|
|
||||||
|
// i18n config (must come first)
|
||||||
|
|
||||||
|
api.add_files([
|
||||||
|
'package-tap.i18n'
|
||||||
|
], ['client', 'server']);
|
||||||
|
|
||||||
|
// both
|
||||||
|
|
||||||
|
api.add_files([
|
||||||
|
'lib/routes.js',
|
||||||
|
'lib/digest.js'
|
||||||
|
], ['client', 'server']);
|
||||||
|
|
||||||
|
// client
|
||||||
|
|
||||||
|
api.add_files([
|
||||||
|
'lib/client/templates/posts_digest.html',
|
||||||
|
'lib/client/templates/posts_digest.js'
|
||||||
|
], ['client']);
|
||||||
|
|
||||||
|
// server
|
||||||
|
|
||||||
|
api.add_files([
|
||||||
|
], ['server']);
|
||||||
|
|
||||||
|
// i18n languages (must come last)
|
||||||
|
|
||||||
|
api.add_files([
|
||||||
|
'i18n/de.i18n.json',
|
||||||
|
'i18n/en.i18n.json',
|
||||||
|
'i18n/es.i18n.json',
|
||||||
|
'i18n/fr.i18n.json',
|
||||||
|
'i18n/it.i18n.json',
|
||||||
|
'i18n/tr.i18n.json',
|
||||||
|
'i18n/zh-CN.i18n.json'
|
||||||
|
], ['client', 'server']);
|
||||||
|
|
||||||
|
// -------------------------------- 3. Variables to export --------------------------------
|
||||||
|
|
||||||
|
api.export([
|
||||||
|
'getDigestURL'
|
||||||
|
]);
|
||||||
|
|
||||||
|
});
|
223
packages/telescope-digest/versions.json
Normal file
223
packages/telescope-digest/versions.json
Normal file
|
@ -0,0 +1,223 @@
|
||||||
|
{
|
||||||
|
"dependencies": [
|
||||||
|
[
|
||||||
|
"aldeed:simple-schema",
|
||||||
|
"1.1.0"
|
||||||
|
],
|
||||||
|
[
|
||||||
|
"application-configuration",
|
||||||
|
"1.0.3"
|
||||||
|
],
|
||||||
|
[
|
||||||
|
"base64",
|
||||||
|
"1.0.1"
|
||||||
|
],
|
||||||
|
[
|
||||||
|
"binary-heap",
|
||||||
|
"1.0.1"
|
||||||
|
],
|
||||||
|
[
|
||||||
|
"blaze",
|
||||||
|
"2.0.3"
|
||||||
|
],
|
||||||
|
[
|
||||||
|
"blaze-tools",
|
||||||
|
"1.0.1"
|
||||||
|
],
|
||||||
|
[
|
||||||
|
"boilerplate-generator",
|
||||||
|
"1.0.1"
|
||||||
|
],
|
||||||
|
[
|
||||||
|
"callback-hook",
|
||||||
|
"1.0.1"
|
||||||
|
],
|
||||||
|
[
|
||||||
|
"check",
|
||||||
|
"1.0.2"
|
||||||
|
],
|
||||||
|
[
|
||||||
|
"coffeescript",
|
||||||
|
"1.0.4"
|
||||||
|
],
|
||||||
|
[
|
||||||
|
"ddp",
|
||||||
|
"1.0.11"
|
||||||
|
],
|
||||||
|
[
|
||||||
|
"deps",
|
||||||
|
"1.0.5"
|
||||||
|
],
|
||||||
|
[
|
||||||
|
"ejson",
|
||||||
|
"1.0.4"
|
||||||
|
],
|
||||||
|
[
|
||||||
|
"follower-livedata",
|
||||||
|
"1.0.2"
|
||||||
|
],
|
||||||
|
[
|
||||||
|
"geojson-utils",
|
||||||
|
"1.0.1"
|
||||||
|
],
|
||||||
|
[
|
||||||
|
"html-tools",
|
||||||
|
"1.0.2"
|
||||||
|
],
|
||||||
|
[
|
||||||
|
"htmljs",
|
||||||
|
"1.0.2"
|
||||||
|
],
|
||||||
|
[
|
||||||
|
"id-map",
|
||||||
|
"1.0.1"
|
||||||
|
],
|
||||||
|
[
|
||||||
|
"iron:controller",
|
||||||
|
"1.0.0"
|
||||||
|
],
|
||||||
|
[
|
||||||
|
"iron:core",
|
||||||
|
"1.0.3"
|
||||||
|
],
|
||||||
|
[
|
||||||
|
"iron:dynamic-template",
|
||||||
|
"1.0.3"
|
||||||
|
],
|
||||||
|
[
|
||||||
|
"iron:layout",
|
||||||
|
"1.0.3"
|
||||||
|
],
|
||||||
|
[
|
||||||
|
"iron:location",
|
||||||
|
"1.0.3"
|
||||||
|
],
|
||||||
|
[
|
||||||
|
"iron:middleware-stack",
|
||||||
|
"1.0.0"
|
||||||
|
],
|
||||||
|
[
|
||||||
|
"iron:router",
|
||||||
|
"1.0.1"
|
||||||
|
],
|
||||||
|
[
|
||||||
|
"iron:url",
|
||||||
|
"1.0.3"
|
||||||
|
],
|
||||||
|
[
|
||||||
|
"jquery",
|
||||||
|
"1.0.1"
|
||||||
|
],
|
||||||
|
[
|
||||||
|
"json",
|
||||||
|
"1.0.1"
|
||||||
|
],
|
||||||
|
[
|
||||||
|
"logging",
|
||||||
|
"1.0.5"
|
||||||
|
],
|
||||||
|
[
|
||||||
|
"meteor",
|
||||||
|
"1.1.3"
|
||||||
|
],
|
||||||
|
[
|
||||||
|
"minifiers",
|
||||||
|
"1.1.2"
|
||||||
|
],
|
||||||
|
[
|
||||||
|
"minimongo",
|
||||||
|
"1.0.5"
|
||||||
|
],
|
||||||
|
[
|
||||||
|
"mongo",
|
||||||
|
"1.0.8"
|
||||||
|
],
|
||||||
|
[
|
||||||
|
"observe-sequence",
|
||||||
|
"1.0.3"
|
||||||
|
],
|
||||||
|
[
|
||||||
|
"ordered-dict",
|
||||||
|
"1.0.1"
|
||||||
|
],
|
||||||
|
[
|
||||||
|
"random",
|
||||||
|
"1.0.1"
|
||||||
|
],
|
||||||
|
[
|
||||||
|
"reactive-dict",
|
||||||
|
"1.0.4"
|
||||||
|
],
|
||||||
|
[
|
||||||
|
"reactive-var",
|
||||||
|
"1.0.3"
|
||||||
|
],
|
||||||
|
[
|
||||||
|
"retry",
|
||||||
|
"1.0.1"
|
||||||
|
],
|
||||||
|
[
|
||||||
|
"routepolicy",
|
||||||
|
"1.0.2"
|
||||||
|
],
|
||||||
|
[
|
||||||
|
"session",
|
||||||
|
"1.0.4"
|
||||||
|
],
|
||||||
|
[
|
||||||
|
"spacebars",
|
||||||
|
"1.0.3"
|
||||||
|
],
|
||||||
|
[
|
||||||
|
"spacebars-compiler",
|
||||||
|
"1.0.3"
|
||||||
|
],
|
||||||
|
[
|
||||||
|
"tap:http-methods",
|
||||||
|
"0.0.23"
|
||||||
|
],
|
||||||
|
[
|
||||||
|
"tap:i18n",
|
||||||
|
"1.2.1"
|
||||||
|
],
|
||||||
|
[
|
||||||
|
"telescope-base",
|
||||||
|
"0.0.0"
|
||||||
|
],
|
||||||
|
[
|
||||||
|
"telescope-i18n",
|
||||||
|
"0.0.0"
|
||||||
|
],
|
||||||
|
[
|
||||||
|
"telescope-lib",
|
||||||
|
"0.2.9"
|
||||||
|
],
|
||||||
|
[
|
||||||
|
"templating",
|
||||||
|
"1.0.9"
|
||||||
|
],
|
||||||
|
[
|
||||||
|
"tracker",
|
||||||
|
"1.0.3"
|
||||||
|
],
|
||||||
|
[
|
||||||
|
"ui",
|
||||||
|
"1.0.4"
|
||||||
|
],
|
||||||
|
[
|
||||||
|
"underscore",
|
||||||
|
"1.0.1"
|
||||||
|
],
|
||||||
|
[
|
||||||
|
"webapp",
|
||||||
|
"1.1.4"
|
||||||
|
],
|
||||||
|
[
|
||||||
|
"webapp-hashing",
|
||||||
|
"1.0.1"
|
||||||
|
]
|
||||||
|
],
|
||||||
|
"pluginDependencies": [],
|
||||||
|
"toolVersion": "meteor-tool@1.0.35",
|
||||||
|
"format": "1.0"
|
||||||
|
}
|
Loading…
Add table
Reference in a new issue