openmedialibrary/static/js/rightPanel.js
2014-05-19 17:00:33 +02:00

46 lines
No EOL
1.3 KiB
JavaScript

'use strict';
oml.ui.rightPanel = function() {
var ui = oml.user.ui,
that = Ox.SlidePanel({
elements: [
{
id: 'list',
element: oml.$ui.listOuterPanel = oml.ui.listOuterPanel()
},
{
id: 'item',
element: oml.$ui.itemOuterPanel = oml.ui.itemOuterPanel()
}
],
orientation: 'horizontal',
selected: !ui.item ? 'list' : 'item',
size: getSize()
})
.bindEvent({
resize: function(data) {
Ox.print('::RESIZING', data.size);
that.options({size: data.size});
oml.$ui.filtersOuterPanel.updateElement();
oml.$ui.itemViewPanel.options({size: data.size});
},
oml_item: function(data) {
if (!!data.value != !!data.previousValue) {
that.options({selected: !ui.item ? 'list' : 'item'});
}
}
});
function getSize() {
return window.innerWidth - ui.showSidebar * ui.sidebarSize - 1;
}
that.updateElement = function() {
return that.triggerEvent('resize', {size: getSize()});
};
return that;
};