forked from 0x2620/pandora
in viewSelect, add separator between standard and extra item views
This commit is contained in:
parent
4f3593a6b9
commit
5cee28bef1
1 changed files with 37 additions and 29 deletions
|
@ -6,35 +6,43 @@ 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
|
||||
})
|
||||
: null;
|
||||
}),
|
||||
value: ui[viewKey],
|
||||
width: !ui.item ? 144 : 128
|
||||
})
|
||||
.css({
|
||||
float: 'left',
|
||||
margin: '4px 0 0 4px'
|
||||
})
|
||||
.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);
|
||||
}
|
||||
});
|
||||
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
|
||||
})
|
||||
.css({
|
||||
float: 'left',
|
||||
margin: '4px 0 0 4px'
|
||||
})
|
||||
.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;
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in a new issue