diff options
| author | Alon Levy <alon@pobox.com> | 2015-04-06 16:21:10 +0300 |
|---|---|---|
| committer | Alon Levy <alon@pobox.com> | 2015-04-06 16:21:10 +0300 |
| commit | 748f1c5d337040433c6c441afab579faf5c934e0 (patch) | |
| tree | 59d0fc1a044aea66e626ad5f05dcdacb61ed02a8 /src/local/domain/cri.rhizi.net | |
| parent | a2ef6be2c52e0421fccddf45fd1563f49f4475c4 (diff) | |
client: types: split types.js to form domain_types.js, containing declarative jsontoday-is-not-the-day
Diffstat (limited to 'src/local/domain/cri.rhizi.net')
| -rw-r--r-- | src/local/domain/cri.rhizi.net/domain_types.js (renamed from src/local/domain/cri.rhizi.net/types.js) | 44 |
1 files changed, 5 insertions, 39 deletions
diff --git a/src/local/domain/cri.rhizi.net/types.js b/src/local/domain/cri.rhizi.net/domain_types.js index 76959a83..c8610aa9 100644 --- a/src/local/domain/cri.rhizi.net/types.js +++ b/src/local/domain/cri.rhizi.net/domain_types.js @@ -1,9 +1,5 @@ -define(['underscore', 'util'], -function(_, util) -{ - -var nodetypes, - type_attributes = { +define({ + type_attributes: { 'internship': { 'title': 'Internship', 'attributes': @@ -34,8 +30,7 @@ var nodetypes, 'attributes': ['description', 'url'], } }, - all_attributes, - attribute_titles = { + attribute_titles: { 'name': 'Name', 'type': 'Type', 'description': 'Description', @@ -50,34 +45,5 @@ var nodetypes, 'street-address': 'Street address', 'city': 'City', 'country': 'Country', - }; - -nodetypes = _.keys(type_attributes); - -type_attributes['_defaults'] = { - 'title': 'default', - 'attributes':['description', 'url'] - }; - -_.pluck(_.values(type_attributes), 'attributes').map(function (attributes) { - attributes.push('name'); - attributes.push('type'); - attributes.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 || type[0] !== '_', 'invalid type name'); - return type_attributes[!type && type_attributes.hasOwnProperty(type) ? type : '_defaults'].attributes; - }, - all_attributes: all_attributes, - attribute_titles: attribute_titles, - }); -} -) + } +}); |
