Closed ritchieng closed 8 years ago
Hey @ritchieng
We are going to provide access to the raw collection with v1 to allow this.
Christian
As of 1.0 you have access to the underlying comments collection, see https://github.com/ARKHAM-Enterprises/meteor-comments-ui#event-hooks
Hi matteodam, are you able to brief on how do we go about to implement this for admin to be able to edit/remove all comments?
you could use the raw collection instance (Comments.getCollection()
with a custom built UI or one of the admin packages that's out there, for exampel hosuton and add the collection there with the provided method: https://atmospherejs.com/houston/admin
How about for a case for Yogiben using AdminConfig?
I tried accessing the schema for CommentsCollection but there's an error where I can't access CommentsCollection's scheme defined in your package.
Thanks!
Can you please show me the errors and some of your code related to it?
This is my admin configuration:
AdminConfig = {
skin: 'red-light',
name: 'Admin',
collections: {
Profiles: {
icon: 'file-text-o',
tableColumns: [
{label: 'ID', name: '_id'},
{label: 'Title', name: 'title'},
{label: 'Email', name: 'userName'},
{label: 'Company', name:'company'},
{label: 'Status', name: 'status'}
],
color: 'green'
},
CommentsCollection: {
icon: 'comment',
tableColumns: [
{ label: 'Content', name: 'content' },
{ label: 'User', name: 'owner', template: 'userEmail' }
],
color: 'red'
}
},
autoForm:{
omitFields: ['createdAt','updatedAt']
}
};
This is the error showing undefined object global:
W20160309-13:28:40.497(1)? (STDERR) throw(ex);
W20160309-13:28:40.497(1)? (STDERR) ^
W20160309-13:28:40.541(1)? (STDERR) Error: CommentsCollection is not in the [object global]
I don't know how to use these admin packages, please refer to the package itself if you have problems.
No problem. I found a solution for anyone using with the popular yogiben.
If anyone wants a fix. Within the admin.js file (or wherever you placed your admin configuration code from Yogiben):
Reviews = Comments.getCollection();
Configure your admin panel to display the fields Reviews: {
icon: 'comment',
tableColumns: [
{label: 'Comment ID', name: '_id'},
{label: 'User ID', name: 'userId'},
{label: 'Username', name: 'user'},
{label: 'Review', name: 'content'}
],
A note: I'm unable to display the username at the moment unfortunately. It has to do with the schema and your accounts configuration. I'll post an update if I have a fix to that. But this will enable you to delete or add comments in Yogiben!
Hi,
May I know if the admin can have access to delete any comments? Currently only users are able to delete their own comments.
Thanks.