Vulcan/client/views/admin/toolbox.js

17 lines
434 B
JavaScript
Raw Normal View History

2013-04-05 12:22:00 +09:00
Template.toolbox.events= {
'click .update-categories':function(){
var posts=Posts.find().fetch();
$.each(posts, function(index, element){
2013-04-05 12:22:00 +09:00
if(element.categories){
console.log('Found categories for post "'+element.headline+'"');
$.each(element.categories)
Posts.update(element._id,{$set:{userId:element.user_id}}, function(error){
console.log(error);
});
2013-04-05 12:22:00 +09:00
console.log(element);
}
2013-04-05 12:22:00 +09:00
});
}
}