meteor-factory / meteor-admin

26 stars 11 forks source link

How to views are displayed in the dash? #15

Open elephant2k8 opened 8 years ago

elephant2k8 commented 8 years ago

iam trying to display the content of collection but its not working. The widget in to dash displayed 0 items in the collection, and the views option in the lateral nav only let to add new object to the collection. In the browser console Groups.find().fetch() returns all the groups there are in the data base. My code: admin.js: Admin.collections.add('Groups', { collection: Groups, icon: 'cubes', columns : [ {data: "title", title: "Title"}, {data: "author()", title: "Author"} ] }); Groups.js Groups = new Mongo.Collection('groups');

Groups.attachSchema(new SimpleSchema({

title: {
  type: String,
  max: 80
},

. . . );

Groups.helpers({ author: function(){ var user = Meteor.users.find().fetch(); if(user.profile.firstName && user.profile.lastName){ return user.profile.firstName + ' ' + user.profile.lastName; } else { return user.emails[0].address; } } });

Sorry for my english :D