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, 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'
|| ['data', 'files'].indexOf(view.id) == -1
|| pandora.site.capabilities.canSeeExtraItemViews[pandora.user.level]
? Ox.extend(Ox.clone(view), {
title: 'View ' + view.title
})
: null; : 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], value: ui[viewKey],
width: !ui.item ? 144 : 128 width: !ui.item ? 144 : 128
}) })