Merge branch 'custom-templates' into hubble

Conflicts:
	packages/telescope-theme-hubble/lib/client/config.codekit
This commit is contained in:
Sacha Greif 2014-07-05 11:59:41 +09:00
commit 2f22c001b6
77 changed files with 529 additions and 409 deletions

View file

@ -22,7 +22,6 @@ spin
autoform
collection2
accounts-facebook
iron-router-progress
telescope-tags
telescope-base
telescope-search
@ -33,3 +32,4 @@ jquery-hotkeys
marked
bootstrap3-datepicker
telescope-theme-hubble
telescope-module-share

View file

@ -1,4 +1,4 @@
Template.toolbox.events({
Template[getTemplate('toolbox')].events({
'click .update-categories':function(){
},

View file

@ -1,4 +1,4 @@
Template.comment_edit.rendered = function(){
Template[getTemplate('comment_edit')].rendered = function(){
if(this.data){ // XXX
var comment = this.data.comment;
@ -12,7 +12,7 @@ Template.comment_edit.rendered = function(){
}
}
Template.comment_edit.events({
Template[getTemplate('comment_edit')].events({
'click input[type=submit]': function(e, instance){
var comment = this;
var content = cleanUp(instance.editor.exportFile());

View file

@ -1,10 +1,10 @@
Template.comment_form.helpers({
Template[getTemplate('comment_form')].helpers({
canComment: function(){
return canComment(Meteor.user());
}
})
Template.comment_form.rendered = function(){
Template[getTemplate('comment_form')].rendered = function(){
if(Meteor.user() && !this.editor){
this.editor = new EpicEditor(EpicEditorOptions).load();
$(this.editor.editor).bind('keydown', 'meta+return', function(){
@ -13,7 +13,7 @@ Template.comment_form.rendered = function(){
}
}
Template.comment_form.events({
Template[getTemplate('comment_form')].events({
'submit form': function(e, instance){
e.preventDefault();
$(e.target).addClass('disabled');

View file

@ -36,7 +36,7 @@
<ul class="comment-children comment-list">
{{#each child_comments}}
{{#with this}}
{{> comment_item}}
{{> UI.dynamic template=comment_item}}
{{/with}}
{{/each}}
</ul>

View file

@ -56,43 +56,15 @@ findQueueContainer=function($comment){
return $container;
};
Template.comment_item.created = function() {
Template[getTemplate('comment_item')].created = function() {
// if comments are supposed to be queued, then queue this comment on create
this.isQueued = window.queueComments;
}
Template.comment_item.rendered=function(){
if(this.data){
var comment=this.data;
var $comment=$("#"+comment._id);
if(Meteor.user() && Meteor.user()._id==comment.userId){
// if user is logged in, and the comment belongs to the user, then never queue it
}else if(this.isQueued && !$comment.hasClass("comment-queued") && window.openedComments.indexOf(comment._id)==-1){
// if comment is new and has not already been previously queued
// note: testing on the class works because Meteor apparently preserves newly assigned CSS classes
// across template renderings
// TODO: save scroll position
// get comment author name
var user=Meteor.users.findOne(comment.userId);
var author=getDisplayName(user);
var imgURL=getAvatarUrl(user);
var $container=findQueueContainer($comment);
var comment_link='<li class="icon-user"><a href="#'+comment._id+'" class="has-tooltip" style="background-image:url('+imgURL+')"><span class="tooltip"><span>'+author+'</span></span></a></li>';
$(comment_link).appendTo($container.find("ul"));
// $(comment_link).appendTo($container.find("ul")).hide().fadeIn("slow");
$comment.removeClass("comment-displayed").addClass("comment-queued");
$comment.data("queue", $container);
// TODO: take the user back to their previous scroll position
}
}
}
Template.comment_item.helpers({
Template[getTemplate('comment_item')].helpers({
comment_item: function () {
return getTemplate('comment_item');
},
full_date: function(){
return this.createdAt.toString();
},
@ -137,6 +109,36 @@ Template.comment_item.helpers({
}
});
Template[getTemplate('comment_item')].rendered=function(){
if(this.data){
var comment=this.data;
var $comment=$("#"+comment._id);
if(Meteor.user() && Meteor.user()._id==comment.userId){
// if user is logged in, and the comment belongs to the user, then never queue it
}else if(this.isQueued && !$comment.hasClass("comment-queued") && window.openedComments.indexOf(comment._id)==-1){
// if comment is new and has not already been previously queued
// note: testing on the class works because Meteor apparently preserves newly assigned CSS classes
// across template renderings
// TODO: save scroll position
// get comment author name
var user=Meteor.users.findOne(comment.userId);
var author=getDisplayName(user);
var imgURL=getAvatarUrl(user);
var $container=findQueueContainer($comment);
var comment_link='<li class="icon-user"><a href="#'+comment._id+'" class="has-tooltip" style="background-image:url('+imgURL+')"><span class="tooltip"><span>'+author+'</span></span></a></li>';
$(comment_link).appendTo($container.find("ul"));
// $(comment_link).appendTo($container.find("ul")).hide().fadeIn("slow");
$comment.removeClass("comment-displayed").addClass("comment-queued");
$comment.data("queue", $container);
// TODO: take the user back to their previous scroll position
}
}
}
Template.comment_item.events({
'click .queue-comment': function(e){
e.preventDefault();

View file

@ -2,7 +2,7 @@
{{#if has_comments}}
<ul class="comments comment-list">
{{#each child_comments}}
{{> comment_item}}
{{> UI.dynamic template=comment_item}}
{{/each}}
</ul>
{{else}}

View file

@ -1,8 +1,11 @@
Template.comment_list.created = function(){
Template[getTemplate('comment_list')].created = function(){
postObject = this.data;
}
Template.comment_list.helpers({
Template[getTemplate('comment_list')].helpers({
comment_item: function () {
return getTemplate('comment_item');
},
has_comments: function(){
var post = this;
var comments = Comments.find({postId: post._id, parent: null}, {sort: {score: -1, postedAt: -1}});
@ -15,7 +18,7 @@ Template.comment_list.helpers({
}
});
Template.comment_list.rendered = function(){
Template[getTemplate('comment_list')].rendered = function(){
// once all comments have been rendered, activate comment queuing for future real-time comments
window.queueComments = true;
}

View file

@ -3,12 +3,12 @@
<div class="post grid comment-page">
{{#with post}}
{{>post_item}}
{{> UI.dynamic template=post_item}}
{{/with}}
{{#with comment}}
<ul class="selected-comment">
{{> comment_item}}
{{> UI.dynamic template=comment_item}}
</ul>
{{/with}}

View file

@ -1,4 +1,10 @@
Template.comment_page.helpers({
Template[getTemplate('comment_page')].helpers({
post_item: function () {
return getTemplate('post_item');
},
comment_item: function () {
return getTemplate('comment_item');
},
post: function () {
return Posts.findOne(this.comment.post);
}

View file

@ -3,12 +3,12 @@
<div class="post grid comment-page">
{{#with post}}
{{> post_item}}
{{> UI.dynamic template=post_item}}
{{/with}}
{{#with comment}}
<ul class="selected-comment">
{{> comment_item}}
{{ UI.dynamic template=comment_item}}
</ul>
{{/with}}

View file

@ -1,4 +1,10 @@
Template.comment_reply.helpers({
Template[getTemplate('comment_reply')].helpers({
post_item: function () {
return getTemplate('post_item');
},
comment_item: function () {
return getTemplate('comment_item');
},
post: function () {
if(this.comment) // XXX
return Posts.findOne(this.comment.post);

View file

@ -1,5 +1,5 @@
<template name="error">
{{#each errors}}
{{> error_item}}
{{> UI.dynamic template=error_item}}
{{/each}}
</template>

View file

@ -1,3 +1,8 @@
Template.error.errors= function(){
return Errors.find({show: true});
}
Template[getTemplate('error')].helpers({
error_item: function () {
return getTemplate('error_item');
},
errors: function(){
return Errors.find({show: true});
}
});

View file

@ -1,8 +1,8 @@
Template.error_item.helpers({
Template[getTemplate('error_item')].helpers({
})
Template.error_item.created = function(){
Template[getTemplate('error_item')].created = function(){
var error_id=this.data._id;
Meteor.setTimeout(function(){
Errors.update(error_id, {$set: {seen:true}});

View file

@ -1,4 +1,4 @@
Template.footer.helpers({
Template[getTemplate('footer')].helpers({
footerCode: function(){
return getSetting('footerCode');
},

View file

@ -26,13 +26,13 @@
{{/if}}
</style>
<div class="outer-wrapper {{currentPage}}">
{{> mobile_nav}}
{{> UI.dynamic template=mobile_nav}}
<div class="content-wrapper template-{{pageName}}">
{{> nav}}
{{> error}}
{{> UI.dynamic template=nav}}
{{> UI.dynamic template=error}}
{{> yield}}
{{> notifications}}
{{> footer}}
{{> UI.dynamic template=notifications}}
{{> UI.dynamic template=footer}}
<div class="overlay hidden"></div>
</div>
{{{extraCode}}}

View file

@ -1,4 +1,19 @@
Template.layout.helpers({
Template[getTemplate('layout')].helpers({
mobile_nav: function () {
return getTemplate('mobile_nav');
},
nav: function () {
return getTemplate('nav');
},
error: function () {
return getTemplate('error');
},
notifications: function () {
return getTemplate('notifications');
},
footer: function () {
return getTemplate('footer');
},
pageName : function(){
// getCurrentTemplate();
},
@ -19,11 +34,11 @@ Template.layout.helpers({
}
});
Template.layout.created = function(){
Template[getTemplate('layout')].created = function(){
Session.set('currentScroll', null);
}
Template.layout.rendered = function(){
Template[getTemplate('layout')].rendered = function(){
if(currentScroll=Session.get('currentScroll')){
$('body').scrollTop(currentScroll);
Session.set('currentScroll', null);

View file

@ -1,5 +1,6 @@
<template name="loading">
<div class="grid">
<div class="grid loading">
{{>spinner}}
</div>
{{log}}
</template>

View file

@ -0,0 +1,5 @@
Template[getTemplate('loading')].helpers({
log: function () {
console.log('loading…')
}
})

View file

@ -1,9 +1,9 @@
Template.no_account.helpers({
Template[getTemplate('no_account')].helpers({
landingPageText: function(){
return getSetting("landingPageText");
}
});
Template.no_account.events({
Template[getTemplate('no_account')].events({
'click .twitter-button': function(){
Meteor.loginWithTwitter(function(){
Router.go('/');

View file

@ -1,4 +1,4 @@
Template.no_invite.helpers({
Template[getTemplate('no_invite')].helpers({
afterSignupText: function(){
return getSetting("afterSignupText");
}

View file

@ -5,7 +5,7 @@
<div class="dropdown-menu">
<ul role="menu" aria-labelledby="dLabel">
{{#each menu}}
{{> menuItem this}}
{{> UI.dynamic template=menuItem data=this}}
{{/each}}
</ul>
</div>

View file

@ -1,4 +1,7 @@
Template.adminMenu.helpers({
Template[getTemplate('adminMenu')].helpers({
menuItem: function () {
return getTemplate('menuItem');
},
menu: function () {
return adminNav;
}

View file

@ -1,4 +1,4 @@
Template.mobile_nav.events({
Template[getTemplate('mobile_nav')].events({
'click .mobile-nav a':function(event){
$('body').toggleClass('mobile-nav-open');
}

View file

@ -1,4 +1,4 @@
Template.nav.helpers({
Template[getTemplate('nav')].helpers({
navItems: function () {
return navItems;
},
@ -31,7 +31,7 @@ Template.nav.helpers({
}
});
Template.nav.rendered=function(){
Template[getTemplate('nav')].rendered=function(){
if(!Meteor.user()){
$('.login-link-text').text("Sign Up/Sign In");
@ -41,7 +41,7 @@ Template.nav.rendered=function(){
}
};
Template.nav.events({
Template[getTemplate('nav')].events({
'click #logout': function(e){
e.preventDefault();
Meteor.logout();

View file

@ -5,7 +5,7 @@
<div class="dropdown-menu">
<ul role="menu" aria-labelledby="dLabel">
{{#each views}}
{{> menuItem this}}
{{> UI.dynamic template=menuItem data=this}}
{{/each}}
</ul>
</div>

View file

@ -1,4 +1,7 @@
Template.viewsMenu.helpers({
Template[getTemplate('viewsMenu')].helpers({
menuItem: function () {
return getTemplate('menuItem');
},
views: function () {
return viewNav;
}

View file

@ -1,4 +1,4 @@
Template.notification_item.helpers({
Template[getTemplate('notification_item')].helpers({
nice_time: function(){
return moment(this.timestamp).fromNow();
},
@ -10,7 +10,7 @@ Template.notification_item.helpers({
}
});
Template.notification_item.events({
Template[getTemplate('notification_item')].events({
'click .action-link': function(event, instance){
var notificationId=instance.data._id;
Notifications.update(

View file

@ -6,7 +6,7 @@
<a href="#" class="mark-as-read">{{i18n "Mark all as read"}}</a>
<ul>
{{#each notifications}}
{{> notification_item}}
{{> UI.dynamic template=notification_item}}
{{/each}}
</ul>
</div>

View file

@ -1,4 +1,7 @@
Template.notifications.helpers({
Template[getTemplate('notifications')].helpers({
notification_item: function () {
return getTemplate('notification_item');
},
notifications: function(){
return Notifications.find({userId: Meteor.userId()}, {sort: {timestamp: -1}});
},
@ -19,7 +22,7 @@ Template.notifications.helpers({
}
});
Template.notifications.events({
Template[getTemplate('notifications')].events({
'click .notifications-toggle': function(e){
e.preventDefault();
$('body').toggleClass('notifications-open');

View file

@ -1,4 +1,4 @@
Template.unsubscribe.created = function(){
Template[getTemplate('unsubscribe')].created = function(){
var hash = this.data.hash;
Meteor.call('unsubscribeUser', hash, function(error, result){
if(result){
@ -10,7 +10,7 @@ Template.unsubscribe.created = function(){
trackEvent('notificationsUnsubcribe', {hash: hash});
}
Template.unsubscribe.helpers({
Template[getTemplate('unsubscribe')].helpers({
unsubscribed : function(){
// we have to use a session variable because the string we want to display
// depends on the return value of an asynchronous callback (unsubscribeUser)

View file

@ -1,4 +1,4 @@
Template.postContent.helpers({
Template[getTemplate('postContent')].helpers({
log: function (a){
console.log(a)
},

View file

@ -1,4 +1,4 @@
Template.post_edit.helpers({
Template[getTemplate('post_edit')].helpers({
created: function(){
return moment(this.createdAt).format("MMMM Do, h:mm:ss a");
},
@ -51,7 +51,7 @@ Template.post_edit.helpers({
}
});
Template.post_edit.rendered = function(){
Template[getTemplate('post_edit')].rendered = function(){
Session.set('currentPostStatus', this.status);
var post = this.data.post;
@ -68,7 +68,7 @@ Template.post_edit.rendered = function(){
}
Template.post_edit.events({
Template[getTemplate('post_edit')].events({
'change input[name=status]': function (e, i) {
Session.set('currentPostStatus', e.currentTarget.value);
},

View file

@ -1,10 +1,10 @@
var post = {};
Template.post_item.created = function () {
Template[getTemplate('post_item')].created = function () {
post = this.data;
};
Template.post_item.helpers({
Template[getTemplate('post_item')].helpers({
postModules: function () {
return postModules;
},
@ -94,7 +94,7 @@ Template.post_item.helpers({
}
});
Template.post_item.events({
Template[getTemplate('post_item')].events({
'click .upvote-link': function(e, instance){
var post = this;
e.preventDefault();
@ -106,15 +106,6 @@ Template.post_item.events({
trackEvent("post upvoted", {'_id': post._id});
});
},
'click .share-link': function(e){
var $this = $(e.target).parents('.post-share').find('.share-link');
var $share = $this.parents('.post-share').find('.share-options');
e.preventDefault();
$('.share-link').not($this).removeClass("active");
$(".share-options").not($share).addClass("hidden");
$this.toggleClass("active");
$share.toggleClass("hidden");
},
'click .approve-link': function(e, instance){
Meteor.call('approvePost', this);
e.preventDefault();

View file

@ -1,7 +1,7 @@
<template name="post_page">
<div class="single-post grid">
{{> post_item}}
{{> comment_form}}
{{> comment_list}}
{{> UI.dynamic template=post_item}}
{{> UI.dynamic template=comment_form}}
{{> UI.dynamic template=comment_list}}
</div>
</template>

View file

@ -1,4 +1,16 @@
Template.post_page.rendered = function(){
Template[getTemplate('post_page')].helpers({
post_item: function () {
return getTemplate('post_item');
},
comment_form: function () {
return getTemplate('comment_form');
},
comment_list: function () {
return getTemplate('comment_list');
}
})
Template[getTemplate('post_page')].rendered = function(){
if((scrollToCommentId=Session.get('scrollToCommentId')) && !this.rendered && $('#'+scrollToCommentId).exists()){
scrollPageTo('#'+scrollToCommentId);
Session.set('scrollToCommentId', null);

View file

@ -1,4 +1,4 @@
Template.post_submit.helpers({
Template[getTemplate('post_submit')].helpers({
categoriesEnabled: function(){
return Categories.find().count();
},
@ -24,7 +24,7 @@ Template.post_submit.helpers({
}
});
Template.post_submit.rendered = function(){
Template[getTemplate('post_submit')].rendered = function(){
Session.set('currentPostStatus', STATUS_APPROVED);
Session.set('selectedPostId', null);
if(!this.editor && $('#editor').exists())
@ -36,7 +36,7 @@ Template.post_submit.rendered = function(){
}
Template.post_submit.events({
Template[getTemplate('post_submit')].events({
'change input[name=status]': function (e, i) {
Session.set('currentPostStatus', e.currentTarget.value);
},

View file

@ -14,7 +14,7 @@
{{#if hasPosts}}
<div class="posts grid list">
{{#each posts}}
{{> post_item}}
{{> UI.dynamic template=post_item}}
{{/each}}
</div>
{{else}}

View file

@ -1,4 +1,20 @@
Template.posts_digest.helpers({
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('daysy');
$(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');
},
hasPosts: function(){
if(this.posts) // XXX
return !!this.posts.count();
@ -34,20 +50,7 @@ Template.posts_digest.helpers({
}
});
Template.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('daysy');
$(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.posts_digest.rendered = function(){
Template[getTemplate('posts_digest')].rendered = function(){
var distanceFromTop = 0;
$('.post').each(function(){
distanceFromTop += $(this).height();

View file

@ -1,7 +1,7 @@
<template name="posts_list">
<div class="posts grid list">
{{#each posts}}
{{> post_item}}
{{> UI.dynamic template=post_item}}
{{/each}}
{{#if hasMorePosts}}
<div class="more-button">

View file

@ -1,4 +1,7 @@
Template.posts_list.helpers({
Template[getTemplate('posts_list')].helpers({
post_item: function () {
return getTemplate('post_item');
},
posts : function () {
if(this.postsList){ // XXX
this.postsList.rewind();
@ -20,7 +23,7 @@ Template.posts_list.helpers({
}
});
Template.posts_list.rendered = function(){
Template[getTemplate('posts_list')].rendered = function(){
var distanceFromTop = 0;
$('.post').each(function(){
distanceFromTop += $(this).height();

View file

@ -1,4 +1,4 @@
Template.forgot_password.events({
Template[getTemplate('forgot_password')].events({
'click input[type=submit]': function(e){
e.preventDefault();
var options=new Object();

View file

@ -1,4 +1,4 @@
Template.signin.events({
Template[getTemplate('signin')].events({
'click input[type=submit]': function(event){
event.preventDefault();
var username = $('#username').val();

View file

@ -1,4 +1,4 @@
Template.signup.events({
Template[getTemplate('signup')].events({
'click input[type=submit]': function(event){
event.preventDefault();
var username = $('#username').val();

View file

@ -1,4 +1,4 @@
Template.user_edit.helpers({
Template[getTemplate('user_edit')].helpers({
profileIncomplete : function() {
return this && !this.loading && !userProfileComplete(this);
},
@ -34,7 +34,7 @@ Template.user_edit.helpers({
}
})
Template.user_edit.events({
Template[getTemplate('user_edit')].events({
'submit form': function(e){
e.preventDefault();

View file

@ -1,10 +1,10 @@
Template.user_email.helpers({
Template[getTemplate('user_email')].helpers({
user: function(){
return Meteor.user();
}
});
Template.user_email.events({
Template[getTemplate('user_email')].events({
'submit form': function(e){
e.preventDefault();
if(!Meteor.user()) throwError(i18n.t('You must be logged in.'));

View file

@ -1,4 +1,4 @@
Template.user_item.helpers({
Template[getTemplate('user_item')].helpers({
avatarUrl: function(){
return getAvatarUrl(this);
},
@ -32,7 +32,7 @@ Template.user_item.helpers({
}
});
Template.user_item.events({
Template[getTemplate('user_item')].events({
'click .invite-link': function(e, instance){
e.preventDefault();
Meteor.call('inviteUser', instance.data._id);

View file

@ -1,4 +1,4 @@
Template.user_profile.helpers({
Template[getTemplate('user_profile')].helpers({
avatarUrl: function() {
return getAvatarUrl(this);
},
@ -24,7 +24,7 @@ Template.user_profile.helpers({
}
});
Template.user_profile.events({
Template[getTemplate('user_profile')].events({
'click .invite-link': function(e, instance){
Meteor.call('inviteUser', instance.data.user._id);
throwError('Thanks, user has been invited.')

View file

@ -36,7 +36,7 @@
</thead>
<tbody>
{{#each users}}
{{> user_item}}
{{> UI.dynamic template=user_item}}
{{/each}}
</tbody>
</table>

View file

@ -1,4 +1,7 @@
Template.users.helpers({
Template[getTemplate('users')].helpers({
user_item: function () {
return getTemplate('user_item');
},
loadMoreUrl: function(){
var count = parseInt(Session.get('usersLimit')) + 20;
return '/all-users/' + count + '?filterBy='+this.filterBy+'&sortBy='+this.sortBy;

View file

@ -86,7 +86,7 @@ RSS
*/
// uncomment to disable FastRender
// var FastRender = {RouteController: RouteController, onAllRoutes: function() {}};
var FastRender = {RouteController: RouteController, onAllRoutes: function() {}};
//--------------------------------------------------------------------------------------------------//
//--------------------------------------------- Config ---------------------------------------------//
@ -269,8 +269,8 @@ if(Meteor.isClient){
// Controller for all posts lists
PostsListController = FastRender.RouteController.extend({
template:'posts_list',
waitOn: function () {
template: getTemplate('posts_list'),
onBeforeAction: function () {
// take the first segment of the path to get the view, unless it's '/' in which case the view default to 'top'
// note: most of the time this.params.slug will be empty
this._terms = {
@ -289,6 +289,16 @@ PostsListController = FastRender.RouteController.extend({
];
},
data: function () {
this._terms = {
view: this.path == '/' ? 'top' : this.path.split('/')[1],
limit: this.params.limit || getSetting('postsPerPage', 10),
category: this.params.slug
};
if(Meteor.isClient) {
this._terms.query = Session.get("searchQuery");
}
var parameters = getParameters(this._terms),
posts = Posts.find(parameters.find, parameters.options);
postsCount = posts.count();
@ -309,7 +319,7 @@ PostsListController = FastRender.RouteController.extend({
// Controller for post digest
PostsDigestController = FastRender.RouteController.extend({
template: 'posts_digest',
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(),
@ -341,7 +351,7 @@ PostsDigestController = FastRender.RouteController.extend({
// Controller for post pages
PostPageController = FastRender.RouteController.extend({
template: 'post_page',
template: getTemplate('post_page'),
waitOn: function () {
return [
Meteor.subscribe('singlePost', this.params._id),
@ -411,6 +421,27 @@ Router.map(function() {
this.route('posts_top', {
path: '/',
waitOn: function () {
// NOTE: for now, use waitOn for root path only to get spinner
// XXX TODO: get rid of duplicate code between this and controller
// take the first segment of the path to get the view, unless it's '/' in which case the view default to 'top'
// note: most of the time this.params.slug will be empty
this._terms = {
view: this.path == '/' ? 'top' : this.path.split('/')[1],
limit: this.params.limit || getSetting('postsPerPage', 10),
category: this.params.slug
};
if(Meteor.isClient) {
this._terms.query = Session.get("searchQuery");
}
return [
Meteor.subscribe('postsList', this._terms),
Meteor.subscribe('postsListUsers', this._terms)
];
},
controller: PostsListController
});
@ -478,6 +509,7 @@ Router.map(function() {
// Post Edit
this.route('post_edit', {
template: getTemplate('post_edit'),
path: '/posts/:_id/edit',
waitOn: function () {
return Meteor.subscribe('singlePost', this.params._id);
@ -500,6 +532,7 @@ Router.map(function() {
// Comment Page
this.route('comment_page', {
template: getTemplate('comment_page'),
path: '/comments/:_id',
controller: CommentPageController
});
@ -507,6 +540,7 @@ Router.map(function() {
// Comment Reply
this.route('comment_reply', {
template: getTemplate('comment_reply'),
path: '/comments/:_id/reply',
controller: CommentPageController,
onAfterAction: function() {
@ -517,6 +551,7 @@ Router.map(function() {
// Comment Edit
this.route('comment_edit', {
template: getTemplate('comment_edit'),
path: '/comments/:_id/edit',
controller: CommentPageController,
onAfterAction: function() {
@ -529,6 +564,7 @@ Router.map(function() {
// User Profile
this.route('user_profile', {
template: getTemplate('user_profile'),
path: '/users/:_idOrSlug',
controller: UserPageController
});
@ -536,6 +572,7 @@ Router.map(function() {
// User Edit
this.route('user_edit', {
template: getTemplate('user_edit'),
path: '/users/:_idOrSlug/edit',
controller: UserPageController
});
@ -543,8 +580,8 @@ Router.map(function() {
// Account
this.route('account', {
template: getTemplate('user_edit'),
path: '/account',
template: 'user_edit',
data: function() {
return {
user: Meteor.user()
@ -554,13 +591,15 @@ Router.map(function() {
// Forgot Password
this.route('forgot_password');
this.route('forgot_password', {
template: getTemplate('forgot_password'),
});
// All Users
this.route('all-users', {
template: getTemplate('users'),
path: '/all-users/:limit?',
template: 'users',
waitOn: function() {
var limit = parseInt(this.params.limit) || 20;
return Meteor.subscribe('allUsers', this.params.filterBy, this.params.sortBy, limit);
@ -583,6 +622,7 @@ Router.map(function() {
// Unsubscribe (from notifications)
this.route('unsubscribe', {
template: getTemplate('unsubscribe'),
path: '/unsubscribe/:hash',
data: function() {
return {
@ -593,11 +633,15 @@ Router.map(function() {
// User Sign-Up
this.route('signup');
this.route('signup', {
template: getTemplate('signup'),
});
// User Sign-In
this.route('signin');
this.route('signin', {
template: getTemplate('signin'),
});
// -------------------------------------------- Other -------------------------------------------- //
@ -606,6 +650,7 @@ Router.map(function() {
// Settings
this.route('settings', {
template: getTemplate('settings'),
data: function () {
// we only have one set of settings for now
return {
@ -617,11 +662,15 @@ Router.map(function() {
// Loading (for testing purposes)
this.route('loading');
this.route('loading', {
template: getTemplate('loading'),
});
// Toolbox
this.route('toolbox');
this.route('toolbox',{
template: getTemplate('toolbox'),
});
// -------------------------------------------- Server-Side -------------------------------------------- //

View file

@ -1,4 +1,4 @@
Package.describe("Telescope API package");
Package.describe({summary: "Telescope API package"});
Package.on_use(function (api) {

View file

@ -66,12 +66,18 @@ postModules = [
template: 'postContent',
position: 'center'
},
{
template: 'postShare',
position: 'right'
},
{
template: 'postDiscuss',
position: 'right'
position: 'rightmost'
}
];
];
// Dynamic Templates
templates = {}
getTemplate = function (name) {
// if template has been overwritten, return this; else return template name
return !!templates[name] ? templates[name] : name;
}

View file

@ -1,4 +1,4 @@
Package.describe("Telescope base package");
Package.describe({summary: "Telescope base package"});
Package.on_use(function (api) {
@ -8,5 +8,15 @@ Package.on_use(function (api) {
api.add_files(['lib/base_client.js'], ['client']);
api.add_files(['lib/base_server.js'], ['server']);
api.export(['adminNav', 'viewNav', 'addToPostSchema', 'preloadSubscriptions', 'navItems', 'viewParameters', 'postModules']);
api.export([
'adminNav',
'viewNav',
'addToPostSchema',
'preloadSubscriptions',
'navItems',
'viewParameters',
'postModules',
'getTemplate',
'templates'
]);
});

View file

@ -1,4 +1,4 @@
Package.describe("Telescope i18n package");
Package.describe({summary: "Telescope i18n package"});
Package.on_use(function (api) {
api.use(['ui'], 'client');

View file

@ -1,4 +1,4 @@
Package.describe("Telescope library package");
Package.describe({summary: "Telescope library package"});
Package.on_use(function (api) {

View file

@ -0,0 +1 @@
.build*

View file

@ -0,0 +1,12 @@
Template[getTemplate('postShare')].events({
'click .share-link': function(e){
console.log('aaa')
var $this = $(e.target).parents('.post-share').find('.share-link');
var $share = $this.parents('.post-share').find('.share-options');
e.preventDefault();
$('.share-link').not($this).removeClass("active");
$(".share-options").not($share).addClass("hidden");
$this.toggleClass("active");
$share.toggleClass("hidden");
}
});

View file

@ -0,0 +1,4 @@
postModules.push({
template: 'postShare',
position: 'right'
});

View file

@ -0,0 +1,18 @@
Package.describe({summary: "Telescope share module package"});
Package.on_use(function (api) {
api.use(['telescope-lib', 'telescope-base'], ['client', 'server']);
api.use([
'jquery',
'underscore',
'templating'
], 'client');
api.add_files(['lib/share.js'], ['client', 'server']);
api.add_files(['lib/client/post_share.html', 'lib/client/post_share.js'], ['client']);
// api.export();
});

View file

@ -1,4 +1,4 @@
Package.describe("Telescope RSS package");
Package.describe({summary: "Telescope RSS package"});
Package.on_use(function (api) {

View file

@ -1,4 +1,4 @@
Package.describe("Telescope search package");
Package.describe({summary: "Telescope search package"});
Package.on_use(function (api) {

View file

@ -1,4 +1,4 @@
Package.describe("Telescope tags package");
Package.describe({summary: "Telescope tags package"});
Package.on_use(function (api) {

View file

@ -28,7 +28,7 @@
"useLibsass": 0
},
"\/sass\/modules\/_comments.scss": {
"createSourceMap": 0,
"createSourceMap": 1,
"debugStyle": 0,
"decimalPrecision": 5,
"fileType": 4,
@ -124,7 +124,7 @@
"useLibsass": 0
},
"\/sass\/modules\/_posts.scss": {
"createSourceMap": 0,
"createSourceMap": 1,
"debugStyle": 0,
"decimalPrecision": 5,
"fileType": 4,
@ -284,7 +284,7 @@
"useLibsass": 0
},
"\/sass\/partials\/_main.scss": {
"createSourceMap": 0,
"createSourceMap": 1,
"debugStyle": 0,
"decimalPrecision": 5,
"fileType": 4,
@ -316,7 +316,7 @@
"useLibsass": 0
},
"\/sass\/partials\/_mixins.scss": {
"createSourceMap": 0,
"createSourceMap": 1,
"debugStyle": 0,
"decimalPrecision": 5,
"fileType": 4,
@ -428,7 +428,7 @@
"useLibsass": 0
},
"\/sass\/screen.scss": {
"createSourceMap": 0,
"createSourceMap": 1,
"debugStyle": 0,
"decimalPrecision": 5,
"fileType": 4,
@ -443,38 +443,6 @@
"shouldRunBless": 0,
"useLibsass": 0
},
"\/sass\/themes\/_default.scss": {
"createSourceMap": 0,
"debugStyle": 0,
"decimalPrecision": 5,
"fileType": 4,
"ignore": 1,
"ignoreWasSetByUser": 0,
"inputAbbreviatedPath": "\/sass\/themes\/_default.scss",
"outputAbbreviatedPath": "\/stylesheets\/_default.css",
"outputPathIsOutsideProject": 0,
"outputPathIsSetByUser": 0,
"outputStyle": 0,
"shouldRunAutoprefixer": 0,
"shouldRunBless": 0,
"useLibsass": 0
},
"\/sass\/themes\/_telescope.scss": {
"createSourceMap": 0,
"debugStyle": 0,
"decimalPrecision": 5,
"fileType": 4,
"ignore": 1,
"ignoreWasSetByUser": 0,
"inputAbbreviatedPath": "\/sass\/themes\/_telescope.scss",
"outputAbbreviatedPath": "\/stylesheets\/_telescope.css",
"outputPathIsOutsideProject": 0,
"outputPathIsSetByUser": 0,
"outputStyle": 0,
"shouldRunAutoprefixer": 0,
"shouldRunBless": 0,
"useLibsass": 0
},
"\/stylesheets\/screen.css": {
"fileType": 16,
"ignore": 1,

View file

@ -14,7 +14,7 @@
padding:10px 0 0 10px;
max-width:120px;
white-space:nowrap;
@extend cf;
@extend .cf;
&:after {
right: 100%;
border: solid transparent;

View file

@ -1,26 +1,39 @@
// modules layout
.posts{
// display: table;
}
.post{
// display: table-row;
// >div{
// display: table-cell;
// }
display: flex;
display: -webkit-flex;
display: -moz-flex;
.leftmost{
order: 1;
flex-grow: 1;
@include order(1);
@include flex-grow(1);
// width: 1px;
}
.left{
order: 2;
flex-grow: 1;
@include order(2);
@include flex-grow(1);
// width: 1px;
}
.center{
order: 3;
flex-grow: 100;
@include order(3);
@include flex-grow(30);
// width: 1px;
}
.right{
order: 4;
flex-grow: 1;
@include order(4);
@include flex-grow(1);
// width: 1px;
}
.rightmost{
order: 5;
flex-grow: 1;
@include order(5);
@include flex-grow(1);
// width: 1px;
}
}
@ -184,9 +197,8 @@
line-height:1.5;
}
.post-share, .post-discuss{
position:relative;
float:left;
margin-left:$grid-margin;
position: relative;
>a{
position:relative;
display:block;

View file

@ -46,6 +46,6 @@ body{
#login-buttons .loading{
display:none;
}
#loading{
#loading, .loading{
height:300px;
}
}

View file

@ -115,4 +115,15 @@
}
}
}
}
/*================ FLEXBOX =================*/
@mixin order($order){
order: $order;
-webkit-order: $order;
-moz-order: $order;
}
@mixin flex-grow($i){
flex-grow: $i;
-webkit-flex-grow: $i;
-moz-flex-grow: $i;
}

View file

@ -32,7 +32,4 @@
@import "modules/notifications";
@import "modules/share";
@import "partials/mobile";
@import "themes/default";
@import "themes/telescope";
@import "partials/mobile";

View file

@ -1,3 +0,0 @@
.default-theme{
}

View file

@ -1,3 +0,0 @@
.telescope-theme{
}

File diff suppressed because one or more lines are too long

View file

@ -8,7 +8,6 @@
"fast-render": {},
"spin": {},
"autoform": {},
"iron-router-progress": {},
"jquery-hotkeys": {},
"marked": {},
"bootstrap3-datepicker": {}

View file

@ -9,7 +9,6 @@
"fast-render": {},
"spin": {},
"autoform": {},
"iron-router-progress": {},
"jquery-hotkeys": {},
"marked": {},
"bootstrap3-datepicker": {}
@ -50,11 +49,6 @@
"tag": "v0.13.5",
"commit": "27dd5b912eeba687b228a6a7c2c14eef63b12cca"
},
"iron-router-progress": {
"git": "https://github.com/Multiply/iron-router-progress.git",
"tag": "v0.4.1",
"commit": "496fcda9a6ec352b4733725f60c6f280250c3541"
},
"jquery-hotkeys": {
"git": "https://github.com/terryschen/meteor-jquery-hotkeys.git",
"tag": "v0.0.1",