Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F492408
ViewInterpreter.js
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Size
2 KB
Referenced Files
None
Subscribers
None
ViewInterpreter.js
View Options
/**
* Experimental interpreter for nice views.
* This is CoffeeScript:
*
* d = declare
* selectable: false
* boxOrientation: Orientation.HORIZONTAL
* additionalClasses: ['some-css-class']
* MultiAvatar ref: 'avatars'
* div
* flex: 1
* div(
* span className: 'some-css-class', ref: 'actorTargetLine'
* span className: 'message-css', ref: 'message'
* )
*
* div
* boxOrientation: Orientation.HORIZONTAL
* className: 'attachment-css-class'
* div
* className: 'attachment-image-css-class'
* ref: 'attachmentImageContainer'
* boxOrientation: Orientation.HORIZONTAL
* div className: 'inline attachment-text', ref: 'attachmentText',
* div
* className: 'attachment-title'
* ref: 'attachmentTitle'
* flex: 1
* div
* className: 'attachment-subtitle'
* ref: 'attachmentSubtitle'
* flex: 1
* div className: 'clear'
* MiniUfi ref: 'miniUfi'
* FeedbackFlyout ref: 'feedbackFlyout'
*
* It renders to nested function calls of the form:
* view({....options...}, child1, child2, ...);
*
* This view interpreter is meant to make it work.
*
* @provides javelin-view-interpreter
* @requires javelin-view
* javelin-install
*
*/
JX
.
install
(
'ViewInterpreter'
,
{
members
:
{
register
:
function
(
name
,
view_cls
)
{
this
[
name
]
=
function
(
/* [properties, ]children... */
)
{
var
properties
=
arguments
[
0
]
||
{};
var
children
=
Array
.
prototype
.
slice
.
call
(
arguments
,
1
);
// Passing properties is optional
if
(
properties
instanceof
JX
.
View
||
properties
instanceof
JX
.
HTML
||
properties
.
nodeType
||
typeof
properties
===
"string"
)
{
children
.
unshift
(
properties
);
properties
=
{};
}
var
result
=
new
view_cls
(
properties
).
setName
(
name
);
result
.
addChildren
(
children
);
return
result
;
}
}
}
});
File Metadata
Details
Attached
Mime Type
application/javascript
Expires
Wed, May 7, 11:05 PM (2 d)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
93694
Default Alt Text
ViewInterpreter.js (2 KB)
Attached To
Mode
rP Phorge
Attached
Detach File
Event Timeline
Log In to Comment