Path: blob/master/webroot/rsrc/externals/javelin/ext/view/ViewInterpreter.js
12242 views
/**1* Experimental interpreter for nice views.2* This is CoffeeScript:3*4* d = declare5* selectable: false6* boxOrientation: Orientation.HORIZONTAL7* additionalClasses: ['some-css-class']8* MultiAvatar ref: 'avatars'9* div10* flex: 111* div(12* span className: 'some-css-class', ref: 'actorTargetLine'13* span className: 'message-css', ref: 'message'14* )15*16* div17* boxOrientation: Orientation.HORIZONTAL18* className: 'attachment-css-class'19* div20* className: 'attachment-image-css-class'21* ref: 'attachmentImageContainer'22* boxOrientation: Orientation.HORIZONTAL23* div className: 'inline attachment-text', ref: 'attachmentText',24* div25* className: 'attachment-title'26* ref: 'attachmentTitle'27* flex: 128* div29* className: 'attachment-subtitle'30* ref: 'attachmentSubtitle'31* flex: 132* div className: 'clear'33* MiniUfi ref: 'miniUfi'34* FeedbackFlyout ref: 'feedbackFlyout'35*36* It renders to nested function calls of the form:37* view({....options...}, child1, child2, ...);38*39* This view interpreter is meant to make it work.40*41* @provides javelin-view-interpreter42* @requires javelin-view43* javelin-install44* javelin-dom45*/4647JX.install('ViewInterpreter', {48members : {49register : function(name, view_cls) {50this[name] = function(/* [properties, ]children... */) {51var properties = arguments[0] || {};52var children = Array.prototype.slice.call(arguments, 1);5354// Passing properties is optional55if (properties instanceof JX.View ||56properties instanceof JX.HTML ||57properties.nodeType ||58typeof properties === 'string') {59children.unshift(properties);60properties = {};61}6263var result = new view_cls(properties).setName(name);64result.addChildren(children);6566return result;67};68}69}70});717273