mirror of
https://github.com/vale981/Vulcan
synced 2025-03-07 02:21:43 -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”
|
## v0.8 “BlazeScope”
|
||||||
|
|
||||||
* Updated for Meteor 0.8.1.1/Blaze compatibility.
|
* Updated for Meteor 0.8.1.1/Blaze compatibility.
|
||||||
|
|
|
@ -28,9 +28,4 @@ Template.layout.rendered = function(){
|
||||||
$('body').scrollTop(currentScroll);
|
$('body').scrollTop(currentScroll);
|
||||||
Session.set('currentScroll', null);
|
Session.set('currentScroll', null);
|
||||||
}
|
}
|
||||||
|
|
||||||
// set title
|
|
||||||
var title = getSetting("title");
|
|
||||||
var tagline = getSetting("tagline");
|
|
||||||
document.title = (tagline ? title+': '+tagline : title) || "";
|
|
||||||
}
|
}
|
|
@ -42,7 +42,13 @@
|
||||||
| <a href="/posts/{{_id}}/edit" class="edit-link goto-edit">Edit</a>
|
| <a href="/posts/{{_id}}/edit" class="edit-link goto-edit">Edit</a>
|
||||||
{{/if}}
|
{{/if}}
|
||||||
{{#if currentUser.isAdmin}}
|
{{#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}}
|
{{/if}}
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -75,6 +75,9 @@ Template.post_item.helpers({
|
||||||
},
|
},
|
||||||
pointsUnitDisplayText: function(){
|
pointsUnitDisplayText: function(){
|
||||||
return this.upvotes == 1 ? i18n.t('point') : i18n.t('points');
|
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");
|
$this.toggleClass("active");
|
||||||
$share.toggleClass("hidden");
|
$share.toggleClass("hidden");
|
||||||
$share.find('.share-replace').sharrre(SharrreOptions);
|
$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){
|
post_edit: function(post){
|
||||||
// TODO: make post_edit server-side?
|
// 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){
|
clickedPost: function(post, sessionId){
|
||||||
// only let clients increment a post's click counter once per session
|
// only let clients increment a post's click counter once per session
|
||||||
var click = {_id: post._id, sessionId: sessionId};
|
var click = {_id: post._id, sessionId: sessionId};
|
||||||
|
|
|
@ -102,7 +102,12 @@ Router.configure({
|
||||||
notFoundTemplate: 'not_found',
|
notFoundTemplate: 'not_found',
|
||||||
waitOn: function () {
|
waitOn: function () {
|
||||||
return _.map(preloadSubscriptions, function(sub){
|
return _.map(preloadSubscriptions, function(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);
|
Meteor.subscribe(sub);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -153,17 +158,20 @@ Router._filters = {
|
||||||
},
|
},
|
||||||
|
|
||||||
canView: function(pause) {
|
canView: function(pause) {
|
||||||
if(!this.ready()) return;
|
if(!this.ready() || Meteor.loggingIn()){
|
||||||
if(!canView()){
|
this.render('loading');
|
||||||
console.log('cannot view');
|
pause();
|
||||||
|
}else if (!canView()) {
|
||||||
this.render('no_rights');
|
this.render('no_rights');
|
||||||
pause();
|
pause();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
canPost: function (pause) {
|
canPost: function (pause) {
|
||||||
if(!this.ready()) return;
|
if(!this.ready() || Meteor.loggingIn()){
|
||||||
if(!canPost()){
|
this.render('loading');
|
||||||
|
pause();
|
||||||
|
}else if(!canPost()){
|
||||||
throwError(i18n.t("Sorry, you don't have permissions to add new items."));
|
throwError(i18n.t("Sorry, you don't have permissions to add new items."));
|
||||||
this.render('no_rights');
|
this.render('no_rights');
|
||||||
pause();
|
pause();
|
||||||
|
@ -199,6 +207,13 @@ Router._filters = {
|
||||||
this.render('user_email');
|
this.render('user_email');
|
||||||
pause();
|
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
|
// After Hooks
|
||||||
|
|
||||||
Router.onAfterAction(filters.resetScroll, {except:['posts_top', 'posts_new', 'posts_best', 'posts_pending', 'posts_category', 'all-users']});
|
Router.onAfterAction(filters.resetScroll, {except:['posts_top', 'posts_new', 'posts_best', 'posts_pending', 'posts_category', 'all-users']});
|
||||||
Router.onAfterAction( function () {
|
Router.onAfterAction(analyticsInit); // will only run once thanks to _.once()
|
||||||
analyticsInit(); // will only run once thanks to _.once()
|
Router.onAfterAction(analyticsRequest); // log this request with mixpanel, etc
|
||||||
analyticsRequest(); // log this request with mixpanel, etc
|
Router.onAfterAction(filters.setTitle);
|
||||||
});
|
|
||||||
|
|
||||||
// Unload Hooks
|
// Unload Hooks
|
||||||
|
|
||||||
|
|
|
@ -15,7 +15,11 @@ adminUsers = function(){
|
||||||
return Meteor.users.find({isAdmin : true}).fetch();
|
return Meteor.users.find({isAdmin : true}).fetch();
|
||||||
};
|
};
|
||||||
getUserName = function(user){
|
getUserName = function(user){
|
||||||
|
if (user.username)
|
||||||
return user.username;
|
return user.username;
|
||||||
|
if (user.services.twitter && user.services.twitter.screenName)
|
||||||
|
return user.services.twitter.screenName
|
||||||
|
return null;
|
||||||
};
|
};
|
||||||
getDisplayName = function(user){
|
getDisplayName = function(user){
|
||||||
return (user.profile && user.profile.name) ? user.profile.name : user.username;
|
return (user.profile && user.profile.name) ? user.profile.name : user.username;
|
||||||
|
@ -66,7 +70,7 @@ getEmail = function(user){
|
||||||
if(user.profile && user.profile.email){
|
if(user.profile && user.profile.email){
|
||||||
return user.profile.email;
|
return user.profile.email;
|
||||||
}else{
|
}else{
|
||||||
return '';
|
return null;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
getAvatarUrl = function(user){
|
getAvatarUrl = function(user){
|
||||||
|
|
|
@ -94,7 +94,7 @@ Meteor.publish('allUsers', function(filterBy, sortBy, limit) {
|
||||||
|
|
||||||
Meteor.publish('allUsersAdmin', function() {
|
Meteor.publish('allUsersAdmin', function() {
|
||||||
if (isAdminById(this.userId)) {
|
if (isAdminById(this.userId)) {
|
||||||
return Meteor.users.find();
|
return Meteor.users.find({isInvited: true});
|
||||||
} else {
|
} else {
|
||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue