in viewSelect, add separator between standard and extra item views

This commit is contained in:
rolux 2012-04-24 12:13:14 +00:00
parent 4f3593a6b9
commit 5cee28bef1

View file

@ -6,35 +6,43 @@ pandora.ui.viewSelect = function() {
var ui = pandora.user.ui, var ui = pandora.user.ui,
sortKey = !ui.item ? 'listSort' : 'itemSort', sortKey = !ui.item ? 'listSort' : 'itemSort',
viewKey = !ui.item ? 'listView' : 'itemView', viewKey = !ui.item ? 'listView' : 'itemView',
that = Ox.Select({ items = Ox.map(pandora.site[viewKey + 's'], function(view) {
id: 'viewSelect', return ['data', 'files'].indexOf(view.id) == -1
items: Ox.map(pandora.site[viewKey + 's'], function(view) { ? {id: view.id, title: 'View ' + view.title}
return viewKey == 'listView' : null;
|| ['data', 'files'].indexOf(view.id) == -1 }),
|| pandora.site.capabilities.canSeeExtraItemViews[pandora.user.level] that;
? Ox.extend(Ox.clone(view), { if (
title: 'View ' + view.title viewKey == 'itemView'
}) && pandora.site.capabilities.canSeeExtraItemViews[pandora.user.level]
: null; ) {
}), Ox.merge(items, [
value: ui[viewKey], {},
width: !ui.item ? 144 : 128 {id: 'data', title: 'View Data'},
}) {id: 'files', title: 'View Files'}
.css({ ]);
float: 'left', }
margin: '4px 0 0 4px' that = Ox.Select({
}) id: 'viewSelect',
.bindEvent({ items: items,
change: function(data) { value: ui[viewKey],
pandora.UI.set(viewKey, data.value); width: !ui.item ? 144 : 128
}, })
pandora_listview: function(data) { .css({
!ui.item && that.value(data.value); float: 'left',
}, margin: '4px 0 0 4px'
pandora_itemview: function(data) { })
ui.item && that.value(data.value); .bindEvent({
} change: function(data) {
}); pandora.UI.set(viewKey, data.value);
},
pandora_listview: function(data) {
!ui.item && that.value(data.value);
},
pandora_itemview: function(data) {
ui.item && that.value(data.value);
}
});
return that; return that;
}; };