Skip to content

Instantly share code, notes, and snippets.

@michael
Created December 15, 2015 08:32
Show Gist options
  • Select an option

  • Save michael/5733d6497fd750d6b86b to your computer and use it in GitHub Desktop.

Select an option

Save michael/5733d6497fd750d6b86b to your computer and use it in GitHub Desktop.
var _ = require('underscore');
var Document = require('lens/substance/document');
var AMSContributor = function(node, doc) {
Document.Node.call(this, node, doc);
};
AMSContributor.type = {
"id": "contributor",
"parent": "content",
"properties": {
"source_id": "string",
"name": "string", // full name
"role": "string",
"contributor_type": "string",
"affiliations": ["array", "affiliation"],
"present_address": ["string"],
"fundings": ["array", "string"],
"image": "string", // optional
"emails": ["array", "string"],
"contribution": "string",
"bio": ["array", "paragraph"],
"deceased": "boolean",
"members": ["array", "string"],
"orcid": "string",
"equal_contrib": ["array", "string"],
"competing_interests": ["array", "string"],
"mrauth": "string"
}
};
AMSContributor.Prototype = function() {
this.getAffiliations = function() {
return _.map(this.properties.affiliations, function(affId) {
return this.document.get(affId);
}, this);
};
this.getHeader = function() {
return this.properties.contributor_type || 'Author';
};
};
AMSContributor.Prototype.prototype = Document.Node.prototype;
AMSContributor.prototype = new AMSContributor.Prototype();
AMSContributor.prototype.constructor = AMSContributor;
Document.Node.defineProperties(AMSContributor);
module.exports = AMSContributor;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment