diff --git a/Phi/widgets/sidebarwidget.html b/Phi/widgets/sidebarwidget.html
index b665d79c7..24e395977 100644
--- a/Phi/widgets/sidebarwidget.html
+++ b/Phi/widgets/sidebarwidget.html
@@ -2,15 +2,16 @@
.widget-header-button {
font-size: unset;
}
+
.widget-handle {
- cursor: pointer;
- font-weight: bold;
+ cursor: pointer;
+ font-weight: bold;
}
-
-
+
+
+ class="widget-header-button" title="Close">
+
diff --git a/Phi/widgets/sidebarwidget.js b/Phi/widgets/sidebarwidget.js
index 792d93279..0e74daf25 100644
--- a/Phi/widgets/sidebarwidget.js
+++ b/Phi/widgets/sidebarwidget.js
@@ -1,10 +1,12 @@
define([
- 'jquery', 'knockout', 'text!./sidebarwidget.html', 'jquery-ui/draggable',
+ 'jquery', 'knockout', 'text!./sidebarwidget.html', 'jquery-ui/draggable', 'jquery-ui/dialog'
], function(jquery, ko, htmlString) {
- function ViewModel(params) {
+ function ViewModel(params, componentInfo) {
var self = this;
+ self.element = componentInfo.element;
+
self.widget = ko.observable(params.widget);
self.pinned = ko.observable(true);
@@ -13,6 +15,12 @@ define([
}
self.close = function() {
+ jquery(self.element).remove();
+ }
+
+ self.detach = function() {
+ jquery(self.element).find('.phi-widget').dialog();
+ jquery(self.element).remove();
}
self.expanded = ko.observable(true);
@@ -29,7 +37,11 @@ define([
// Return component definition
return {
- viewModel : ViewModel,
+ viewModel : {
+ createViewModel : function(params, componentInfo) {
+ return new ViewModel(params, componentInfo);
+ },
+ },
template : htmlString
};
});