Created
June 8, 2011 14:45
-
-
Save brianjmiller/1014561 to your computer and use it in GitHub Desktop.
YUI3 panelesque
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
YUI.add( | |
"ui-window-tile", | |
function(Y) { | |
var Tile = Y.Base.create( | |
"ui_window_tile", | |
Y.Overlay, | |
[], | |
{ | |
// TODO: make this a child of the window parent | |
_window: null, | |
initializer: function (config) { | |
Y.log(Tile.NAME + "::initializer"); | |
this._window = config.window; | |
// this is in a separate node to give us something to resize against | |
this._body_node = Y.Node.create("<div>This is the body node.</div>"); | |
// TODO: this needs to be improved to have it be smart based on | |
// the other existing tiles, etc. | |
this.set("zIndex", 1); | |
// set default tile sizes, this could be improved | |
this._body_node.setStyle("width", "200px"); | |
this._body_node.setStyle("height", "200px"); | |
this.set("headerContent", "<span>Tile Title</span>"); | |
this.set("bodyContent", this._body_node); | |
}, | |
destructor: function () { | |
Y.log(Tile.NAME + "::destructor"); | |
}, | |
renderUI: function () { | |
var dd = new Y.DD.Drag ( | |
{ | |
node: this.get("boundingBox") | |
} | |
).plug( | |
Y.Plugin.DDConstrained, | |
{ | |
constrain2node: this._window.get("contentBox") | |
} | |
); | |
// make only our header a handle for the tile drag | |
var _handle = dd.addHandle( this.getStdModNode(Y.WidgetStdMod.HEADER) ); | |
// prevent drag from starting when selecting the title's span | |
//_handle.addInvalid("span"); | |
this._body_node.plug( | |
Y.Plugin.Resize, | |
{ | |
animate: true, | |
status: true | |
} | |
); | |
} | |
}, | |
{ | |
ATTRS: {} | |
} | |
); | |
Y.namespace("UI.WindowComponent").Tile = Tile; | |
}, | |
"@VERSION@", | |
{ | |
requires: [ | |
"ui-window-tile-css", | |
"overlay", | |
"dd-constrain", | |
"gallery-resize", | |
"gallery-resize-core-css", | |
"gallery-resize-skin-css" | |
] | |
} | |
); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment