forked from yogiben/meteor-admin
-
Notifications
You must be signed in to change notification settings - Fork 2
Open
Description
There was a problem with the display of collections in the table, I do not yet understand how to solve it.
/imports/collections/posts.js
import SimpleSchema from 'simpl-schema';
console.log('import post file');
SimpleSchema.extendOptions(['autoform']);
Posts = new Meteor.Collection('posts');
Posts.attachSchema(new SimpleSchema({
title: {
type: String,
max: 60
},
content: {
type: String,
autoform: {
rows: 5
}
},
createdAt: {
type: Date,
label: 'Date',
autoValue: function() {
if (this.isInsert) {
return new Date();
}
}
},
owner: {
type: String,
regEx: SimpleSchema.RegEx.Id,
autoValue: function() {
if (this.isInsert) {
return Meteor.userId();
}
},
autoform: {
options: function() {
return _.map(Meteor.users.find().fetch(), function(user) {
return {
label: user.emails[0].address,
value: user._id
};
});
}
}
}
}));
Posts.helpers({
postTitle: function() {
if (this.post) {
return Posts.findOne(this.post).title;
}
}
});
export default Posts;
/server/collections/posts.js
import Posts from '/imports/collections/posts';
Meteor.publish('posts', function () {
return Posts.find();
});
/both/admin.js
import Pages from '/imports/collections/pages'
import Posts from '/imports/collections/posts'
AdminConfig = {
name: 'Rudenko',
adminEmails: ['kirpich634@gmail.com'],
nonAdminRedirectRoute: 'main',
collections: {
Pages: {
icon: 'pencil',
omitFields: ['owner'],
tableColumns: [
{
label: 'Content',
name: 'content'
}, {
label: 'User',
name: 'owner',
template: 'userEmail'
}
]
},
Posts: {
icon: 'pencil',
omitFields: ['owner'],
tableColumns: [
{
label: 'Content',
name: 'content'
}, {
label: 'User',
name: 'owner',
template: 'userEmail'
}
]
},
},
autoForm: {
omitFields: ['createdAt', 'updatedAt']
},
dashboard: {
homeUrl: '/dashboard',
widgets: [
{
template: 'adminCollectionWidget',
data: {
collection: 'Posts',
"class": 'col-lg-3 col-xs-6'
}
}, {
template: 'adminUserWidget',
data: {
"class": 'col-lg-3 col-xs-6'
}
}
]
}
};
Meteor packages used by this project
meteor-base@1.1.0 # Packages every Meteor app needs to have
mobile-experience@1.0.4 # Packages for a great mobile UX
mongo@1.2.0 # The database Meteor supports right now
blaze-html-templates@1.0.4 # Compile .html files into Meteor Blaze views
reactive-var@1.0.11 # Reactive variable for tracker
tracker@1.1.3 # Meteor's client-side reactive programming library
standard-minifier-css@1.3.4 # CSS minifier run for production mode
standard-minifier-js@2.1.1 # JS minifier run for production mode
es5-shim@4.6.15 # ECMAScript 5 compatibility for older browsers
ecmascript@0.8.2 # Enable ECMAScript2015+ syntax in app code
shell-server@0.2.4 # Server-side component of the `meteor shell` command
insecure@1.0.7 # Allow all DB writes from clients (for prototyping)
fourseven:scss
accounts-base@1.3.2
accounts-password@1.4.0
nolimits4web:swiper
dburles:google-maps
iron:router
dburles:collection-helpers
alanning:roles
ignacy130:yadmin
aldeed:collection2-core
session
aldeed:autoform
fortawesome:fontawesome
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels

