mirror of
https://github.com/vale981/Vulcan
synced 2025-03-08 19:11:38 -05:00
Merge branch 'subs-manager' of github.com:arunoda/Telescope into arunoda-subs-manager
This commit is contained in:
commit
2fdd0614d9
5 changed files with 50 additions and 38 deletions
|
@ -33,3 +33,4 @@ marked
|
|||
bootstrap3-datepicker
|
||||
telescope-theme-hubble
|
||||
telescope-module-share
|
||||
subs-manager
|
||||
|
|
|
@ -153,7 +153,7 @@ Router._filters = {
|
|||
if(!this.ready()) return;
|
||||
if(!isAdmin()){
|
||||
this.render('no_rights');
|
||||
pause();
|
||||
pause();
|
||||
}
|
||||
},
|
||||
|
||||
|
@ -174,7 +174,7 @@ Router._filters = {
|
|||
}else if(!canPost()){
|
||||
throwError(i18n.t("Sorry, you don't have permissions to add new items."));
|
||||
this.render('no_rights');
|
||||
pause();
|
||||
pause();
|
||||
}
|
||||
},
|
||||
|
||||
|
@ -207,7 +207,7 @@ Router._filters = {
|
|||
this.render('user_email');
|
||||
pause();
|
||||
}
|
||||
},
|
||||
},
|
||||
|
||||
setTitle: function() {
|
||||
// set title
|
||||
|
@ -218,7 +218,13 @@ Router._filters = {
|
|||
|
||||
};
|
||||
|
||||
var filters = Router._filters;
|
||||
var filters = Router._filters;
|
||||
var coreSubscriptions = new SubsManager({
|
||||
// cache recent 50 subscriptions
|
||||
cacheLimit: 50,
|
||||
// expire any subscription after 30 minutes
|
||||
expireIn: 30
|
||||
});
|
||||
|
||||
if(Meteor.isClient){
|
||||
|
||||
|
@ -284,8 +290,8 @@ PostsListController = FastRender.RouteController.extend({
|
|||
}
|
||||
|
||||
return [
|
||||
Meteor.subscribe('postsList', this._terms),
|
||||
Meteor.subscribe('postsListUsers', this._terms)
|
||||
coreSubscriptions.subscribe('postsList', this._terms),
|
||||
coreSubscriptions.subscribe('postsListUsers', this._terms)
|
||||
];
|
||||
},
|
||||
data: function () {
|
||||
|
@ -302,7 +308,7 @@ PostsListController = FastRender.RouteController.extend({
|
|||
var parameters = getParameters(this._terms),
|
||||
posts = Posts.find(parameters.find, parameters.options);
|
||||
postsCount = posts.count();
|
||||
|
||||
|
||||
Session.set('postsLimit', this._terms.limit);
|
||||
|
||||
return {
|
||||
|
@ -313,7 +319,7 @@ PostsListController = FastRender.RouteController.extend({
|
|||
onAfterAction: function() {
|
||||
var view = this.path == '/' ? 'top' : this.path.split('/')[1];
|
||||
Session.set('view', view);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
// Controller for post digest
|
||||
|
@ -329,8 +335,8 @@ PostsDigestController = FastRender.RouteController.extend({
|
|||
before: moment(currentDate).endOf('day').toDate()
|
||||
};
|
||||
return [
|
||||
Meteor.subscribe('postsList', terms),
|
||||
Meteor.subscribe('postsListUsers', terms)
|
||||
coreSubscriptions.subscribe('postsList', terms),
|
||||
coreSubscriptions.subscribe('postsListUsers', terms)
|
||||
];
|
||||
},
|
||||
data: function() {
|
||||
|
@ -351,30 +357,27 @@ PostsDigestController = FastRender.RouteController.extend({
|
|||
// Controller for post pages
|
||||
|
||||
PostPageController = FastRender.RouteController.extend({
|
||||
loadSubscriptions: function() {
|
||||
this.postSubscription = Meteor.subscribe('singlePost', this.params._id);
|
||||
this.commentSubscription = Meteor.subscribe('postComments', this.params._id);
|
||||
this.postUsersSubscription = Meteor.subscribe('postUsers', this.params._id);
|
||||
waitOn: function() {
|
||||
return [
|
||||
coreSubscriptions.subscribe('singlePost', this.params._id),
|
||||
coreSubscriptions.subscribe('postComments', this.params._id),
|
||||
coreSubscriptions.subscribe('postUsers', this.params._id)
|
||||
];
|
||||
},
|
||||
|
||||
post: function() {
|
||||
return Posts.findOne(this.params._id);
|
||||
},
|
||||
|
||||
|
||||
onBeforeAction: function(pause) {
|
||||
this.loadSubscriptions();
|
||||
|
||||
if (! this.post()) {
|
||||
if (this.postSubscription.ready()) {
|
||||
this.render('notFound');
|
||||
if (this.ready()) {
|
||||
if(!this.post()) {
|
||||
this.render('not_found');
|
||||
return pause();
|
||||
}
|
||||
|
||||
this.render('loading');
|
||||
pause();
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
data: function() {
|
||||
return this.post();
|
||||
}
|
||||
|
@ -386,9 +389,9 @@ PostPageController = FastRender.RouteController.extend({
|
|||
CommentPageController = FastRender.RouteController.extend({
|
||||
waitOn: function() {
|
||||
return [
|
||||
Meteor.subscribe('singleComment', this.params._id),
|
||||
Meteor.subscribe('commentUser', this.params._id),
|
||||
Meteor.subscribe('commentPost', this.params._id)
|
||||
coreSubscriptions.subscribe('singleComment', this.params._id),
|
||||
coreSubscriptions.subscribe('commentUser', this.params._id),
|
||||
coreSubscriptions.subscribe('commentPost', this.params._id)
|
||||
];
|
||||
},
|
||||
data: function() {
|
||||
|
@ -398,14 +401,14 @@ CommentPageController = FastRender.RouteController.extend({
|
|||
},
|
||||
onAfterAction: function () {
|
||||
window.queueComments = false;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
// Controller for user pages
|
||||
|
||||
UserPageController = FastRender.RouteController.extend({
|
||||
waitOn: function() {
|
||||
return Meteor.subscribe('singleUser', this.params._idOrSlug);
|
||||
return coreSubscriptions.subscribe('singleUser', this.params._idOrSlug);
|
||||
},
|
||||
data: function() {
|
||||
var findById = Meteor.users.findOne(this.params._idOrSlug);
|
||||
|
@ -450,8 +453,8 @@ Router.map(function() {
|
|||
}
|
||||
|
||||
return [
|
||||
Meteor.subscribe('postsList', this._terms),
|
||||
Meteor.subscribe('postsListUsers', this._terms)
|
||||
coreSubscriptions.subscribe('postsList', this._terms),
|
||||
coreSubscriptions.subscribe('postsListUsers', this._terms)
|
||||
];
|
||||
},
|
||||
controller: PostsListController
|
||||
|
@ -494,7 +497,7 @@ Router.map(function() {
|
|||
path: '/digest/:year/:month/:day',
|
||||
controller: PostsDigestController
|
||||
});
|
||||
|
||||
|
||||
this.route('posts_digest', {
|
||||
path: '/digest',
|
||||
controller: PostsDigestController
|
||||
|
@ -524,7 +527,7 @@ Router.map(function() {
|
|||
template: getTemplate('post_edit'),
|
||||
path: '/posts/:_id/edit',
|
||||
waitOn: function () {
|
||||
return Meteor.subscribe('singlePost', this.params._id);
|
||||
return coreSubscriptions.subscribe('singlePost', this.params._id);
|
||||
},
|
||||
data: function() {
|
||||
return {
|
||||
|
@ -606,7 +609,7 @@ Router.map(function() {
|
|||
path: '/all-users/:limit?',
|
||||
waitOn: function() {
|
||||
var limit = parseInt(this.params.limit) || 20;
|
||||
return Meteor.subscribe('allUsers', this.params.filterBy, this.params.sortBy, limit);
|
||||
return coreSubscriptions.subscribe('allUsers', this.params.filterBy, this.params.sortBy, limit);
|
||||
},
|
||||
data: function() {
|
||||
var limit = parseInt(this.params.limit) || 20,
|
||||
|
@ -649,7 +652,7 @@ Router.map(function() {
|
|||
|
||||
// -------------------------------------------- Other -------------------------------------------- //
|
||||
|
||||
|
||||
|
||||
|
||||
// Settings
|
||||
|
||||
|
@ -700,7 +703,7 @@ Router.map(function() {
|
|||
});
|
||||
|
||||
// adding common subscriptions that's need to be loaded on all the routes
|
||||
// notification does not included here since it is not much critical and
|
||||
// notification does not included here since it is not much critical and
|
||||
// it might have considerable amount of docs
|
||||
if(Meteor.isServer) {
|
||||
FastRender.onAllRoutes(function() {
|
||||
|
|
1
packages/.gitignore
vendored
1
packages/.gitignore
vendored
|
@ -26,3 +26,4 @@ i18next-meteor
|
|||
/jquery-hotkeys
|
||||
/marked
|
||||
/bootstrap3-datepicker
|
||||
/subs-manager
|
||||
|
|
|
@ -10,6 +10,7 @@
|
|||
"autoform": {},
|
||||
"jquery-hotkeys": {},
|
||||
"marked": {},
|
||||
"bootstrap3-datepicker": {}
|
||||
"bootstrap3-datepicker": {},
|
||||
"subs-manager": {}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -11,7 +11,8 @@
|
|||
"autoform": {},
|
||||
"jquery-hotkeys": {},
|
||||
"marked": {},
|
||||
"bootstrap3-datepicker": {}
|
||||
"bootstrap3-datepicker": {},
|
||||
"subs-manager": {}
|
||||
},
|
||||
"packages": {
|
||||
"momentjs": {
|
||||
|
@ -64,6 +65,11 @@
|
|||
"tag": "v0.2.1",
|
||||
"commit": "442484eb1c8eb00c6b9e0e9c88accc934cf8f04a"
|
||||
},
|
||||
"subs-manager": {
|
||||
"git": "https://github.com/meteorhacks/subs-manager.git",
|
||||
"tag": "v1.0.1",
|
||||
"commit": "38317052d1601002d4dff537e4e0f61d1aa36e6d"
|
||||
},
|
||||
"blaze-layout": {
|
||||
"git": "https://github.com/EventedMind/blaze-layout.git",
|
||||
"tag": "v0.2.4",
|
||||
|
|
Loading…
Add table
Reference in a new issue