diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/client/model/types.js | 61 |
1 files changed, 52 insertions, 9 deletions
diff --git a/src/client/model/types.js b/src/client/model/types.js index 990c3b02..dc8b8ace 100644 --- a/src/client/model/types.js +++ b/src/client/model/types.js @@ -4,33 +4,76 @@ function(_, util) var nodetypes, type_attributes = { - 'internship': ['status', 'startdate', 'enddate', 'description', 'url'], - 'skill': ['description', 'url'], - 'interest': ['description', 'url'], - 'person': ['description', 'url'], + 'internship': { + 'title': 'Internship', + 'attributes': + ['status', 'startdate', 'enddate', 'description', 'url', + 'internship-type', + 'facility', + 'facility-affiliation', + 'cnrs-inserm-unit-code', + 'street-address', + 'city', + 'country', + ], + }, + 'skill': { + 'title': 'Skill', + 'attributes': ['description', 'url'], + }, + 'interest': { + 'title': 'Interesst', + 'attributes': ['description', 'url'], + }, + 'person': { + 'title': 'Person', + 'attributes': ['description', 'url'], + } }, - all_attributes; + all_attributes, + attribute_titles = { + 'name': 'Name', + 'type': 'Type', + 'description': 'Description', + 'url': 'URL', + 'status': 'Status', + 'startdate': 'Start Date', + 'enddate': 'End Date', + 'internship-type': 'Internship Type', + 'facility': 'Lab/Company', + 'facility-affiliation': 'Lab affiliation', + 'cnrs-inserm-unit-code': 'CNRS / INSERM unit code', + 'street-address': 'Street address', + 'city': 'City', + 'country': 'Country', + }; nodetypes = _.keys(type_attributes); -type_attributes['_defaults'] = ['description', 'url']; +type_attributes['_defaults'] = { + 'title': 'default', + 'attributes':['description', 'url'] + }; -_.values(type_attributes).map(function (attributes) { +_.pluck(_.values(type_attributes), 'attributes').map(function (attributes) { attributes.push('name'); attributes.push('type'); attributes.sort(); }); -all_attributes = _.union(_.flatten(_.map(type_attributes, _.values))).sort(); +all_attributes = _.union(_.flatten(_.pluck(_.values(type_attributes), 'attributes'))).sort(); + +util.assert(_.isEqual(all_attributes, _.keys(attribute_titles).sort())); return ( { nodetypes: nodetypes, type_attributes: function (type) { util.assert(type[0] !== '_', 'invalid type name'); - return type_attributes[type_attributes.hasOwnProperty(type) ? type : '_defaults']; + return type_attributes[type_attributes.hasOwnProperty(type) ? type : '_defaults'].attributes; }, all_attributes: all_attributes, + attribute_titles: attribute_titles, }); } ) |
