2011-07-29 18:37:11 +00:00
|
|
|
// vim: et:ts=4:sw=4:sts=4:ft=javascript
|
2011-05-25 19:42:45 +00:00
|
|
|
pandora.ui.leftPanel = function() {
|
2011-06-19 17:49:25 +00:00
|
|
|
var that = Ox.SplitPanel({
|
2011-05-25 19:42:45 +00:00
|
|
|
elements: [
|
|
|
|
{
|
2011-06-06 15:48:11 +00:00
|
|
|
element: pandora.$ui.sectionbar = pandora.ui.sectionbar('buttons'),
|
2011-05-25 19:42:45 +00:00
|
|
|
size: 24
|
|
|
|
},
|
|
|
|
{
|
2011-06-06 15:48:11 +00:00
|
|
|
element: pandora.$ui.folders = pandora.ui.folders()
|
2011-05-25 19:42:45 +00:00
|
|
|
},
|
|
|
|
{
|
2011-06-06 15:48:11 +00:00
|
|
|
collapsed: !pandora.user.ui.showInfo,
|
2011-05-25 19:42:45 +00:00
|
|
|
collapsible: true,
|
2011-06-06 15:48:11 +00:00
|
|
|
element: pandora.$ui.info = pandora.ui.info(),
|
2011-09-18 21:18:05 +00:00
|
|
|
size: pandora.getInfoHeight(),
|
2011-09-04 21:15:53 +00:00
|
|
|
tooltip: 'info'
|
2011-05-25 19:42:45 +00:00
|
|
|
}
|
|
|
|
],
|
|
|
|
id: 'leftPanel',
|
|
|
|
orientation: 'vertical'
|
|
|
|
})
|
|
|
|
.bindEvent({
|
2011-09-17 17:40:15 +00:00
|
|
|
resize: function(data) {
|
2011-09-18 21:18:05 +00:00
|
|
|
pandora.user.ui.sidebarSize = data.size;
|
2011-09-17 17:40:15 +00:00
|
|
|
if (data.size < pandora.site.sectionButtonsWidth && pandora.$ui.sectionButtons) {
|
2011-06-06 15:48:11 +00:00
|
|
|
pandora.$ui.sectionButtons.removeElement();
|
|
|
|
delete pandora.$ui.sectionButtons;
|
|
|
|
pandora.$ui.sectionbar.append(pandora.$ui.sectionSelect = pandora.ui.sectionSelect());
|
2011-09-17 17:40:15 +00:00
|
|
|
} else if (data.size >= pandora.site.sectionButtonsWidth && pandora.$ui.sectionSelect) {
|
2011-06-06 15:48:11 +00:00
|
|
|
pandora.$ui.sectionSelect.removeElement();
|
|
|
|
delete pandora.$ui.sectionSelect;
|
|
|
|
pandora.$ui.sectionbar.append(pandora.$ui.sectionButtons = pandora.ui.sectionButtons());
|
2011-05-25 19:42:45 +00:00
|
|
|
}
|
2011-06-06 15:48:11 +00:00
|
|
|
!pandora.user.ui.showInfo && pandora.$ui.leftPanel.css({bottom: -infoSize});
|
2011-09-18 21:18:05 +00:00
|
|
|
pandora.$ui.leftPanel.size(2, pandora.getInfoHeight());
|
|
|
|
pandora.$ui.info.resizeInfo();
|
2011-05-25 19:42:45 +00:00
|
|
|
pandora.resizeFolders();
|
|
|
|
},
|
2011-09-17 17:40:15 +00:00
|
|
|
resizeend: function(data) {
|
2011-09-18 21:18:05 +00:00
|
|
|
// set to 0 so that UI.set registers a change of the value
|
|
|
|
pandora.user.ui.sidebarSize = 0;
|
2011-09-17 17:40:15 +00:00
|
|
|
pandora.UI.set({sidebarSize: data.size});
|
2011-05-25 19:42:45 +00:00
|
|
|
},
|
2011-09-17 17:40:15 +00:00
|
|
|
toggle: function(data) {
|
2011-05-25 19:42:45 +00:00
|
|
|
pandora.UI.set({showSidebar: !data.collapsed});
|
|
|
|
if (data.collapsed) {
|
2011-09-17 18:36:30 +00:00
|
|
|
Ox.forEach(pandora.$ui.folderList, function($list) {
|
2011-05-25 19:42:45 +00:00
|
|
|
$list.loseFocus();
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
return that;
|
|
|
|
};
|
|
|
|
|