Created
December 22, 2014 19:44
-
-
Save KnowledgeGarden/4f9552ed2774fc7836dc to your computer and use it in GitHub Desktop.
Node Ubuntu/Windoz code
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
The relation struct: | |
var struct = module.exports = function(relationType, relationLocator, relationLabel, documentSmallIcon, | |
documentLocator, documentLabel, documentType, sORt) { | |
var result = {}; | |
result.relationLocator = relationLocator; | |
result.relationType = relationType; | |
result.relationLabel = relationLabel; | |
result.documentType = documentType; | |
result.icon = documentSmallIcon; | |
result.locator = documentLocator; | |
result.label = documentLabel; | |
result.sort = sORt; | |
return result; | |
}; | |
Code that creates it from inside a class: | |
var struct = require('../util/relnstruct'); // refers to the object above | |
var rx = struct(relationType,pivotLocator,relationLabel, | |
documentSmallIcon, targetLocator, targetLabel, nodeType,sORt); | |
JSON view of Good Struct in a context: | |
{ | |
"relationLocator": "climate_change_TAGTagDocumentRelationTypee164f340-8961-11e4-8eea-5d173b397214", | |
"relationType": "TagDocumentRelationType", | |
"relationLabel": "TagDocumentRelationType", | |
"documentType": "TagNodeType", | |
"icon": "/images/tag_sm.png", | |
"locator": "climate_change_TAG", | |
"label": "Climate Change", | |
"sort": "s" | |
} | |
JSON view of bad (ubuntu) struct in similar context: | |
Note: relationLocator has been dropped | |
{ | |
"relationType": "TagDocumentRelationType", | |
"relationLabel": "blog_TAGTagDocumentRelationType0b7f2190-8a08-11e4-94bd-db98af817586", | |
"documentType": "Blog", | |
"icon": "TagDocumentRelationType", | |
"locator": "/images/tag_sm.png", | |
"label": "blog_TAG", | |
"sort": "TagNodeType" | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment