From 2746c5d10ca67fdfd31ead979d0ccd3ee03ebed6 Mon Sep 17 00:00:00 2001 From: Alon Levy Date: Sat, 7 Mar 2015 08:39:18 +0200 Subject: client: move nodetypes from consts to model/types --- src/client/model/types.js | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'src/client/model/types.js') diff --git a/src/client/model/types.js b/src/client/model/types.js index fac37cbe..990c3b02 100644 --- a/src/client/model/types.js +++ b/src/client/model/types.js @@ -2,14 +2,19 @@ define(['underscore', 'util'], function(_, util) { -var type_attributes = { - 'third-internship-proposal': ['status', 'startdate', 'enddate', 'description', 'url'], +var nodetypes, + type_attributes = { + 'internship': ['status', 'startdate', 'enddate', 'description', 'url'], 'skill': ['description', 'url'], 'interest': ['description', 'url'], - '_defaults': ['description', 'url'], + 'person': ['description', 'url'], }, all_attributes; +nodetypes = _.keys(type_attributes); + +type_attributes['_defaults'] = ['description', 'url']; + _.values(type_attributes).map(function (attributes) { attributes.push('name'); attributes.push('type'); @@ -20,6 +25,7 @@ all_attributes = _.union(_.flatten(_.map(type_attributes, _.values))).sort(); return ( { + nodetypes: nodetypes, type_attributes: function (type) { util.assert(type[0] !== '_', 'invalid type name'); return type_attributes[type_attributes.hasOwnProperty(type) ? type : '_defaults']; -- cgit v1.3.1