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,17 +6,25 @@ pandora.ui.viewSelect = function() {
var ui = pandora.user.ui,
sortKey = !ui.item ? 'listSort' : 'itemSort',
viewKey = !ui.item ? 'listView' : 'itemView',
that = Ox.Select({
id: 'viewSelect',
items: Ox.map(pandora.site[viewKey + 's'], function(view) {
return viewKey == 'listView'
|| ['data', 'files'].indexOf(view.id) == -1
|| pandora.site.capabilities.canSeeExtraItemViews[pandora.user.level]
? Ox.extend(Ox.clone(view), {
title: 'View ' + view.title
})
items = Ox.map(pandora.site[viewKey + 's'], function(view) {
return ['data', 'files'].indexOf(view.id) == -1
? {id: view.id, title: 'View ' + view.title}
: null;
}),
that;
if (
viewKey == 'itemView'
&& pandora.site.capabilities.canSeeExtraItemViews[pandora.user.level]
) {
Ox.merge(items, [
{},
{id: 'data', title: 'View Data'},
{id: 'files', title: 'View Files'}
]);
}
that = Ox.Select({
id: 'viewSelect',
items: items,
value: ui[viewKey],
width: !ui.item ? 144 : 128
})