mirror of
https://github.com/vale981/Vulcan
synced 2025-03-06 18:11:40 -05:00
adding stub for post slug update method
This commit is contained in:
parent
540b34d470
commit
405c1ed82c
3 changed files with 26 additions and 17 deletions
|
@ -5,6 +5,8 @@
|
|||
<li><a href="#" class="update-categories">Update Categories</a></li>
|
||||
<li><a href="#" class="give-invites">Give 1 Invite to Everybody</a></li>
|
||||
<li><a href="#" class="update-user-slugs">Update User Slugs</a></li>
|
||||
<li><a href="#" class="update-posts-slugs">Update Posts Slugs</a></li>
|
||||
<li><a href="#" class="update-comments-slugs">Update Comments Slugs</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
</template>
|
||||
|
|
|
@ -7,5 +7,8 @@ Template.toolbox.events= {
|
|||
} ,
|
||||
'click .update-user-slugs':function(){
|
||||
Meteor.call('updateUserSlugs');
|
||||
}
|
||||
},
|
||||
'click .update-posts-slugs':function(){
|
||||
Meteor.call('updatePostsSlugs');
|
||||
}
|
||||
}
|
|
@ -1,25 +1,29 @@
|
|||
Meteor.methods({
|
||||
updateCategories: function () {
|
||||
if(isAdmin(Meteor.user())){
|
||||
Posts.find().forEach(function(post){
|
||||
if(post.categories){
|
||||
console.log('Found categories for post "'+post.headline+'"');
|
||||
Posts.update(post._id,{$set:{userId:post.user_id}}, function(error){
|
||||
console.log(error);
|
||||
});
|
||||
}
|
||||
});
|
||||
updateCategories: function () {
|
||||
// TODO: see if this method is still necessary
|
||||
if(isAdmin(Meteor.user())){
|
||||
Posts.find().forEach(function(post){
|
||||
if(post.categories){
|
||||
console.log('Found categories for post "'+post.headline+'"');
|
||||
Posts.update(post._id,{$set:{userId:post.user_id}}, function(error){
|
||||
console.log(error);
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
},
|
||||
},
|
||||
giveInvites: function () {
|
||||
if(isAdmin(Meteor.user()))
|
||||
Meteor.users.update({}, {$inc:{invitesCount: 1}}, {multi:true});
|
||||
},
|
||||
updateUserSlugs: function () {
|
||||
if(isAdmin(Meteor.user())){
|
||||
Meteor.users.find().forEach(function(user){
|
||||
Meteor.users.update(user._id, {$set:{slug: slugify(getUserName(user))}});
|
||||
});
|
||||
}
|
||||
if(isAdmin(Meteor.user())){
|
||||
Meteor.users.find().forEach(function(user){
|
||||
Meteor.users.update(user._id, {$set:{slug: slugify(getUserName(user))}});
|
||||
});
|
||||
}
|
||||
},
|
||||
updatePostsSlugs: function () {
|
||||
//TODO
|
||||
}
|
||||
})
|
Loading…
Add table
Reference in a new issue