mirror of
https://github.com/vale981/Vulcan
synced 2025-03-06 10:01:40 -05:00
Merge branch 'master' into autoform
Conflicts: client/views/posts/post_item.html client/views/posts/post_item.js
This commit is contained in:
commit
ae0cf36819
9 changed files with 76 additions and 25 deletions
|
@ -1 +1 @@
|
|||
0.8.1.1
|
||||
0.8.1.3
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
|
@ -42,7 +42,13 @@
|
|||
| <a href="/posts/{{_id}}/edit" class="edit-link goto-edit">Edit</a>
|
||||
{{/if}}
|
||||
{{#if currentUser.isAdmin}}
|
||||
| {{i18n "status"}}: {{status}}, {{i18n "votes"}}: {{upvotes}}, {{i18n "baseScore"}}: {{baseScore}}, {{i18n "score"}}: {{short_score}}, {{i18n "clicks"}}: {{clicks}}
|
||||
|
|
||||
{{#if isApproved}}
|
||||
<a href="#" class="unapprove-link goto-edit">Unapprove</a>
|
||||
{{else}}
|
||||
<a href="#" class="approve-link goto-edit">Approve</a>
|
||||
{{/if}}
|
||||
| {{i18n "score"}}: {{short_score}}, {{i18n "clicks"}}: {{clicks}}
|
||||
{{/if}}
|
||||
</p>
|
||||
</div>
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
});
|
|
@ -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};
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -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){
|
||||
|
|
|
@ -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 [];
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue