openmedialibrary/static/js/leftPanel.js

60 lines
1.8 KiB
JavaScript
Raw Normal View History

2014-05-04 17:26:43 +00:00
'use strict';
oml.ui.leftPanel = function() {
var ui = oml.user.ui,
that = Ox.SplitPanel({
elements: [
{
element: oml.$ui.sectionbar = oml.ui.sectionbar(),
size: 24
},
{
element: oml.$ui.folders = oml.ui.folders()
},
{
collapsed: !oml.user.ui.showInfo,
collapsible: true,
element: oml.$ui.info = oml.ui.info(),
2014-05-19 15:00:33 +00:00
size: oml.getInfoHeight(),
2014-05-04 17:26:43 +00:00
tooltip: Ox._('info') + ' <span class="OxBright">'
2014-10-31 18:37:32 +00:00
+ Ox.SYMBOLS.shift + 'I</span>'
2014-05-04 17:26:43 +00:00
}
],
id: 'leftPanel',
orientation: 'vertical'
})
.bindEvent({
resize: function(data) {
ui.sidebarSize = data.size;
oml.resizeListFolders();
2014-05-12 12:57:47 +00:00
that.size(2, oml.getInfoHeight());
2014-05-04 17:26:43 +00:00
if (!ui.showInfo) {
that.css({bottom: -data.size + 'px'});
}
},
resizeend: function(data) {
// set to 0 so that UI.set registers a change of the value
ui.sidebarSize = 0;
oml.UI.set({sidebarSize: data.size});
},
toggle: function(data) {
oml.UI.set({showSidebar: !data.collapsed});
if (data.collapsed) {
oml.$ui.folderList.forEach(function($list) {
$list.loseFocus();
});
}
},
oml_showinfo: function(data) {
if (data.value == that.options('elements')[2].collapsed) {
2014-09-25 11:39:05 +00:00
that.toggleElement(2);
2014-05-04 17:26:43 +00:00
}
}
});
return that;
2014-09-25 11:39:05 +00:00
};