2015-04-22 07:50:11 +09:00
|
|
|
// ------------------------------------- Schemas -------------------------------- //
|
|
|
|
|
|
|
|
|
|
|
|
SimpleSchema.extendOptions({
|
2015-04-25 12:39:07 +09:00
|
|
|
private: Match.Optional(Boolean),
|
2015-04-22 07:50:11 +09:00
|
|
|
editable: Match.Optional(Boolean), // editable: true means the field can be edited by the document's owner
|
2015-04-25 12:39:07 +09:00
|
|
|
hidden: Match.Optional(Boolean), // hidden: true means the field is never shown in a form no matter what
|
2015-04-27 17:15:16 +09:00
|
|
|
editableBy: Match.Optional([String]),
|
2015-05-06 12:56:59 +09:00
|
|
|
publishedTo: Match.Optional([String]),
|
2015-05-16 12:34:50 +09:00
|
|
|
required: Match.Optional(Boolean), // required: true means the field is required to have a complete profile
|
2015-06-05 10:55:52 +09:00
|
|
|
public: Match.Optional(Boolean), // public: true means the field is published freely
|
|
|
|
profile: Match.Optional(Boolean), // profile: true means the field is shown on user profiles
|
2015-05-16 12:34:50 +09:00
|
|
|
template: Match.Optional(String) // template used to display the field
|
2015-04-27 17:15:16 +09:00
|
|
|
// editableBy: Match.Optional(String)
|
2015-04-22 07:50:11 +09:00
|
|
|
});
|
|
|
|
|
|
|
|
// ------------------------------ Dynamic Templates ------------------------------ //
|
|
|
|
|
|
|
|
templates = {}
|
|
|
|
|
|
|
|
// note: not used anymore, but keep for backwards compatibility
|
|
|
|
getTemplate = function (name) {
|
|
|
|
// for now, always point back to the original template
|
|
|
|
var originalTemplate = (_.invert(templates))[name];
|
|
|
|
return !!originalTemplate ? originalTemplate : name;
|
|
|
|
|
|
|
|
// if template has been overwritten, return this; else return template name
|
|
|
|
// return !!templates[name] ? templates[name] : name;
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
// ------------------------------- Vote Power -------------------------------- //
|
|
|
|
|
|
|
|
// The equation to determine voting power
|
|
|
|
// Default to returning 1 for everybody
|
|
|
|
|
|
|
|
getVotePower = function (user) {
|
|
|
|
return 1;
|
|
|
|
};
|