1
0
Fork 0
fgdata/webgui/widgets/sidebarwidget.js
2015-03-14 22:31:31 +01:00

35 lines
790 B
JavaScript

define([
'jquery', 'knockout', 'text!./sidebarwidget.html', 'jquery-ui/draggable',
], function(jquery, ko, htmlString) {
function ViewModel(params) {
var self = this;
self.widget = ko.observable(params.widget);
self.pinned = ko.observable(true);
self.pin = function() {
self.pinned(!self.pinned());
}
self.close = function() {
}
self.expanded = ko.observable(true);
self.onMouseover = function() {
self.expanded(true);
}
self.onMouseout = function() {
if (!self.pinned())
self.expanded(false);
}
}
// Return component definition
return {
viewModel : ViewModel,
template : htmlString
};
});