ee0a98a14fe73bf084b7af2271ffd085840dc322
[ccsdk/features.git] /
1 (function( $, app ) {
2
3         var ui = app.ns("ui");
4
5         ui.DraggablePanel = ui.AbstractPanel.extend({
6                 defaults: {
7         //              title: ""   // (required) text for the panel title
8                 },
9
10                 _baseCls: "uiPanel",
11
12                 init: function() {
13                         this._super();
14                         this.body = $(this._body_template());
15                         this.title = $(this._title_template());
16                         this.el = $.joey( this._main_template() );
17                         this.el.css( { width: this.config.width } );
18                         this.dd = new app.ux.DragDrop({
19                                 pickupSelector: this.el.find(".uiPanel-titleBar"),
20                                 dragObj: this.el
21                         });
22                         // open the panel if set in configuration
23                         this.config.open && this.open();
24                 },
25
26                 setBody: function(body) {
27                                 this.body.empty().append(body);
28                 },
29                 _body_template: function() { return { tag: "DIV", cls: "uiPanel-body", css: { height: this.config.height + (this.config.height === 'auto' ? "" : "px" ) }, children: [ this.config.body ] }; },
30                 _title_template: function() { return { tag: "SPAN", cls: "uiPanel-title", text: this.config.title }; },
31                 _main_template: function() { return (
32                         { tag: "DIV", id: this.id(), cls: this._baseCls, children: [
33                                 { tag: "DIV", cls: "uiPanel-titleBar", children: [
34                                         { tag: "DIV", cls: "uiPanel-close", onclick: this._close_handler, text: "x" },
35                                         this.title
36                                 ]},
37                                 this.body
38                         ] }
39                 ); }
40         });
41
42 })( this.jQuery, this.app );