summaryrefslogtreecommitdiff
path: root/src/client/model
diff options
context:
space:
mode:
authorAlon Levy <alon@pobox.com>2015-03-06 23:40:57 +0200
committerAlon Levy <alon@pobox.com>2015-03-06 23:40:57 +0200
commit524fd1b5afeeb405cf5fd76b3228e5aacfe892cb (patch)
treef5091f9def204bbdc1d2e97fc35b34d1d1afd284 /src/client/model
parentdcfb50e25e7273e4735cc13150ad234415fcc4fd (diff)
client: introduce model/types, cleanup node_info (not quite enough)
Diffstat (limited to 'src/client/model')
-rw-r--r--src/client/model/types.js30
1 files changed, 30 insertions, 0 deletions
diff --git a/src/client/model/types.js b/src/client/model/types.js
new file mode 100644
index 00000000..fac37cbe
--- /dev/null
+++ b/src/client/model/types.js
@@ -0,0 +1,30 @@
+define(['underscore', 'util'],
+function(_, util)
+{
+
+var type_attributes = {
+ 'third-internship-proposal': ['status', 'startdate', 'enddate', 'description', 'url'],
+ 'skill': ['description', 'url'],
+ 'interest': ['description', 'url'],
+ '_defaults': ['description', 'url'],
+ },
+ all_attributes;
+
+_.values(type_attributes).map(function (attributes) {
+ attributes.push('name');
+ attributes.push('type');
+ attributes.sort();
+ });
+
+all_attributes = _.union(_.flatten(_.map(type_attributes, _.values))).sort();
+
+return (
+ {
+ type_attributes: function (type) {
+ util.assert(type[0] !== '_', 'invalid type name');
+ return type_attributes[type_attributes.hasOwnProperty(type) ? type : '_defaults'];
+ },
+ all_attributes: all_attributes,
+ });
+}
+)