mirror of
https://github.com/vale981/Vulcan
synced 2025-03-06 10:01:40 -05:00
Merge branch 'delgermurun-template-extension' into devel
# Conflicts: # client/views/comments/comment_edit.js # client/views/comments/comment_form.js
This commit is contained in:
commit
9b8b23f932
123 changed files with 270 additions and 404 deletions
|
@ -1,4 +1,4 @@
|
|||
<!--
|
||||
<!--
|
||||
|
||||
Menu Component
|
||||
|
||||
|
@ -58,4 +58,4 @@ menuMode (String) [optional]
|
|||
</a>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
</template>
|
||||
|
|
|
@ -16,12 +16,11 @@ getMenuItems = function (menu) {
|
|||
return menuItems;
|
||||
}
|
||||
|
||||
Template[getTemplate('menuComponent')].helpers({
|
||||
Template.menuComponent.helpers({
|
||||
getMenuItems: function () {
|
||||
return getMenuItems(this);
|
||||
},
|
||||
menuClass: function () {
|
||||
|
||||
var classes = [this.menuName+"-menu"];
|
||||
var mode = (typeof this.menuMode === "undefined") ? "list" : this.menuMode;
|
||||
var count = getMenuItems(this).length;
|
||||
|
@ -58,7 +57,7 @@ Template[getTemplate('menuComponent')].helpers({
|
|||
itemClass: function () {
|
||||
var itemClass = "";
|
||||
var currentPath = Router.current().location.get().path ;
|
||||
|
||||
|
||||
if (this.adminOnly) {
|
||||
itemClass += " item-admin";
|
||||
}
|
||||
|
@ -81,10 +80,10 @@ Template[getTemplate('menuComponent')].helpers({
|
|||
}
|
||||
});
|
||||
|
||||
Template[getTemplate('menuComponent')].events({
|
||||
Template.menuComponent.events({
|
||||
'click .show-more': function (e, t) {
|
||||
e.preventDefault();
|
||||
$menu = t.$('.menu');
|
||||
$menu.toggleClass('menu-open');
|
||||
}
|
||||
});
|
||||
});
|
||||
|
|
|
@ -27,15 +27,15 @@ loadMoreHandler (Function)
|
|||
|
||||
<template name="posts_list">
|
||||
<div class="posts-wrapper grid grid-module">
|
||||
{{> Template.dynamic template=postsListIncoming data=incoming}}
|
||||
{{> postsListIncoming data=incoming}}
|
||||
<div class="posts list {{postsLayout}}" aria-live="polite">
|
||||
{{#each postsCursor}}
|
||||
{{> Template.dynamic template=before_post_item}}
|
||||
{{> Template.dynamic template=post_item}}
|
||||
{{> Template.dynamic template=after_post_item}}
|
||||
{{> before_post_item}}
|
||||
{{> post_item}}
|
||||
{{> after_post_item}}
|
||||
{{/each}}
|
||||
</div>
|
||||
{{> Template.dynamic template=postsLoadMore}}
|
||||
{{> postsLoadMore}}
|
||||
</div>
|
||||
</template>
|
||||
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
// ----------------------------------- Post List -----------------------------------//
|
||||
|
||||
Template[getTemplate('posts_list')].created = function() {
|
||||
Template.posts_list.created = function() {
|
||||
Session.set('listPopulatedAt', new Date());
|
||||
};
|
||||
|
||||
Template[getTemplate('posts_list')].helpers({
|
||||
Template.posts_list.helpers({
|
||||
postsLayout: function () {
|
||||
return Settings.get('postsLayout', 'posts-list');
|
||||
},
|
||||
|
@ -13,15 +13,6 @@ Template[getTemplate('posts_list')].helpers({
|
|||
if (typeof controller.getDescription === 'function')
|
||||
return Iron.controller().getDescription();
|
||||
},
|
||||
before_post_item: function () {
|
||||
return getTemplate('before_post_item');
|
||||
},
|
||||
post_item: function () {
|
||||
return getTemplate('post_item');
|
||||
},
|
||||
after_post_item: function () {
|
||||
return getTemplate('after_post_item');
|
||||
},
|
||||
postsCursor : function () {
|
||||
if (this.postsCursor) { // not sure why this should ever be undefined, but it can apparently
|
||||
var posts = this.postsCursor.map(function (post, index, cursor) {
|
||||
|
@ -32,21 +23,12 @@ Template[getTemplate('posts_list')].helpers({
|
|||
} else {
|
||||
console.log('postsCursor not defined')
|
||||
}
|
||||
},
|
||||
postsLoadMore: function () {
|
||||
return getTemplate('postsLoadMore');
|
||||
},
|
||||
postsListIncoming: function () {
|
||||
return getTemplate('postsListIncoming');
|
||||
},
|
||||
postsListSort: function () {
|
||||
return getTemplate('postsListSort');
|
||||
}
|
||||
});
|
||||
|
||||
// ----------------------------------- Incoming -----------------------------------//
|
||||
|
||||
Template[getTemplate('postsListIncoming')].events({
|
||||
Template.postsListIncoming.events({
|
||||
'click .show-new': function(e, instance) {
|
||||
Session.set('listPopulatedAt', new Date());
|
||||
}
|
||||
|
@ -54,16 +36,16 @@ Template[getTemplate('postsListIncoming')].events({
|
|||
|
||||
// ----------------------------------- Load More -----------------------------------//
|
||||
|
||||
Template[getTemplate('postsLoadMore')].helpers({
|
||||
Template.postsLoadMore.helpers({
|
||||
postsReady: function () {
|
||||
return this.postsReady;
|
||||
},
|
||||
hasPosts: function () {
|
||||
return !!this.postsCursor.count();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
Template[getTemplate('postsLoadMore')].events({
|
||||
Template.postsLoadMore.events({
|
||||
'click .more-button': function (event, instance) {
|
||||
event.preventDefault();
|
||||
if (this.controllerInstance) {
|
||||
|
|
|
@ -40,3 +40,9 @@ Meteor.startup(function() {
|
|||
SEO.config(seoProperties);
|
||||
|
||||
});
|
||||
|
||||
// Template extension stuff for backwards compatibility
|
||||
|
||||
_.each(templates, function (replacement, original) {
|
||||
Template[replacement].replaces(original);
|
||||
});
|
|
@ -1,4 +1,4 @@
|
|||
Template[getTemplate('adminMenu')].helpers({
|
||||
Template.adminMenu.helpers({
|
||||
adminMenuItems: function () {
|
||||
return adminMenu;
|
||||
}
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
<template name="adminWrapper">
|
||||
<div class="grid admin-wrapper">
|
||||
{{> Template.dynamic template=adminMenu}}
|
||||
{{> adminMenu}}
|
||||
<div class="admin-contents {{contentsClass}}">
|
||||
{{> Template.dynamic template=contents data=this}}
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
</template>
|
||||
|
|
|
@ -1,7 +1,4 @@
|
|||
Template[getTemplate('adminWrapper')].helpers({
|
||||
adminMenu: function () {
|
||||
return getTemplate("adminMenu");
|
||||
},
|
||||
Template.adminWrapper.helpers({
|
||||
contents: function () {
|
||||
return Router.current().route.getName();
|
||||
},
|
||||
|
|
|
@ -16,7 +16,7 @@ var editComment = function(instance) {
|
|||
Router.go('post_page_comment', {_id: comment.postId, commentId: comment._id});
|
||||
};
|
||||
|
||||
Template[getTemplate('comment_edit')].onRendered(function() {
|
||||
Template.comment_edit.onRendered(function() {
|
||||
var self = this;
|
||||
this.$("#comment").keydown(function (e) {
|
||||
if(((e.metaKey || e.ctrlKey) && e.keyCode == 13) || (e.ctrlKey && e.keyCode == 13)){
|
||||
|
@ -25,7 +25,7 @@ Template[getTemplate('comment_edit')].onRendered(function() {
|
|||
});
|
||||
});
|
||||
|
||||
Template[getTemplate('comment_edit')].events({
|
||||
Template.comment_edit.events({
|
||||
'click input[type=submit]': function(e, instance){
|
||||
e.preventDefault();
|
||||
editComment(instance);
|
||||
|
|
|
@ -40,7 +40,7 @@ var submitComment = function(instance) {
|
|||
});
|
||||
};
|
||||
|
||||
Template[getTemplate('comment_form')].onRendered(function() {
|
||||
Template.comment_form.onRendered(function() {
|
||||
var self = this;
|
||||
this.$("#comment").keydown(function (e) {
|
||||
if(((e.metaKey || e.ctrlKey) && e.keyCode == 13) || (e.ctrlKey && e.keyCode == 13)){
|
||||
|
@ -49,13 +49,13 @@ Template[getTemplate('comment_form')].onRendered(function() {
|
|||
});
|
||||
});
|
||||
|
||||
Template[getTemplate('comment_form')].helpers({
|
||||
Template.comment_form.helpers({
|
||||
reason: function () {
|
||||
return !!Meteor.user() ? i18n.t('sorry_you_do_not_have_the_rights_to_comments'): i18n.t('please_log_in_to_comment');
|
||||
}
|
||||
});
|
||||
|
||||
Template[getTemplate('comment_form')].events({
|
||||
Template.comment_form.events({
|
||||
'submit form': function(e, instance){
|
||||
e.preventDefault();
|
||||
submitComment(instance);
|
||||
|
|
|
@ -38,7 +38,7 @@
|
|||
<ul class="comment-children comment-list">
|
||||
{{#each childComments}}
|
||||
{{#with this}}
|
||||
{{> UI.dynamic template=comment_item}}
|
||||
{{> comment_item}}
|
||||
{{/with}}
|
||||
{{/each}}
|
||||
</ul>
|
||||
|
|
|
@ -56,16 +56,13 @@ findQueueContainer = function($comment) {
|
|||
return $container;
|
||||
};
|
||||
|
||||
Template[getTemplate('comment_item')].created = function() {
|
||||
Template.comment_item.created = function() {
|
||||
// if comments are supposed to be queued, then queue this comment on create
|
||||
this.isQueued = window.queueComments;
|
||||
window.openedComments = [];
|
||||
};
|
||||
|
||||
Template[getTemplate('comment_item')].helpers({
|
||||
comment_item: function () {
|
||||
return getTemplate('comment_item');
|
||||
},
|
||||
Template.comment_item.helpers({
|
||||
commentClass: function () {
|
||||
// if this comment was made by the post author
|
||||
if (Posts.findOne(this.postId).userId == this.userId) {
|
||||
|
@ -124,7 +121,7 @@ var handleVoteClick = function (meteorMethodName, eventName, e, instance) {
|
|||
}
|
||||
};
|
||||
|
||||
Template[getTemplate('comment_item')].events({
|
||||
Template.comment_item.events({
|
||||
'click .not-upvoted .upvote': _.partial(handleVoteClick, 'upvoteComment', 'post upvoted'),
|
||||
'click .upvoted .upvote': _.partial(handleVoteClick, 'cancelUpvoteComment', 'post upvote cancelled'),
|
||||
'click .not-downvoted .downvote': _.partial(handleVoteClick, 'downvoteComment', 'post downvoted'),
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
<template name="comment_list">
|
||||
<ul class="comments comment-list" aria-live="polite">
|
||||
{{#each child_comments}}
|
||||
{{> UI.dynamic template=comment_item}}
|
||||
{{> comment_item}}
|
||||
{{/each}}
|
||||
</ul>
|
||||
{{#each threadModules}}
|
||||
{{> UI.dynamic template=getTemplate data=..}}
|
||||
{{> Template.dynamic template=template data=..}}
|
||||
{{/each}}
|
||||
</template>
|
||||
|
|
|
@ -1,7 +1,4 @@
|
|||
Template[getTemplate('comment_list')].helpers({
|
||||
comment_item: function () {
|
||||
return getTemplate('comment_item');
|
||||
},
|
||||
Template.comment_list.helpers({
|
||||
child_comments: function(){
|
||||
var post = this;
|
||||
var comments = Comments.find({postId: post._id, parentCommentId: null}, {sort: {score: -1, postedAt: -1}});
|
||||
|
@ -9,13 +6,10 @@ Template[getTemplate('comment_list')].helpers({
|
|||
},
|
||||
threadModules: function () {
|
||||
return threadModules;
|
||||
},
|
||||
getTemplate: function () {
|
||||
return getTemplate(this.template);
|
||||
}
|
||||
});
|
||||
|
||||
Template[getTemplate('comment_list')].rendered = function(){
|
||||
Template.comment_list.rendered = function(){
|
||||
// once all comments have been rendered, activate comment queuing for future real-time comments
|
||||
window.queueComments = true;
|
||||
};
|
||||
};
|
||||
|
|
|
@ -3,18 +3,18 @@
|
|||
|
||||
{{#with post}}
|
||||
<div class="posts posts-list">
|
||||
{{> UI.dynamic template=post_item}}
|
||||
{{> post_item}}
|
||||
</div>
|
||||
{{/with}}
|
||||
|
||||
{{#with comment}}
|
||||
<ul class="selected-comment" aria-live="polite">
|
||||
{{> UI.dynamic template=comment_item}}
|
||||
{{> comment_item}}
|
||||
</ul>
|
||||
{{/with}}
|
||||
|
||||
{{#if canComment}}
|
||||
{{> UI.dynamic template=comment_form}}
|
||||
{{> comment_form}}
|
||||
{{/if}}
|
||||
|
||||
{{#if isLoggedIn}}
|
||||
|
|
|
@ -1,17 +1,8 @@
|
|||
Template[getTemplate('comment_reply')].helpers({
|
||||
post_item: function () {
|
||||
return getTemplate('post_item');
|
||||
},
|
||||
comment_item: function () {
|
||||
return getTemplate('comment_item');
|
||||
},
|
||||
comment_form: function () {
|
||||
return getTemplate('comment_form');
|
||||
},
|
||||
Template.comment_reply.helpers({
|
||||
post: function () {
|
||||
if(this.comment){ // XXX
|
||||
var post = Posts.findOne(this.comment.postId);
|
||||
return post;
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
<template name="css">
|
||||
<style>
|
||||
|
||||
|
||||
{{elementColors}}
|
||||
|
||||
|
||||
body, textarea, input, button, input[type="submit"], input[type="button"]{
|
||||
font-family: {{getSetting 'fontFamily'}};
|
||||
}
|
||||
|
@ -26,5 +26,5 @@
|
|||
}
|
||||
|
||||
</style>
|
||||
<link href='{{getSetting 'fontUrl'}}' rel='stylesheet' type='text/css'>
|
||||
</template>
|
||||
<link href='{{getSetting "fontUrl"}}' rel='stylesheet' type='text/css'>
|
||||
</template>
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
Template[getTemplate('css')].helpers({
|
||||
Template.css.helpers({
|
||||
elementColors: function () {
|
||||
var css = "";
|
||||
|
||||
|
|
|
@ -5,6 +5,6 @@
|
|||
</div>
|
||||
{{/if}}
|
||||
{{#each footerModules}}
|
||||
{{> UI.dynamic template=getTemplate}}
|
||||
{{> Template.dynamic template=template}}
|
||||
{{/each}}
|
||||
</template>
|
||||
</template>
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
Template[getTemplate('footer')].helpers({
|
||||
Template.footer.helpers({
|
||||
footerCode: function(){
|
||||
return Settings.get('footerCode');
|
||||
},
|
||||
|
@ -7,8 +7,5 @@ Template[getTemplate('footer')].helpers({
|
|||
},
|
||||
footerModules: function () {
|
||||
return footerModules;
|
||||
},
|
||||
getTemplate: function () {
|
||||
return getTemplate(this.template);
|
||||
}
|
||||
});
|
||||
|
|
|
@ -1,22 +1,22 @@
|
|||
<template name="layout">
|
||||
|
||||
{{> UI.dynamic template=css}}
|
||||
{{> css}}
|
||||
<div class="outer-wrapper {{currentPage}} {{navLayout}}">
|
||||
{{> UI.dynamic template=mobile_nav}}
|
||||
{{> mobile_nav}}
|
||||
<div class="inner-wrapper template-{{pageName}}">
|
||||
{{> UI.dynamic template=nav}}
|
||||
{{> nav}}
|
||||
<div class="content-wrapper">
|
||||
{{> UI.dynamic template=messages}}
|
||||
{{> messages}}
|
||||
{{#each heroModules}}
|
||||
{{> UI.dynamic template=getTemplate}}
|
||||
{{> Template.dynamic template=template}}
|
||||
{{/each}}
|
||||
{{> yield "adminMenu"}}
|
||||
{{> yield "postListTop"}}
|
||||
{{> yield}}
|
||||
{{> UI.dynamic template=footer}}
|
||||
{{> footer}}
|
||||
</div>
|
||||
<div class="overlay hidden"></div>
|
||||
</div>
|
||||
{{{extraCode}}}
|
||||
</div>
|
||||
</template>
|
||||
</template>
|
||||
|
|
|
@ -1,44 +1,23 @@
|
|||
Template[getTemplate('layout')].helpers({
|
||||
mobile_nav: function () {
|
||||
return getTemplate('mobile_nav');
|
||||
},
|
||||
nav: function () {
|
||||
return getTemplate('nav');
|
||||
},
|
||||
Template.layout.helpers({
|
||||
navLayout: function () {
|
||||
return Settings.get('navLayout', 'top-nav');
|
||||
},
|
||||
messages: function () {
|
||||
return getTemplate('messages');
|
||||
},
|
||||
notifications: function () {
|
||||
return getTemplate('notifications');
|
||||
},
|
||||
footer: function () {
|
||||
return getTemplate('footer');
|
||||
},
|
||||
pageName : function(){
|
||||
return getCurrentTemplate();
|
||||
},
|
||||
css: function () {
|
||||
return getTemplate('css');
|
||||
},
|
||||
extraCode: function() {
|
||||
return Settings.get('extraCode');
|
||||
},
|
||||
heroModules: function () {
|
||||
return _.sortBy(heroModules, 'order');
|
||||
},
|
||||
getTemplate: function () {
|
||||
return getTemplate(this.template);
|
||||
}
|
||||
});
|
||||
|
||||
Template[getTemplate('layout')].created = function(){
|
||||
Template.layout.created = function(){
|
||||
Session.set('currentScroll', null);
|
||||
};
|
||||
|
||||
Template[getTemplate('layout')].rendered = function(){
|
||||
Template.layout.rendered = function(){
|
||||
if(currentScroll=Session.get('currentScroll')){
|
||||
$('body').scrollTop(currentScroll);
|
||||
Session.set('currentScroll', null);
|
||||
|
@ -53,7 +32,7 @@ Template[getTemplate('layout')].rendered = function(){
|
|||
|
||||
};
|
||||
|
||||
Template[getTemplate('layout')].events({
|
||||
Template.layout.events({
|
||||
'click .inner-wrapper': function (e) {
|
||||
if ($('body').hasClass('mobile-nav-open')) {
|
||||
e.preventDefault();
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
Template[getTemplate('loading')].helpers({
|
||||
Template.loading.helpers({
|
||||
log: function () {
|
||||
console.log('loading…')
|
||||
}
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
Template[getTemplate('no_account')].helpers({
|
||||
Template.no_account.helpers({
|
||||
landingPageText: function(){
|
||||
return Settings.get("landingPageText");
|
||||
}
|
||||
});
|
||||
Template[getTemplate('no_account')].events({
|
||||
Template.no_account.events({
|
||||
'click .twitter-button': function(){
|
||||
Meteor.loginWithTwitter(function(){
|
||||
Router.go('/');
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
Template[getTemplate('no_invite')].helpers({
|
||||
Template.no_invite.helpers({
|
||||
afterSignupText: function(){
|
||||
return Settings.get("afterSignupText");
|
||||
}
|
||||
|
|
|
@ -11,7 +11,7 @@ var canEditField = function (field) {
|
|||
return isAdmin(Meteor.user()) || (!!field.atts && !!field.atts.editable) || (!!field.afFieldInputAtts && !!field.afFieldInputAtts.editable)
|
||||
}
|
||||
|
||||
Template[getTemplate('quickForm_telescope')].helpers({
|
||||
Template.quickForm_telescope.helpers({
|
||||
fieldsWithNoFieldset: function () {
|
||||
// get names of fields who don't have an autoform attribute or don't have a group, but are not omitted
|
||||
// note: we need to _.map() first to assign the field key to the "name" property to preserve it.
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
Template[getTemplate('logo')].helpers({
|
||||
Template.logo.helpers({
|
||||
site_title: function(){
|
||||
return Settings.get('title', "Telescope");
|
||||
},
|
||||
|
|
|
@ -4,10 +4,10 @@
|
|||
<ul class="mobile-menu">
|
||||
{{#each mobileNav}}
|
||||
<li>
|
||||
{{> Template.dynamic template=getTemplate data=mobileContext}}
|
||||
{{> Template.dynamic template=template data=mobileContext}}
|
||||
</li>
|
||||
{{/each}}
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
</template>
|
||||
|
|
|
@ -1,25 +1,19 @@
|
|||
Template[getTemplate('mobile_nav')].helpers({
|
||||
Template.mobile_nav.helpers({
|
||||
mobileNav: function () {
|
||||
return _.sortBy(mobileNav, 'order');
|
||||
},
|
||||
logoTemplate: function () {
|
||||
return getTemplate('logo');
|
||||
},
|
||||
getTemplate: function () {
|
||||
return getTemplate(this.template);
|
||||
},
|
||||
mobileContext: function () {
|
||||
return {mobile: true};
|
||||
}
|
||||
});
|
||||
|
||||
Template[getTemplate('mobile_nav')].events({
|
||||
Template.mobile_nav.events({
|
||||
'click .menu-sub-level': function () {
|
||||
$('body').toggleClass('mobile-nav-open');
|
||||
}
|
||||
});
|
||||
|
||||
Template[getTemplate('mobile_nav')].events({
|
||||
Template.mobile_nav.events({
|
||||
'click .menu-top-level': function (e) {
|
||||
e.preventDefault();
|
||||
$(e.currentTarget).next().slideToggle('fast');
|
||||
|
@ -29,4 +23,4 @@ Template[getTemplate('mobile_nav')].events({
|
|||
$('body').removeClass('mobile-nav-open');
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
|
|
|
@ -5,12 +5,12 @@
|
|||
{{{icon "menu"}}}
|
||||
</a>
|
||||
|
||||
{{> Template.dynamic template=logoTemplate}}
|
||||
{{> logo}}
|
||||
|
||||
{{#with primaryNav}}
|
||||
<div class="nav primary-nav desktop-nav header-module desktop-only">
|
||||
{{#each this}}
|
||||
{{> UI.dynamic template=getTemplate}}
|
||||
{{> Template.dynamic template=template}}
|
||||
{{/each}}
|
||||
</div>
|
||||
{{/with}}
|
||||
|
@ -18,10 +18,10 @@
|
|||
{{#with secondaryNav}}
|
||||
<div class="nav secondary-nav desktop-nav header-module desktop-only">
|
||||
{{#each this}}
|
||||
{{> UI.dynamic template=getTemplate}}
|
||||
{{> Template.dynamic template=template}}
|
||||
{{/each}}
|
||||
</div>
|
||||
{{/with}}
|
||||
|
||||
|
||||
</header>
|
||||
</template>
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
Template[getTemplate('nav')].helpers({
|
||||
Template.nav.helpers({
|
||||
headerClass: function () {
|
||||
var headerClass = "";
|
||||
var bgBrightness = tinycolor(Settings.get('headerColor')).getBrightness();
|
||||
|
@ -44,18 +44,9 @@ Template[getTemplate('nav')].helpers({
|
|||
console.log(this)
|
||||
return this.length > 3;
|
||||
},
|
||||
logoTemplate: function () {
|
||||
return getTemplate('logo');
|
||||
},
|
||||
navZoneTemplate: function () {
|
||||
return getTemplate('navZone');
|
||||
},
|
||||
getTemplate: function () {
|
||||
return getTemplate(this.template);
|
||||
}
|
||||
});
|
||||
|
||||
Template[getTemplate('nav')].events({
|
||||
Template.nav.events({
|
||||
'click .mobile-menu-button': function(e){
|
||||
e.preventDefault();
|
||||
e.stopPropagation(); // Make sure we don't immediately close the mobile nav again. See layout.js event handler.
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
Template[getTemplate('userMenu')].helpers({
|
||||
Template.userMenu.helpers({
|
||||
menuLabel: function () {
|
||||
return getDisplayName(Meteor.user());
|
||||
},
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
Template[getTemplate('viewsMenu')].helpers({
|
||||
Template.viewsMenu.helpers({
|
||||
viewsMenuData: function () {
|
||||
return {
|
||||
dropdownName: 'view',
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
Template[getTemplate('postActions')].helpers({
|
||||
Template.postActions.helpers({
|
||||
|
||||
});
|
||||
|
||||
Template[getTemplate('postActions')].events({
|
||||
Template.postActions.events({
|
||||
'click .toggle-actions-link': function(e, instance){
|
||||
e.preventDefault();
|
||||
var $post = $(e.target).parents('.post');
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
Template[getTemplate('postAdmin')].helpers({
|
||||
Template.postAdmin.helpers({
|
||||
showApprove: function () {
|
||||
return this.status == STATUS_PENDING;
|
||||
},
|
||||
|
@ -10,7 +10,7 @@ Template[getTemplate('postAdmin')].helpers({
|
|||
}
|
||||
});
|
||||
|
||||
Template[getTemplate('postAdmin')].events({
|
||||
Template.postAdmin.events({
|
||||
'click .approve-link': function(e, instance){
|
||||
Meteor.call('approvePost', this);
|
||||
e.preventDefault();
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
Template[getTemplate('postAvatars')].helpers({
|
||||
Template.postAvatars.helpers({
|
||||
commenters: function () {
|
||||
// remove post author ID from commenters to avoid showing author's avatar again
|
||||
// limit to 4 commenters in case there's more
|
||||
|
|
|
@ -1,17 +1,17 @@
|
|||
<template name="postContent">
|
||||
{{#each postThumbnail}}
|
||||
{{> UI.dynamic template=getTemplate data=..}}
|
||||
{{> Template.dynamic template=template data=..}}
|
||||
{{/each}}
|
||||
<div class="post-info">
|
||||
<h3 class="post-heading">
|
||||
{{#each postHeading}}
|
||||
{{> UI.dynamic template=getTemplate data=..}}
|
||||
{{> Template.dynamic template=template data=..}}
|
||||
{{/each}}
|
||||
</h3>
|
||||
<div class="post-meta">
|
||||
{{#each postMeta}}
|
||||
{{> UI.dynamic template=getTemplate data=..}}
|
||||
{{> Template.dynamic template=template data=..}}
|
||||
{{/each}}
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
</template>
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
Template[getTemplate('postContent')].helpers({
|
||||
Template.postContent.helpers({
|
||||
postThumbnail: function () {
|
||||
return postThumbnail;
|
||||
},
|
||||
|
@ -8,9 +8,6 @@ Template[getTemplate('postContent')].helpers({
|
|||
postMeta: function () {
|
||||
return postMeta;
|
||||
},
|
||||
getTemplate: function () {
|
||||
return getTemplate(this.template);
|
||||
},
|
||||
sourceLink: function(){
|
||||
return !!this.url ? this.url : "/posts/"+this._id;
|
||||
},
|
||||
|
@ -33,4 +30,4 @@ Template[getTemplate('postContent')].helpers({
|
|||
commentsDisplayText: function(){
|
||||
return this.comments == 1 ? i18n.t('comment') : i18n.t('comments');
|
||||
}
|
||||
});
|
||||
});
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
Template[getTemplate('postDomain')].helpers({
|
||||
Template.postDomain.helpers({
|
||||
domain: function(){
|
||||
var a = document.createElement('a');
|
||||
a.href = this.url;
|
||||
|
|
|
@ -1,8 +1,5 @@
|
|||
Template[getTemplate('postInfo')].helpers({
|
||||
Template.postInfo.helpers({
|
||||
pointsUnitDisplayText: function(){
|
||||
return this.upvotes == 1 ? i18n.t('point') : i18n.t('points');
|
||||
},
|
||||
getTemplate: function() {
|
||||
return getTemplate("postAuthor");
|
||||
}
|
||||
});
|
||||
});
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
Template[getTemplate('postRank')].helpers({
|
||||
Template.postRank.helpers({
|
||||
oneBasedRank: function(){
|
||||
if (typeof this.rank !== 'undefined') {
|
||||
return this.rank + 1;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
Template[getTemplate('postTitle')].helpers({
|
||||
Template.postTitle.helpers({
|
||||
postLink: function(){
|
||||
return !!this.url ? getOutgoingUrl(this.url) : "/posts/"+this._id;
|
||||
},
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
Template[getTemplate('postUpvote')].helpers({
|
||||
Template.postUpvote.helpers({
|
||||
upvoted: function(){
|
||||
var user = Meteor.user();
|
||||
if(!user) return false;
|
||||
|
@ -6,7 +6,7 @@ Template[getTemplate('postUpvote')].helpers({
|
|||
}
|
||||
});
|
||||
|
||||
Template[getTemplate('postUpvote')].events({
|
||||
Template.postUpvote.events({
|
||||
'click .upvote-link': function(e, instance){
|
||||
var post = this;
|
||||
e.preventDefault();
|
||||
|
|
|
@ -40,7 +40,7 @@ AutoForm.hooks({
|
|||
});
|
||||
|
||||
// delete link
|
||||
Template[getTemplate('post_edit')].events({
|
||||
Template.post_edit.events({
|
||||
'click .delete-link': function(e){
|
||||
var post = this.post;
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
<div class="post {{#if sticky}}sticky{{/if}} {{inactiveClass}} {{postClass}}" id="{{_id}}">
|
||||
{{#each postModules}}
|
||||
<div class="{{moduleClass}}">
|
||||
{{> UI.dynamic template=getTemplate data=..}}
|
||||
{{> Template.dynamic template=template data=..}}
|
||||
</div>
|
||||
{{/each}}
|
||||
</div>
|
||||
|
|
|
@ -1,16 +1,13 @@
|
|||
var post = {};
|
||||
|
||||
Template[getTemplate('post_item')].created = function () {
|
||||
Template.post_item.created = function () {
|
||||
post = this.data;
|
||||
};
|
||||
|
||||
Template[getTemplate('post_item')].helpers({
|
||||
Template.post_item.helpers({
|
||||
postModules: function () {
|
||||
return postModules;
|
||||
},
|
||||
getTemplate: function () {
|
||||
return getTemplate(this.template);
|
||||
},
|
||||
moduleContext: function () { // not used for now
|
||||
var module = this;
|
||||
module.templateClass = camelToDash(this.template) + ' ' + this.position + ' cell';
|
||||
|
@ -27,7 +24,7 @@ Template[getTemplate('post_item')].helpers({
|
|||
var postClass = postClassCallbacks.reduce(function(result, currentFunction) {
|
||||
return currentFunction(post, result);
|
||||
}, postAuthorClass);
|
||||
|
||||
|
||||
return postClass;
|
||||
}
|
||||
});
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<template name="postListTop">
|
||||
{{#each postListTopModules}}
|
||||
{{> Template.dynamic template=getTemplate}}
|
||||
{{> Template.dynamic template=template}}
|
||||
{{/each}}
|
||||
</template>
|
||||
|
|
|
@ -1,8 +1,5 @@
|
|||
Template[getTemplate('postListTop')].helpers({
|
||||
Template.postListTop.helpers({
|
||||
postListTopModules: function () {
|
||||
return _.sortBy(postListTopModules, 'order');
|
||||
},
|
||||
getTemplate: function () {
|
||||
return getTemplate(this.template);
|
||||
}
|
||||
});
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
<template name="post_page">
|
||||
<div class="single-post grid">
|
||||
<div class="posts posts-list">
|
||||
{{> UI.dynamic template=post_item}}
|
||||
{{> post_item}}
|
||||
</div>
|
||||
{{#if body}}
|
||||
{{> UI.dynamic template=post_body}}
|
||||
{{> post_body}}
|
||||
{{/if}}
|
||||
{{> UI.dynamic template=comment_form}}
|
||||
{{> UI.dynamic template=comment_list}}
|
||||
{{> comment_form}}
|
||||
{{> comment_list}}
|
||||
</div>
|
||||
</template>
|
||||
|
|
|
@ -1,18 +1,3 @@
|
|||
Template[getTemplate('post_page')].helpers({
|
||||
post_item: function () {
|
||||
return getTemplate('post_item');
|
||||
},
|
||||
post_body: function () {
|
||||
return getTemplate('post_body');
|
||||
},
|
||||
comment_form: function () {
|
||||
return getTemplate('comment_form');
|
||||
},
|
||||
comment_list: function () {
|
||||
return getTemplate('comment_list');
|
||||
}
|
||||
});
|
||||
|
||||
Template[getTemplate('post_page')].rendered = function(){
|
||||
Template.post_page.rendered = function(){
|
||||
$('body').scrollTop(0);
|
||||
};
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
Template[getTemplate('postViewsNav')].helpers({
|
||||
Template.postViewsNav.helpers({
|
||||
showNav: function () {
|
||||
var navElements = Settings.get('postViews', _.pluck(viewsMenu, 'route'));
|
||||
var navCount = (typeof navElements === "array") ? navElements.length : _.keys(navElements).length;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
Template[getTemplate('userAccount')].helpers({
|
||||
Template.userAccount.helpers({
|
||||
profileIncomplete : function() {
|
||||
return this && !this.loading && !userProfileComplete(this);
|
||||
},
|
||||
|
@ -34,7 +34,7 @@ Template[getTemplate('userAccount')].helpers({
|
|||
}
|
||||
});
|
||||
|
||||
Template[getTemplate('userAccount')].events({
|
||||
Template.userAccount.events({
|
||||
'submit #account-form': function(e){
|
||||
e.preventDefault();
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
Template[getTemplate('usersDashboard')].helpers({
|
||||
Template.usersDashboard.helpers({
|
||||
settings: function() {
|
||||
return {
|
||||
collection: 'all-users',
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
Template[getTemplate('users_list_actions')].helpers({
|
||||
Template.users_list_actions.helpers({
|
||||
isInvited: function() {
|
||||
return this.isInvited;
|
||||
},
|
||||
|
@ -7,7 +7,7 @@ Template[getTemplate('users_list_actions')].helpers({
|
|||
},
|
||||
});
|
||||
|
||||
Template[getTemplate('users_list_actions')].events({
|
||||
Template.users_list_actions.events({
|
||||
'click .invite-link': function(e){
|
||||
e.preventDefault();
|
||||
Meteor.call('inviteUser', { userId : this._id });
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
Template[getTemplate('userComments')].created = function () {
|
||||
Template.userComments.created = function () {
|
||||
Session.set('commentsShown', 5);
|
||||
|
||||
var user = this.data;
|
||||
|
@ -20,7 +20,7 @@ Template[getTemplate('userComments')].created = function () {
|
|||
});
|
||||
};
|
||||
|
||||
Template[getTemplate('userComments')].helpers({
|
||||
Template.userComments.helpers({
|
||||
comments: function () {
|
||||
var comments = Template.instance().comments.get();
|
||||
if(!!comments){
|
||||
|
@ -39,7 +39,7 @@ Template[getTemplate('userComments')].helpers({
|
|||
}
|
||||
});
|
||||
|
||||
Template[getTemplate('userComments')].events({
|
||||
Template.userComments.events({
|
||||
'click .comments-more': function (e) {
|
||||
e.preventDefault();
|
||||
var commentsShown = Template.instance().commentsShown.get();
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
Template[getTemplate('userDownvotedPosts')].created = function () {
|
||||
Template.userDownvotedPosts.created = function () {
|
||||
|
||||
var user = this.data;
|
||||
var instance = this;
|
||||
|
@ -27,7 +27,7 @@ Template[getTemplate('userDownvotedPosts')].created = function () {
|
|||
});
|
||||
};
|
||||
|
||||
Template[getTemplate('userDownvotedPosts')].helpers({
|
||||
Template.userDownvotedPosts.helpers({
|
||||
posts: function () {
|
||||
var user = this;
|
||||
var posts = Template.instance().posts.get().fetch();
|
||||
|
@ -43,7 +43,7 @@ Template[getTemplate('userDownvotedPosts')].helpers({
|
|||
}
|
||||
});
|
||||
|
||||
Template[getTemplate('userDownvotedPosts')].events({
|
||||
Template.userDownvotedPosts.events({
|
||||
'click .downvotedposts-more': function (e) {
|
||||
e.preventDefault();
|
||||
var terms = Template.instance().terms.get();
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
Template[getTemplate('userInfo')].helpers({
|
||||
Template.userInfo.helpers({
|
||||
canEditProfile: function() {
|
||||
var currentUser = Meteor.user();
|
||||
return currentUser && (this._id == currentUser._id || isAdmin(currentUser));
|
||||
|
@ -21,7 +21,7 @@ Template[getTemplate('userInfo')].helpers({
|
|||
}
|
||||
});
|
||||
|
||||
Template[getTemplate('userInfo')].events({
|
||||
Template.userInfo.events({
|
||||
'click .invite-link': function(e, instance){
|
||||
Meteor.call('inviteUser', instance.data.user._id);
|
||||
Messages.flash('Thanks, user has been invited.', "success");
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
Template[getTemplate('userPosts')].created = function () {
|
||||
Template.userPosts.created = function () {
|
||||
|
||||
var user = this.data;
|
||||
var instance = this;
|
||||
|
@ -37,7 +37,7 @@ Template[getTemplate('userPosts')].created = function () {
|
|||
});
|
||||
};
|
||||
|
||||
Template[getTemplate('userPosts')].helpers({
|
||||
Template.userPosts.helpers({
|
||||
posts: function () {
|
||||
return Template.instance().posts.get();
|
||||
},
|
||||
|
@ -49,7 +49,7 @@ Template[getTemplate('userPosts')].helpers({
|
|||
}
|
||||
});
|
||||
|
||||
Template[getTemplate('userPosts')].events({
|
||||
Template.userPosts.events({
|
||||
'click .posts-more': function (e) {
|
||||
e.preventDefault();
|
||||
var terms = Template.instance().terms.get();
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
Template[getTemplate('userUpvotedPosts')].created = function () {
|
||||
Template.userUpvotedPosts.created = function () {
|
||||
|
||||
var user = this.data;
|
||||
var instance = this;
|
||||
|
@ -27,7 +27,7 @@ Template[getTemplate('userUpvotedPosts')].created = function () {
|
|||
});
|
||||
};
|
||||
|
||||
Template[getTemplate('userUpvotedPosts')].helpers({
|
||||
Template.userUpvotedPosts.helpers({
|
||||
posts: function () {
|
||||
var user = this;
|
||||
var posts = Template.instance().posts.get().fetch();
|
||||
|
@ -43,7 +43,7 @@ Template[getTemplate('userUpvotedPosts')].helpers({
|
|||
}
|
||||
});
|
||||
|
||||
Template[getTemplate('userUpvotedPosts')].events({
|
||||
Template.userUpvotedPosts.events({
|
||||
'click .upvotedposts-more': function (e) {
|
||||
e.preventDefault();
|
||||
var terms = Template.instance().terms.get();
|
||||
|
|
|
@ -2,4 +2,4 @@
|
|||
<div class="grid-small grid-block dialog">
|
||||
<p>{{_ "you_ve_been_signed_out"}}</p>
|
||||
</div>
|
||||
</template>
|
||||
</template>
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<template name="user_edit">
|
||||
{{#with user}}
|
||||
{{#each userProfileEdit}}
|
||||
{{> UI.dynamic template=getTemplate data=..}}
|
||||
{{> Template.dynamic template=template data=..}}
|
||||
{{/each}}
|
||||
{{/with}}
|
||||
</template>
|
||||
|
|
|
@ -1,8 +1,5 @@
|
|||
Template[getTemplate('user_edit')].helpers({
|
||||
Template.user_edit.helpers({
|
||||
userProfileEdit: function () {
|
||||
return userProfileEdit;
|
||||
},
|
||||
getTemplate: function () {
|
||||
return getTemplate(this.template);
|
||||
}
|
||||
});
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
Template[getTemplate('user_email')].helpers({
|
||||
Template.user_email.helpers({
|
||||
user: function(){
|
||||
return Meteor.user();
|
||||
},
|
||||
|
@ -7,7 +7,7 @@ Template[getTemplate('user_email')].helpers({
|
|||
}
|
||||
});
|
||||
|
||||
Template[getTemplate('user_email')].events({
|
||||
Template.user_email.events({
|
||||
'submit form': function(e){
|
||||
e.preventDefault();
|
||||
if(!Meteor.user())
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
Template[getTemplate('user_item')].helpers({
|
||||
Template.user_item.helpers({
|
||||
createdAtFormatted: function(){
|
||||
return this.createdAt ? moment(this.createdAt).fromNow() : '–';
|
||||
},
|
||||
|
@ -29,7 +29,7 @@ Template[getTemplate('user_item')].helpers({
|
|||
}
|
||||
});
|
||||
|
||||
Template[getTemplate('user_item')].events({
|
||||
Template.user_item.events({
|
||||
'click .invite-link': function(e, instance){
|
||||
e.preventDefault();
|
||||
Meteor.call('inviteUser', { userId : instance.data._id });
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<template name="user_profile">
|
||||
{{#with user}}
|
||||
{{#each userProfileDisplay}}
|
||||
{{> UI.dynamic template=getTemplate data=..}}
|
||||
{{#each userProfileDisplay}}
|
||||
{{> Template.dynamic template=template data=..}}
|
||||
{{/each}}
|
||||
{{/with}}
|
||||
</template>
|
||||
|
|
|
@ -1,8 +1,5 @@
|
|||
Template[getTemplate('user_profile')].helpers({
|
||||
Template.user_profile.helpers({
|
||||
userProfileDisplay: function () {
|
||||
return userProfileDisplay;
|
||||
},
|
||||
getTemplate: function () {
|
||||
return getTemplate(this.template);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
|
|
@ -10,14 +10,14 @@ Meteor.startup(function (){
|
|||
|
||||
Router.route('/loading', {
|
||||
name: 'loading',
|
||||
template: getTemplate('loading')
|
||||
template: 'loading'
|
||||
});
|
||||
|
||||
// Toolbox
|
||||
|
||||
Router.route('/toolbox', {
|
||||
name: 'toolbox',
|
||||
template: getTemplate('toolbox')
|
||||
template: 'toolbox'
|
||||
});
|
||||
|
||||
});
|
||||
|
|
|
@ -25,7 +25,7 @@ Meteor.startup( function () {
|
|||
|
||||
Router.route('/comments/:_id', {
|
||||
name: 'comment_reply',
|
||||
template: getTemplate('comment_reply'),
|
||||
template: 'comment_reply',
|
||||
controller: CommentPageController,
|
||||
onAfterAction: function() {
|
||||
window.queueComments = false;
|
||||
|
@ -36,11 +36,11 @@ Meteor.startup( function () {
|
|||
|
||||
Router.route('/comments/:_id/edit', {
|
||||
name: 'comment_edit',
|
||||
template: getTemplate('comment_edit'),
|
||||
template: 'comment_edit',
|
||||
controller: CommentPageController,
|
||||
onAfterAction: function() {
|
||||
window.queueComments = false;
|
||||
}
|
||||
});
|
||||
|
||||
});
|
||||
});
|
||||
|
|
|
@ -4,9 +4,9 @@ preloadSubscriptions.push('settings');
|
|||
preloadSubscriptions.push('currentUser');
|
||||
|
||||
Router.configure({
|
||||
layoutTemplate: getTemplate('layout'),
|
||||
loadingTemplate: getTemplate('loading'),
|
||||
notFoundTemplate: getTemplate('notFound'),
|
||||
layoutTemplate: 'layout',
|
||||
loadingTemplate: 'loading',
|
||||
notFoundTemplate: 'notFound',
|
||||
waitOn: function () {
|
||||
return _.map(preloadSubscriptions, function(sub){
|
||||
// can either pass strings or objects with subName and subArguments properties
|
||||
|
|
|
@ -7,7 +7,7 @@ Router._filters = {
|
|||
isReady: function () {
|
||||
if (!this.ready()) {
|
||||
// console.log('not ready')
|
||||
this.render(getTemplate('loading'));
|
||||
this.render('loading');
|
||||
}else{
|
||||
this.next();
|
||||
// console.log('ready')
|
||||
|
@ -52,7 +52,7 @@ Router._filters = {
|
|||
isAdmin: function () {
|
||||
if(!this.ready()) return;
|
||||
if(!isAdmin()){
|
||||
this.render(getTemplate('no_rights'));
|
||||
this.render('no_rights');
|
||||
} else {
|
||||
this.next();
|
||||
}
|
||||
|
@ -60,9 +60,9 @@ Router._filters = {
|
|||
|
||||
canView: function () {
|
||||
if(!this.ready() || Meteor.loggingIn()){
|
||||
this.render(getTemplate('loading'));
|
||||
this.render('loading');
|
||||
} else if (!can.view()) {
|
||||
this.render(getTemplate('no_rights'));
|
||||
this.render('no_rights');
|
||||
} else {
|
||||
this.next();
|
||||
}
|
||||
|
@ -71,7 +71,7 @@ Router._filters = {
|
|||
canViewPendingPosts: function () {
|
||||
var post = this.data();
|
||||
if (!!post && post.status == STATUS_PENDING && !can.viewPendingPosts()) {
|
||||
this.render(getTemplate('no_rights'));
|
||||
this.render('no_rights');
|
||||
} else {
|
||||
this.next();
|
||||
}
|
||||
|
@ -80,7 +80,7 @@ Router._filters = {
|
|||
canViewRejectedPosts: function () {
|
||||
var post = this.data();
|
||||
if (!!post && post.status == STATUS_REJECTED && !can.viewRejectedPosts()) {
|
||||
this.render(getTemplate('no_rights'));
|
||||
this.render('no_rights');
|
||||
} else {
|
||||
this.next();
|
||||
}
|
||||
|
@ -88,10 +88,10 @@ Router._filters = {
|
|||
|
||||
canPost: function () {
|
||||
if(!this.ready() || Meteor.loggingIn()){
|
||||
this.render(getTemplate('loading'));
|
||||
this.render('loading');
|
||||
} else if(!can.post()) {
|
||||
Messages.flash(i18n.t("sorry_you_dont_have_permissions_to_add_new_items"), "error");
|
||||
this.render(getTemplate('no_rights'));
|
||||
this.render('no_rights');
|
||||
} else {
|
||||
this.next();
|
||||
}
|
||||
|
@ -103,7 +103,7 @@ Router._filters = {
|
|||
var post = Posts.findOne(this.params._id);
|
||||
if(!can.currentUserEdit(post)){
|
||||
Messages.flash(i18n.t("sorry_you_cannot_edit_this_post"), "error");
|
||||
this.render(getTemplate('no_rights'));
|
||||
this.render('no_rights');
|
||||
} else {
|
||||
this.next();
|
||||
}
|
||||
|
@ -115,7 +115,7 @@ Router._filters = {
|
|||
var comment = Comments.findOne(this.params._id);
|
||||
if(!can.currentUserEdit(comment)){
|
||||
Messages.flash(i18n.t("sorry_you_cannot_edit_this_comment"), "error");
|
||||
this.render(getTemplate('no_rights'));
|
||||
this.render('no_rights');
|
||||
} else {
|
||||
this.next();
|
||||
}
|
||||
|
@ -125,7 +125,7 @@ Router._filters = {
|
|||
if(!this.ready()) return;
|
||||
var user = Meteor.user();
|
||||
if (user && ! userProfileComplete(user)){
|
||||
this.render(getTemplate('user_email'));
|
||||
this.render('user_email');
|
||||
} else {
|
||||
this.next();
|
||||
}
|
||||
|
|
|
@ -2,13 +2,13 @@
|
|||
|
||||
PostsListController = RouteController.extend({
|
||||
|
||||
template: getTemplate('posts_list'),
|
||||
template: 'posts_list',
|
||||
|
||||
onBeforeAction: function () {
|
||||
var showViewsNav = (typeof this.showViewsNav === 'undefined') ? true : this.showViewsNav;
|
||||
|
||||
if (showViewsNav) {
|
||||
this.render(getTemplate('postListTop'), {to: 'postListTop'});
|
||||
this.render('postListTop', {to: 'postListTop'});
|
||||
}
|
||||
this.next();
|
||||
},
|
||||
|
@ -129,7 +129,7 @@ PostsScheduledController = PostsListController.extend({
|
|||
|
||||
PostPageController = RouteController.extend({
|
||||
|
||||
template: getTemplate('post_page'),
|
||||
template: 'post_page',
|
||||
|
||||
waitOn: function() {
|
||||
this.postSubscription = coreSubscriptions.subscribe('singlePost', this.params._id);
|
||||
|
@ -149,9 +149,9 @@ PostPageController = RouteController.extend({
|
|||
onBeforeAction: function() {
|
||||
if (! this.post()) {
|
||||
if (this.postSubscription.ready()) {
|
||||
this.render(getTemplate('not_found'));
|
||||
this.render('not_found');
|
||||
} else {
|
||||
this.render(getTemplate('loading'));
|
||||
this.render('loading');
|
||||
}
|
||||
} else {
|
||||
this.next();
|
||||
|
@ -229,7 +229,7 @@ Meteor.startup(function () {
|
|||
|
||||
Router.route('/posts/:_id/edit', {
|
||||
name: 'post_edit',
|
||||
template: getTemplate('post_edit'),
|
||||
template: 'post_edit',
|
||||
waitOn: function () {
|
||||
return [
|
||||
coreSubscriptions.subscribe('singlePost', this.params._id),
|
||||
|
@ -249,7 +249,7 @@ Meteor.startup(function () {
|
|||
|
||||
Router.route('/submit', {
|
||||
name: 'post_submit',
|
||||
template: getTemplate('post_submit'),
|
||||
template: 'post_submit',
|
||||
waitOn: function () {
|
||||
return coreSubscriptions.subscribe('allUsersAdmin');
|
||||
}
|
||||
|
|
|
@ -56,7 +56,7 @@ Meteor.startup(function (){
|
|||
siteTitle: Settings.get('title'),
|
||||
siteUrl: getSiteUrl()
|
||||
};
|
||||
html = Handlebars.templates[getTemplate('emailAccountApproved')](emailProperties);
|
||||
html = Handlebars.templates['emailAccountApproved'](emailProperties);
|
||||
this.response.write(buildEmailTemplate(html));
|
||||
this.response.end();
|
||||
}
|
||||
|
|
|
@ -61,7 +61,7 @@ Meteor.startup(function () {
|
|||
|
||||
Router.route('/sign-out', {
|
||||
name: 'signOut',
|
||||
template: getTemplate('sign_out'),
|
||||
template: 'sign_out',
|
||||
onBeforeAction: function() {
|
||||
Meteor.logout(function() {
|
||||
});
|
||||
|
@ -73,7 +73,7 @@ Meteor.startup(function () {
|
|||
|
||||
Router.route('/users/:_idOrSlug', {
|
||||
name: 'user_profile',
|
||||
template: getTemplate('user_profile'),
|
||||
template: 'user_profile',
|
||||
controller: UserPageController
|
||||
});
|
||||
|
||||
|
@ -81,7 +81,7 @@ Meteor.startup(function () {
|
|||
|
||||
Router.route('/users/:slug/edit', {
|
||||
name: 'user_edit',
|
||||
template: getTemplate('user_edit'),
|
||||
template: 'user_edit',
|
||||
controller: UserEditController,
|
||||
onBeforeAction: function () {
|
||||
// Only allow users with permissions to see the user edit page.
|
||||
|
@ -91,14 +91,14 @@ Meteor.startup(function () {
|
|||
)) {
|
||||
this.next();
|
||||
} else {
|
||||
this.render(getTemplate('no_rights'));
|
||||
this.render('no_rights');
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
Router.route('/account', {
|
||||
name: 'userAccountShortcut',
|
||||
template: getTemplate('user_edit'),
|
||||
template: 'user_edit',
|
||||
controller: UserEditController
|
||||
});
|
||||
|
||||
|
@ -107,14 +107,14 @@ Meteor.startup(function () {
|
|||
Router.route('/users-dashboard', {
|
||||
controller: AdminController,
|
||||
name: 'usersDashboard'
|
||||
// template: getTemplate('users')
|
||||
// template: 'users'
|
||||
});
|
||||
|
||||
// Unsubscribe (from notifications)
|
||||
|
||||
Router.route('/unsubscribe/:hash', {
|
||||
name: 'unsubscribe',
|
||||
template: getTemplate('unsubscribe'),
|
||||
template: 'unsubscribe',
|
||||
data: function() {
|
||||
return {
|
||||
hash: this.params.hash
|
||||
|
|
|
@ -385,9 +385,11 @@ userProfileCompleteChecks.push(
|
|||
|
||||
templates = {}
|
||||
|
||||
// note: not used anymore, but keep for backwards compatibility
|
||||
getTemplate = function (name) {
|
||||
// if template has been overwritten, return this; else return template name
|
||||
return !!templates[name] ? templates[name] : name;
|
||||
return name;
|
||||
// return !!templates[name] ? templates[name] : name;
|
||||
};
|
||||
|
||||
// ------------------------------ Theme Settings ------------------------------ //
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
Meteor.startup(function () {
|
||||
|
||||
Template[getTemplate('customTemplate')].helpers({
|
||||
Template.customTemplate.helpers({
|
||||
name: function () {
|
||||
return "Bruce Willis";
|
||||
}
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
Meteor.startup(function () {
|
||||
|
||||
|
||||
Router.route('/custom-path', {
|
||||
name: 'customRoute',
|
||||
template: getTemplate('customTemplate')
|
||||
template: 'customTemplate'
|
||||
});
|
||||
|
||||
});
|
||||
});
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
<template name="postsDaily">
|
||||
<div class="grid">
|
||||
{{#each days}}
|
||||
{{> Template.dynamic template=before_day}}
|
||||
{{> beforeDay}}
|
||||
<h2 class="posts-day-heading">{{formatDate date "dddd, MMMM Do YYYY"}}</h2>
|
||||
|
||||
{{> Template.dynamic template=singleDay data=context}}
|
||||
{{> singleDay data=context}}
|
||||
|
||||
{{> Template.dynamic template=after_day}}
|
||||
{{> afterDay}}
|
||||
{{/each}}
|
||||
<a class="load-more-days-button grid-module" href="{{loadMoreDaysUrl}}"><span>{{_ "load_next_days"}}</span></a>
|
||||
</div>
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
Meteor.startup(function () {
|
||||
|
||||
Template[getTemplate('postsDaily')].helpers({
|
||||
Template.postsDaily.helpers({
|
||||
days: function () {
|
||||
var daysArray = [];
|
||||
// var days = this.days;
|
||||
|
@ -13,20 +13,11 @@ Meteor.startup(function () {
|
|||
}
|
||||
return daysArray;
|
||||
},
|
||||
before_day: function () {
|
||||
return getTemplate('beforeDay');
|
||||
},
|
||||
singleDay: function () {
|
||||
return getTemplate('singleDay');
|
||||
},
|
||||
context: function () {
|
||||
var context = this;
|
||||
context.showDateNav = false;
|
||||
return context;
|
||||
},
|
||||
after_day: function () {
|
||||
return getTemplate('afterDay');
|
||||
},
|
||||
loadMoreDaysUrl: function () {
|
||||
var count = parseInt(Session.get('postsDays')) + daysPerPage;
|
||||
return '/daily/' + count;
|
||||
|
|
|
@ -8,13 +8,13 @@ var coreSubscriptions = new SubsManager({
|
|||
PostsDailyController = RouteController.extend({
|
||||
|
||||
onBeforeAction: function () {
|
||||
this.render(getTemplate('postListTop'), {to: 'postListTop'});
|
||||
this.render('postListTop', {to: 'postListTop'});
|
||||
this.next();
|
||||
},
|
||||
|
||||
template: function() {
|
||||
// use a function to make sure the template is evaluated *after* any template overrides
|
||||
return getTemplate('postsDaily');
|
||||
return 'postsDaily';
|
||||
},
|
||||
|
||||
subscriptions: function () {
|
||||
|
|
|
@ -3,11 +3,11 @@ var htmlToText = Npm.require('html-to-text');
|
|||
|
||||
// check if server-side template has been customized, and return the correct template
|
||||
getEmailTemplate = function (template) {
|
||||
var emailTemplate = Handlebars.templates[getTemplate(template)];
|
||||
var emailTemplate = Handlebars.templates[template];
|
||||
if(typeof emailTemplate === 'function'){
|
||||
return Handlebars.templates[getTemplate(template)];
|
||||
return Handlebars.templates[template];
|
||||
} else {
|
||||
console.log('Cannot find template '+getTemplate(template)+', defaulting to '+template);
|
||||
console.log('Cannot find template '+template+', defaulting to '+template);
|
||||
return Handlebars.templates[template];
|
||||
}
|
||||
}
|
||||
|
@ -29,7 +29,7 @@ buildEmailTemplate = function (htmlContent) {
|
|||
logoWidth: Settings.get('logoWidth')
|
||||
}
|
||||
|
||||
var emailHTML = Handlebars.templates[getTemplate('emailWrapper')](emailProperties);
|
||||
var emailHTML = Handlebars.templates['emailWrapper'](emailProperties);
|
||||
|
||||
var inlinedHTML = juice(emailHTML);
|
||||
|
||||
|
|
|
@ -9,6 +9,6 @@
|
|||
<div class="post-thumbnail-empty"></div>
|
||||
{{/if}}
|
||||
{{#if media}}
|
||||
{{> UI.dynamic template=videoTemplate data=this}}
|
||||
{{> postVideo data=this}}
|
||||
{{/if}}
|
||||
</template>
|
||||
</template>
|
||||
|
|
|
@ -1,19 +1,16 @@
|
|||
Template[getTemplate('postThumbnail')].helpers({
|
||||
Template.postThumbnail.helpers({
|
||||
postLink: function () {
|
||||
return !!this.url ? getOutgoingUrl(this.url) : "/posts/"+this._id;
|
||||
},
|
||||
playVideoClass: function () {
|
||||
return !!this.media ? 'post-thumbnail-has-video': '';
|
||||
},
|
||||
videoTemplate: function () {
|
||||
return getTemplate('postVideo');
|
||||
}
|
||||
});
|
||||
|
||||
Template[getTemplate('postThumbnail')].events({
|
||||
Template.postThumbnail.events({
|
||||
'click .post-thumbnail-has-video': function (e) {
|
||||
e.preventDefault();
|
||||
$('body').addClass('showing-lightbox');
|
||||
$(e.target).parents('.post').find('.post-video-lightbox').fadeIn('fast');
|
||||
}
|
||||
})
|
||||
});
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
Template[getTemplate('postVideo')].events({
|
||||
Template.postVideo.events({
|
||||
'click .post-video-lightbox-hide, click .post-video-lightbox': function (e) {
|
||||
e.preventDefault();
|
||||
$(e.target).parents('.post').find('.post-video-lightbox').fadeOut('fast');
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
Template[getTemplate('userInvites')].created = function () {
|
||||
Template.userInvites.created = function () {
|
||||
|
||||
var user = this.data;
|
||||
var instance = this;
|
||||
|
@ -12,7 +12,7 @@ Template[getTemplate('userInvites')].created = function () {
|
|||
});
|
||||
};
|
||||
|
||||
Template[getTemplate('userInvites')].helpers({
|
||||
Template.userInvites.helpers({
|
||||
canCurrentUserInvite: function () {
|
||||
var currentUser = Meteor.user();
|
||||
return currentUser && (currentUser.inviteCount > 0 && can.invite(currentUser));
|
||||
|
|
|
@ -70,7 +70,7 @@ Meteor.methods({
|
|||
};
|
||||
|
||||
Meteor.setTimeout(function () {
|
||||
buildAndSendEmail(userEmail, emailSubject, getTemplate('emailInvite'), emailProperties);
|
||||
buildAndSendEmail(userEmail, emailSubject, 'emailInvite', emailProperties);
|
||||
}, 1);
|
||||
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
Template[getTemplate('message_item')].onCreated(function(){
|
||||
Template.message_item.onCreated(function(){
|
||||
var messageId=this.data._id;
|
||||
|
||||
Meteor.setTimeout(function(){
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<template name="messages">
|
||||
{{#each messages}}
|
||||
{{> UI.dynamic template=message_item}}
|
||||
{{> message_item}}
|
||||
{{/each}}
|
||||
</template>
|
|
@ -1,7 +1,4 @@
|
|||
Template[getTemplate('messages')].helpers({
|
||||
message_item: function () {
|
||||
return getTemplate('message_item');
|
||||
},
|
||||
Template.messages.helpers({
|
||||
messages: function(){
|
||||
return Messages.collection.find({show: true});
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
Meteor.startup(function () {
|
||||
Template[getTemplate('postShare')].helpers({
|
||||
Template.postShare.helpers({
|
||||
sourceLink: function(){
|
||||
return !!this.url ? this.url : getSiteUrl() + "posts/"+this._id;
|
||||
},
|
||||
|
@ -8,7 +8,7 @@ Meteor.startup(function () {
|
|||
}
|
||||
});
|
||||
|
||||
Template[getTemplate('postShare')].events({
|
||||
Template.postShare.events({
|
||||
'click .share-link': function(e){
|
||||
var $this = $(e.target).parents('.post-share').find('.share-link');
|
||||
var $share = $this.parents('.post-share').find('.share-options');
|
||||
|
|
|
@ -20,7 +20,7 @@ var dismissBanner = function () {
|
|||
}
|
||||
|
||||
Meteor.startup(function () {
|
||||
Template[getTemplate('newsletterBanner')].helpers({
|
||||
Template.newsletterBanner.helpers({
|
||||
siteName: function () {
|
||||
return Settings.get('title');
|
||||
},
|
||||
|
@ -44,7 +44,7 @@ Meteor.startup(function () {
|
|||
}
|
||||
});
|
||||
|
||||
Template[getTemplate('newsletterBanner')].events({
|
||||
Template.newsletterBanner.events({
|
||||
'click .newsletter-button': function (e) {
|
||||
e.preventDefault();
|
||||
var $banner = $('.newsletter-banner');
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
Template[getTemplate('notificationItem')].helpers({
|
||||
Template.notificationItem.helpers({
|
||||
properties: function(){
|
||||
return this.data;
|
||||
},
|
||||
|
@ -7,7 +7,7 @@ Template[getTemplate('notificationItem')].helpers({
|
|||
}
|
||||
});
|
||||
|
||||
Template[getTemplate('notificationItem')].events({
|
||||
Template.notificationItem.events({
|
||||
'click .action-link': function(event, instance){
|
||||
var notificationId=instance.data._id;
|
||||
Herald.collection.update(
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
Template[getTemplate('notificationsMarkAsRead')].events({
|
||||
Template.notificationsMarkAsRead.events({
|
||||
'click .mark-as-read': function(e, t){
|
||||
e.preventDefault();
|
||||
t.$('li').parents('.dropdown').removeClass('dropdown-open');
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
Template[getTemplate('notificationsMenu')].helpers({
|
||||
Template.notificationsMenu.helpers({
|
||||
menuLabel: function () {
|
||||
var notificationsCount;
|
||||
var notifications=Herald.collection.find({userId: Meteor.userId(), read: false}, {sort: {timestamp: -1}}).fetch();
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
Template[getTemplate('unsubscribe')].created = function(){
|
||||
Template.unsubscribe.created = function(){
|
||||
var hash = this.data.hash;
|
||||
Meteor.call('unsubscribeUser', hash, function(error, result){
|
||||
if(result){
|
||||
|
@ -10,7 +10,7 @@ Template[getTemplate('unsubscribe')].created = function(){
|
|||
trackEvent('notificationsUnsubcribe', {hash: hash});
|
||||
};
|
||||
|
||||
Template[getTemplate('unsubscribe')].helpers({
|
||||
Template.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)
|
||||
|
|
|
@ -88,7 +88,7 @@ Herald.addCourier('postApproved', {
|
|||
message: {
|
||||
default: function (user) {
|
||||
return Blaze.toHTML(Blaze.With(this, function () {
|
||||
return Template[getTemplate('notificationPostApproved')];
|
||||
return Template.notificationPostApproved;
|
||||
}));
|
||||
}
|
||||
},
|
||||
|
@ -137,7 +137,7 @@ Herald.addCourier('newComment', {
|
|||
message: {
|
||||
default: function (user) {
|
||||
return Blaze.toHTML(Blaze.With(this, function () {
|
||||
return Template[getTemplate('notificationNewComment')];
|
||||
return Template.notificationNewComment;
|
||||
}));
|
||||
}
|
||||
},
|
||||
|
@ -154,7 +154,7 @@ Herald.addCourier('newReply', {
|
|||
message: {
|
||||
default: function (user) {
|
||||
return Blaze.toHTML(Blaze.With(this, function () {
|
||||
return Template[getTemplate('notificationNewReply')];
|
||||
return Template.notificationNewReply;
|
||||
}));
|
||||
}
|
||||
},
|
||||
|
@ -171,7 +171,7 @@ Herald.addCourier('newCommentSubscribed', {
|
|||
message: {
|
||||
default: function (user) {
|
||||
return Blaze.toHTML(Blaze.With(this, function () {
|
||||
return Template[getTemplate('notificationNewReply')];
|
||||
return Template.notificationNewReply;
|
||||
}));
|
||||
}
|
||||
},
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
Meteor.startup(function () {
|
||||
Template[getTemplate('pageItem')].helpers({
|
||||
Template.pageItem.helpers({
|
||||
formId: function () {
|
||||
return 'updatePage-'+ this._id
|
||||
}
|
||||
});
|
||||
|
||||
Template[getTemplate('pageItem')].events({
|
||||
Template.pageItem.events({
|
||||
'click .delete-link': function(e, instance){
|
||||
e.preventDefault();
|
||||
if (confirm("Delete page?")) {
|
||||
|
|
|
@ -4,6 +4,6 @@
|
|||
{{> quickForm collection="Pages.collection" id="insertPageForm" type="insert" label-class="control-label" input-col-class="controls" template="bootstrap-horizontal"}}
|
||||
</div>
|
||||
{{#each pages}}
|
||||
{{> UI.dynamic template=pageItem}}
|
||||
{{> pageItem}}
|
||||
{{/each}}
|
||||
</template>
|
||||
|
|
|
@ -1,10 +1,7 @@
|
|||
Meteor.startup(function () {
|
||||
Template[getTemplate('pages')].helpers({
|
||||
Template.pages.helpers({
|
||||
pages: function(){
|
||||
return Pages.collection.find({}, {sort: {order: 1}});
|
||||
},
|
||||
pageItem: function () {
|
||||
return getTemplate('pageItem');
|
||||
}
|
||||
});
|
||||
});
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
Template[getTemplate("pagesMenu")].helpers({
|
||||
Template.pagesMenu.helpers({
|
||||
hasPages: function () {
|
||||
return Pages.collection.find().count()
|
||||
return Pages.collection.find().count();
|
||||
},
|
||||
pages: function () {
|
||||
return Pages.collection.find();
|
||||
}
|
||||
})
|
||||
});
|
||||
|
|
|
@ -7,7 +7,7 @@ adminMenu.push({
|
|||
Meteor.startup(function () {
|
||||
|
||||
Router.onBeforeAction(Router._filters.isAdmin, {only: ['feeds']});
|
||||
|
||||
|
||||
// RSS Urls Admin
|
||||
|
||||
Router.route('/feeds', {
|
||||
|
@ -20,7 +20,7 @@ Meteor.startup(function () {
|
|||
Meteor.subscribe('categories')
|
||||
];
|
||||
},
|
||||
// template: getTemplate('feeds')
|
||||
// template: 'feeds'
|
||||
});
|
||||
|
||||
});
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Reference in a new issue