我有一个名为Academics的系列。每个学者最多可以有两名顾问,他们也在Academics系列中。
我正在使用yogiben:admin插件用于我的管理员后端,但是顾问字段(我称之为'advisor1.who',请参阅下面的模式)不能正常工作我想要/期望 - 如果我编辑一个学术上,他们顾问下拉的唯一选择是我正在编辑的学术。
我也在使用Mongol,当我进入管理方面时,如果我列出所有学术,那么只有当前列出的10个可以在Mongol中查看,当我编辑单个学术时,只有该学术可用于蒙古人。当我在meteor-admin中编辑个人时,如何使Academics集合中的所有文档都可用?
这是我的插件列表,对这个问题有影响的插件都是最新的:
apt-get purge apache2
apt-get install apache2
和架构的相关部分(在coffeescript中):
accounts-password 1.1.1 Password support for accounts
accounts-ui 1.1.5 Simple templates to add login widgets to an app
alanning:roles 1.2.13 Role-based authorization
aldeed:autoform 5.3.0 Easily create forms with automatic insert and update, and auto...
aldeed:autoform-select2 1.0.5* Custom select2 input type for AutoForm
aldeed:collection2 2.3.3 Automatic validation of insert and update operations on the cl...
coffeescript 1.0.6 Javascript dialect with fewer braces and semicolons
dburles:collection-helpers 1.0.3 Transform your collections with helpers that you define
email 1.0.6 Send email messages
fortawesome:fontawesome 4.3.0 Font Awesome (official): 500+ scalable vector icons, customiza...
iron:router 1.0.9 Routing specifically designed for Meteor
joshowens:accounts-entry 1.0.3 Make signin and signout their own pages with routes.
meteor-platform 1.2.2 Include a standard set of Meteor packages in your app
meteorhacks:fast-render 2.4.0* Render you app even before the DDP connection comes live. - ma...
meteorhacks:subs-manager 1.3.0* Subscriptions Manager for Meteor
mizzao:autocomplete 0.5.1 Client/server autocompletion designed for Meteor's collections...
msavin:mongol 0.6.5* The insanely handy development package for Meteor.
twbs:bootstrap 3.3.4* The most popular front-end framework for developing responsive...
underscore 1.0.3 Collection of small helpers: _.map, _.each, ...
yogiben:admin 1.2.0 A complete admin dashboard solution
yogiben:autoform-modals 0.3.5* Create, update and delete collections with modals
这似乎应该可行,因为它非常接近插件自述文件的代码(它返回了作为潜在所有者的流星用户列表):
Schemas.Academics = new SimpleSchema
// other fields that work just fine are here...
advisor1:
type: Object
optional: true
'advisor1.who':
type: String
regEx: SimpleSchema.RegEx.Id
optional: true
autoform:
options: ->
_.map(Academics.find({}).fetch(), (academics)->
label: academics.name
value: academics._id
)
和admin config:
owner: {
type: String,
regEx: SimpleSchema.RegEx.Id,
autoValue: function () {
if (this.isInsert) {
return Meteor.userId();
}
},
autoform: {
options: function () {
_.map(Meteor.users.find().fetch(), function (user) {
return {
label: user.emails[0].address,
value: user._id
};
});
}
}
我还能添加其他任何有用的内容吗?
答案 0 :(得分:1)
我的问题最终是我正在使用meteorhacks:subs-manager在我的路线中添加订阅。因此,管理包无法为我需要的所有其他学者提取订阅。一旦我在顶级客户端文件夹中添加订阅,一切都很好。 Jamgold在流星论坛上向我指出了这个方向 - 所以感谢jamgold!