summaryrefslogtreecommitdiff
path: root/src/client/model/types.js
diff options
context:
space:
mode:
Diffstat (limited to 'src/client/model/types.js')
-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,
+ });
+}
+)