diff --git a/.meteor/release b/.meteor/release index 5ee5d6a2f..db5f2c74b 100644 --- a/.meteor/release +++ b/.meteor/release @@ -1 +1 @@ -0.8.1.1 +0.8.1.3 diff --git a/History.md b/History.md index 2c5f959cb..e8faa926f 100644 --- a/History.md +++ b/History.md @@ -1,3 +1,9 @@ +## v0.8.1 “FlexScope” + +* Extracted part of the tags feature into its own package. +* Made subscription preloader more flexible. +* Made navigation menu dynamic. + ## v0.8 “BlazeScope” * Updated for Meteor 0.8.1.1/Blaze compatibility. diff --git a/client/views/common/layout.js b/client/views/common/layout.js index 4623435c1..55e675acc 100644 --- a/client/views/common/layout.js +++ b/client/views/common/layout.js @@ -24,13 +24,8 @@ Template.layout.created = function(){ } Template.layout.rendered = function(){ - if(currentScroll=Session.get('currentScroll')){ - $('body').scrollTop(currentScroll); - Session.set('currentScroll', null); - } - - // set title - var title = getSetting("title"); - var tagline = getSetting("tagline"); - document.title = (tagline ? title+': '+tagline : title) || ""; -} + if(currentScroll=Session.get('currentScroll')){ + $('body').scrollTop(currentScroll); + Session.set('currentScroll', null); + } +} \ No newline at end of file diff --git a/client/views/posts/post_item.html b/client/views/posts/post_item.html index edb13b864..c441ef5fc 100644 --- a/client/views/posts/post_item.html +++ b/client/views/posts/post_item.html @@ -42,7 +42,13 @@ | Edit {{/if}} {{#if currentUser.isAdmin}} - | {{i18n "status"}}: {{status}}, {{i18n "votes"}}: {{upvotes}}, {{i18n "baseScore"}}: {{baseScore}}, {{i18n "score"}}: {{short_score}}, {{i18n "clicks"}}: {{clicks}} + | + {{#if isApproved}} + Unapprove + {{else}} + Approve + {{/if}} + | {{i18n "score"}}: {{short_score}}, {{i18n "clicks"}}: {{clicks}} {{/if}}

diff --git a/client/views/posts/post_item.js b/client/views/posts/post_item.js index c431453c4..cbd0e8862 100644 --- a/client/views/posts/post_item.js +++ b/client/views/posts/post_item.js @@ -75,6 +75,9 @@ Template.post_item.helpers({ }, pointsUnitDisplayText: function(){ return this.upvotes == 1 ? i18n.t('point') : i18n.t('points'); + }, + isApproved: function(){ + return this.status == STATUS_APPROVED; } }); @@ -132,5 +135,13 @@ Template.post_item.events({ $this.toggleClass("active"); $share.toggleClass("hidden"); $share.find('.share-replace').sharrre(SharrreOptions); + }, + 'click .approve-link': function(e, instance){ + Meteor.call('approvePost', this); + e.preventDefault(); + }, + 'click .unapprove-link': function(e, instance){ + Meteor.call('unapprovePost', this); + e.preventDefault(); } }); \ No newline at end of file diff --git a/collections/posts.js b/collections/posts.js index f7b5cdc08..a7cdab886 100644 --- a/collections/posts.js +++ b/collections/posts.js @@ -203,6 +203,21 @@ Meteor.methods({ post_edit: function(post){ // TODO: make post_edit server-side? }, + approvePost: function(post){ + if(isAdmin(Meteor.user())){ + var now = new Date().getTime(); + Posts.update(post._id, {$set: {status: 2, submitted: now}}); + }else{ + throwError('You need to be an admin to do that.'); + } + }, + unapprovePost: function(post){ + if(isAdmin(Meteor.user())){ + Posts.update(post._id, {$set: {status: 1}}); + }else{ + throwError('You need to be an admin to do that.'); + } + }, clickedPost: function(post, sessionId){ // only let clients increment a post's click counter once per session var click = {_id: post._id, sessionId: sessionId}; diff --git a/lib/router.js b/lib/router.js index 7f1e6f011..9795e1dfb 100644 --- a/lib/router.js +++ b/lib/router.js @@ -102,7 +102,12 @@ Router.configure({ notFoundTemplate: 'not_found', waitOn: function () { return _.map(preloadSubscriptions, function(sub){ - Meteor.subscribe(sub); + // can either pass strings or objects with subName and subArguments properties + if (typeof sub === 'object'){ + Meteor.subscribe(sub.subName, sub.subArguments); + }else{ + Meteor.subscribe(sub); + } }); } }); @@ -153,17 +158,20 @@ Router._filters = { }, canView: function(pause) { - if(!this.ready()) return; - if(!canView()){ - console.log('cannot view'); + if(!this.ready() || Meteor.loggingIn()){ + this.render('loading'); + pause(); + }else if (!canView()) { this.render('no_rights'); pause(); } }, canPost: function (pause) { - if(!this.ready()) return; - if(!canPost()){ + if(!this.ready() || Meteor.loggingIn()){ + this.render('loading'); + pause(); + }else if(!canPost()){ throwError(i18n.t("Sorry, you don't have permissions to add new items.")); this.render('no_rights'); pause(); @@ -199,6 +207,13 @@ Router._filters = { this.render('user_email'); pause(); } + }, + + setTitle: function() { + // set title + var title = getSetting("title"); + var tagline = getSetting("tagline"); + document.title = (tagline ? title+': '+tagline : title) || ""; } }; @@ -236,10 +251,9 @@ if(Meteor.isClient){ // After Hooks Router.onAfterAction(filters.resetScroll, {except:['posts_top', 'posts_new', 'posts_best', 'posts_pending', 'posts_category', 'all-users']}); - Router.onAfterAction( function () { - analyticsInit(); // will only run once thanks to _.once() - analyticsRequest(); // log this request with mixpanel, etc - }); + Router.onAfterAction(analyticsInit); // will only run once thanks to _.once() + Router.onAfterAction(analyticsRequest); // log this request with mixpanel, etc + Router.onAfterAction(filters.setTitle); // Unload Hooks diff --git a/lib/users.js b/lib/users.js index 8e33813c5..5f4a01ca8 100644 --- a/lib/users.js +++ b/lib/users.js @@ -15,7 +15,11 @@ adminUsers = function(){ return Meteor.users.find({isAdmin : true}).fetch(); }; getUserName = function(user){ - return user.username; + if (user.username) + return user.username; + if (user.services.twitter && user.services.twitter.screenName) + return user.services.twitter.screenName + return null; }; getDisplayName = function(user){ return (user.profile && user.profile.name) ? user.profile.name : user.username; @@ -66,7 +70,7 @@ getEmail = function(user){ if(user.profile && user.profile.email){ return user.profile.email; }else{ - return ''; + return null; } }; getAvatarUrl = function(user){ diff --git a/server/publications.js b/server/publications.js index 3acdc78b2..12ee70ccb 100644 --- a/server/publications.js +++ b/server/publications.js @@ -94,7 +94,7 @@ Meteor.publish('allUsers', function(filterBy, sortBy, limit) { Meteor.publish('allUsersAdmin', function() { if (isAdminById(this.userId)) { - return Meteor.users.find(); + return Meteor.users.find({isInvited: true}); } else { return []; }