Advertisement
Guest User

Untitled

a guest
Dec 22nd, 2014
151
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.52 KB | None | 0 0
  1. The relation struct:
  2. var struct = module.exports = function(relationType, relationLocator, relationLabel, documentSmallIcon,
  3. documentLocator, documentLabel, documentType, sORt) {
  4. var result = {};
  5. result.relationLocator = relationLocator;
  6. result.relationType = relationType;
  7. result.relationLabel = relationLabel;
  8. result.documentType = documentType;
  9. result.icon = documentSmallIcon;
  10. result.locator = documentLocator;
  11. result.label = documentLabel;
  12. result.sort = sORt;
  13. return result;
  14. };
  15.  
  16. Code that creates it from inside a class:
  17. var struct = require('../util/relnstruct'); // refers to the object above
  18.  
  19. var rx = struct(relationType,pivotLocator,relationLabel,
  20. documentSmallIcon, targetLocator, targetLabel, nodeType,sORt);
  21.  
  22. JSON view of Good Struct in a context:
  23.  
  24. {
  25. "relationLocator": "climate_change_TAGTagDocumentRelationTypee164f340-8961-11e4-8eea-5d173b397214",
  26. "relationType": "TagDocumentRelationType",
  27. "relationLabel": "TagDocumentRelationType",
  28. "documentType": "TagNodeType",
  29. "icon": "/images/tag_sm.png",
  30. "locator": "climate_change_TAG",
  31. "label": "Climate Change",
  32. "sort": "s"
  33. }
  34.  
  35. JSON view of bad (ubuntu) struct in similar context:
  36. Note: relationLocator has been dropped
  37.  
  38. {
  39. "relationType": "TagDocumentRelationType",
  40. "relationLabel": "blog_TAGTagDocumentRelationType0b7f2190-8a08-11e4-94bd-db98af817586",
  41. "documentType": "Blog",
  42. "icon": "TagDocumentRelationType",
  43. "locator": "/images/tag_sm.png",
  44. "label": "blog_TAG",
  45. "sort": "TagNodeType"
  46. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement