You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
174 lines
3.6 KiB
174 lines
3.6 KiB
/*jslint laxbreak:true */
|
|
/*jslint laxcomma:true */
|
|
/*jslint loopfunc:true */
|
|
/*jslint strict:true */
|
|
/*jslint browser:true */
|
|
/*jslint devel:true */
|
|
|
|
define([
|
|
"underscore"
|
|
, "jquery"
|
|
, "backbone"
|
|
|
|
, "views/browser"
|
|
, "views/list"
|
|
|
|
, "text!../../templates/client/layout.html"
|
|
|
|
, "jquery-layout"
|
|
]
|
|
, function (
|
|
_
|
|
, $
|
|
, Backbone
|
|
|
|
, BrowserView
|
|
, ListView
|
|
|
|
, tmplClientLayout
|
|
) {
|
|
"use strict";
|
|
|
|
var Client = Backbone.View.extend({
|
|
id: null
|
|
|
|
//, el: $(tmplClientLayout)
|
|
, tagName: "div"
|
|
|
|
, Server: null
|
|
|
|
, Layout: null
|
|
|
|
, Views: {}
|
|
|
|
, initialize: function (options) {
|
|
_.bindAll(this
|
|
, "_initLayout"
|
|
, "show"
|
|
, "hide"
|
|
);
|
|
|
|
var that = this
|
|
, appendEl = options.appendEl
|
|
;
|
|
|
|
|
|
that.Server = options.server;
|
|
|
|
delete options.server;
|
|
delete options.appendEl;
|
|
|
|
Client.__super__.initialize.apply(that, arguments);
|
|
|
|
that.el.id = "__view-cient-" + that.Server.client.attributes.hostname.replace(".", "_");
|
|
that.id = that.Server.client.attributes.hostname;
|
|
that.el.innerHTML = tmplClientLayout;
|
|
that.el.innerHTML = that.el.innerHTML.replace("this.type", that.Server.client.url());
|
|
}
|
|
|
|
, _initLayout: function () {
|
|
var that = this
|
|
;
|
|
|
|
that.Layout = that.$el.layout({
|
|
defaults: {
|
|
closable: false
|
|
, resizable: true
|
|
, slidable: true
|
|
, spacing_open: 5
|
|
, spacing_closed: 5
|
|
}
|
|
|
|
, north: {
|
|
minSize: 100
|
|
, size: 200
|
|
, closable: true
|
|
, onresize: function (pane, $pane, state, options) {
|
|
that.Views.Browser.resize(pane, $pane, state, options);
|
|
}
|
|
}
|
|
|
|
, center: {
|
|
minSize: 200
|
|
, onresize: function (pane, $pane, state, options) {
|
|
that.Views.List.resize(pane, $pane, state, options);
|
|
}
|
|
}
|
|
});
|
|
|
|
that.Views.Browser = new BrowserView(that.Client, {
|
|
el: that.Layout.panes.north
|
|
});
|
|
|
|
var dbId = that.Server.client.collections.databasesInfo.get("dmap_listing").at(0).id
|
|
, dbCollection = that.Server.client.collections.databases[dbId].get("dmap_listing")
|
|
;
|
|
|
|
that.Views.List = new ListView({
|
|
el: that.Layout.panes.center
|
|
, collection: dbCollection
|
|
, type: "client"
|
|
});
|
|
}
|
|
|
|
, show: function () {
|
|
var that = this
|
|
;
|
|
|
|
if (that.Layout === null) {
|
|
that._initLayout();
|
|
}
|
|
|
|
that.Layout.panes.north.show();
|
|
that.Layout.panes.center.show();
|
|
that.Views.List.show();
|
|
this.$el.show();
|
|
//console.debug(that.Server.client.collections.databases[that.Server.client.collections.databasesInfo.get("dmap_listing").at(0).id].get("dmap_listing"));
|
|
}
|
|
|
|
, hide: function () {
|
|
var that = this
|
|
;
|
|
|
|
that.Layout.panes.north.hide();
|
|
that.Layout.panes.center.hide();
|
|
that.Views.List.hide();
|
|
this.$el.hide();
|
|
}
|
|
});
|
|
|
|
return Client;
|
|
});
|
|
|
|
/*
|
|
|
|
that.layoutItems = $(that.layout.panes.center).layout({
|
|
defaults: {
|
|
closable: false
|
|
, resizable: true
|
|
, slidable: true
|
|
, spacing_open: 5
|
|
, spacing_closed: 5
|
|
}
|
|
|
|
, north: {
|
|
minSize: 100
|
|
, size: 200
|
|
, closable: true
|
|
//, onresize: function (pane, $pane, state, options) {
|
|
// var viewportHeight = $pane.innerHeight() - App.BrowserView.$el.find(".dataTables_scrollHead").height();
|
|
// App.BrowserView.$el.find(".dataTables_scrollBody").height(viewportHeight);
|
|
// //App.BrowserView.reDraw();
|
|
// }
|
|
}
|
|
|
|
, center: {
|
|
minSize: 200
|
|
//, onresize: function (pane, $pane, state, options) {
|
|
// var viewportHeight = $pane.innerHeight() - App.ListView.$el.find(".dataTables_scrollHead").height();
|
|
// App.ListView.$el.find(".dataTables_scrollBody").height(viewportHeight);
|
|
// //App.ListView.render();
|
|
// }
|
|
}
|
|
});
|
|
*/ |