pandora/static/js/mainPanel.js

96 lines
4.5 KiB
JavaScript
Raw Normal View History

2011-07-29 18:37:11 +00:00
// vim: et:ts=4:sw=4:sts=4:ft=javascript
2011-11-05 17:04:10 +00:00
'use strict';
2011-05-25 19:42:45 +00:00
pandora.ui.mainPanel = function() {
2011-06-19 17:49:25 +00:00
var that = Ox.SplitPanel({
elements: [
{
collapsible: true,
collapsed: !pandora.user.ui.showSidebar,
element: pandora.$ui.leftPanel = pandora.ui.leftPanel(),
resizable: true,
resize: [192, 256, 320, 384],
size: pandora.user.ui.sidebarSize,
tooltip: 'sidebar <span class="OxBright">'
+ Ox.SYMBOLS.SHIFT + 'S</span>'
},
{
element: pandora.user.ui.section == 'items' ? pandora.$ui.rightPanel = pandora.ui.rightPanel()
: pandora.user.ui.section == 'edits' ? pandora.$ui.editPanel = pandora.ui.editPanel()
: pandora.$ui.textPanel = pandora.ui.textPanel()
}
],
orientation: 'horizontal'
})
.bindEvent({
pandora_edit: function(data) {
that.replaceElement(1, pandora.$ui.editPanel = pandora.ui.editPanel());
},
pandora_find: function() {
var previousUI = pandora.UI.getPrevious();
Ox.Log('FIND', 'handled in mainPanel', previousUI.item, previousUI._list)
if (!previousUI.item && pandora.user.ui._list == previousUI._list) {
if (['map', 'calendar'].indexOf(pandora.user.ui.listView) > -1) {
pandora.$ui.contentPanel.replaceElement(1,
pandora.ui.navigationView(pandora.user.ui.listView)
);
} else {
2012-02-01 12:01:39 +00:00
if (['clips', 'clip'].indexOf(pandora.user.ui.listView) > -1) {
pandora.$ui.list.options({find: pandora.user.ui.itemFind});
}
pandora.$ui.list.reloadList();
}
// FIXME: why is this being handled _here_?
2011-11-06 08:28:10 +00:00
pandora.user.ui._filterState.forEach(function(data, i) {
if (!Ox.isEqual(data.selected, previousUI._filterState[i].selected)) {
pandora.$ui.filters[i].options(
pandora.user.ui.showFilters ? {
selected: data.selected
} : {
_selected: data.selected,
selected: []
}
);
}
2011-11-06 08:28:10 +00:00
if (!Ox.isEqual(data.find, previousUI._filterState[i].find)) {
if (!pandora.user.ui.showFilters) {
pandora.$ui.filters[i].options({
_selected: data.selected
});
}
// we can call reloadList here, since the items function
// handles the hidden filters case without making requests
pandora.$ui.filters[i].reloadList();
2011-10-29 17:46:46 +00:00
}
});
} else {
if (pandora.stayInItemView) {
pandora.stayInItemView = false;
} else {
that.replaceElement(1, pandora.$ui.rightPanel = pandora.ui.rightPanel());
}
}
2011-05-25 19:42:45 +00:00
},
2013-02-21 12:10:35 +00:00
pandora_item: function(data) {
if (!data.value || !data.previousValue) {
2013-02-16 01:20:40 +00:00
that.replaceElement(1, pandora.$ui.rightPanel = pandora.ui.rightPanel());
}
},
2013-02-21 12:10:35 +00:00
pandora_section: function(data) {
if (data.value != data.previousValue) {
that.replaceElement(0, pandora.$ui.leftPanel = pandora.ui.leftPanel());
that.replaceElement(1, pandora.$ui.rightPanel = pandora.ui.rightPanel());
}
},
pandora_showsidebar: function(data) {
data.value == that.options('elements')[0].collapsed && that.toggle(0);
2013-02-21 12:10:35 +00:00
},
pandora_text: function(data) {
if (data.value != data.previousValue) {
that.replaceElement(1, pandora.$ui.textPanel = pandora.ui.textPanel());
}
2011-05-25 19:42:45 +00:00
}
});
2011-05-25 19:42:45 +00:00
return that;
};