openmedialibrary/static/js/rightPanel.js

45 lines
1.2 KiB
JavaScript
Raw Normal View History

2014-05-04 17:26:43 +00:00
'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',
2014-05-19 15:00:33 +00:00
size: getSize()
2014-05-04 17:26:43 +00:00
})
.bindEvent({
resize: function(data) {
that.options({size: data.size});
2014-05-17 11:45:57 +00:00
oml.$ui.filtersOuterPanel.updateElement();
2014-05-04 17:26:43 +00:00
oml.$ui.itemViewPanel.options({size: data.size});
},
oml_item: function(data) {
if (!!data.value != !!data.previousValue) {
that.options({selected: !ui.item ? 'list' : 'item'});
}
}
});
2014-05-19 15:00:33 +00:00
function getSize() {
return window.innerWidth - ui.showSidebar * ui.sidebarSize - 1;
}
that.updateElement = function() {
return that.triggerEvent('resize', {size: getSize()});
};
2014-05-04 17:26:43 +00:00
return that;
2014-05-19 15:00:33 +00:00
};