forked from 0x2620/pandora
fix bugs with navigation to or away from view list as clips
This commit is contained in:
parent
545fa1acfc
commit
199211c6aa
2 changed files with 18 additions and 10 deletions
|
@ -1,8 +1,9 @@
|
||||||
// vim: et:ts=4:sw=4:sts=4:ft=javascript
|
// vim: et:ts=4:sw=4:sts=4:ft=javascript
|
||||||
|
|
||||||
pandora.ui.viewSelect = function() {
|
pandora.ui.viewSelect = function() {
|
||||||
var sortKey = !pandora.user.ui.item ? 'listSort' : 'itemSort',
|
var ui = pandora.user.ui,
|
||||||
viewKey = !pandora.user.ui.item ? 'listView' : 'itemView',
|
sortKey = !ui.item ? 'listSort' : 'itemSort',
|
||||||
|
viewKey = !ui.item ? 'listView' : 'itemView',
|
||||||
that = Ox.Select({
|
that = Ox.Select({
|
||||||
id: 'viewSelect',
|
id: 'viewSelect',
|
||||||
items: Ox.map(pandora.site[viewKey + 's'], function(view) {
|
items: Ox.map(pandora.site[viewKey + 's'], function(view) {
|
||||||
|
@ -10,12 +11,12 @@ pandora.ui.viewSelect = function() {
|
||||||
|| ['data', 'files'].indexOf(view.id) == -1
|
|| ['data', 'files'].indexOf(view.id) == -1
|
||||||
|| pandora.site.capabilities.canSeeExtraItemViews[pandora.user.level]
|
|| pandora.site.capabilities.canSeeExtraItemViews[pandora.user.level]
|
||||||
? Ox.extend(Ox.clone(view), {
|
? Ox.extend(Ox.clone(view), {
|
||||||
checked: view.id == pandora.user.ui[viewKey],
|
checked: view.id == ui[viewKey],
|
||||||
title: 'View ' + view.title
|
title: 'View ' + view.title
|
||||||
})
|
})
|
||||||
: null;
|
: null;
|
||||||
}),
|
}),
|
||||||
width: !pandora.user.ui.item ? 144 : 128
|
width: !ui.item ? 144 : 128
|
||||||
})
|
})
|
||||||
.css({
|
.css({
|
||||||
float: 'left',
|
float: 'left',
|
||||||
|
@ -25,12 +26,17 @@ pandora.ui.viewSelect = function() {
|
||||||
change: function(data) {
|
change: function(data) {
|
||||||
var key = data.selected[0].id,
|
var key = data.selected[0].id,
|
||||||
set = {};
|
set = {};
|
||||||
set[viewKey] = key
|
set[viewKey] = key;
|
||||||
if (
|
if (!ui.item) {
|
||||||
!pandora.isClipView(key, pandora.user.ui.item)
|
// when changing the list view ...
|
||||||
&& ['title', 'position'].indexOf(pandora.user.ui[sortKey][0].key) > -1
|
if (pandora.isClipView(key)) {
|
||||||
) {
|
// ... to a clip view, set listSelection to empty
|
||||||
set[sortKey] = pandora.site.user.ui.listSort;
|
set.listSelection = [];
|
||||||
|
} else if (['title', 'position'].indexOf(ui.listSort[0].key) > -1) {
|
||||||
|
// ... to a non-clip view, with a sort key that only exists
|
||||||
|
// in clip views, reset listSort to the default listSort
|
||||||
|
set.listSort = pandora.site.user.ui.listSort;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
pandora.UI.set(set);
|
pandora.UI.set(set);
|
||||||
},
|
},
|
||||||
|
|
|
@ -632,6 +632,8 @@ pandora.isClipView = function(view, item) {
|
||||||
if (arguments.length == 0) {
|
if (arguments.length == 0) {
|
||||||
item = pandora.user.ui.item;
|
item = pandora.user.ui.item;
|
||||||
view = !item ? pandora.user.ui.listView : pandora.user.ui.itemView;
|
view = !item ? pandora.user.ui.listView : pandora.user.ui.itemView;
|
||||||
|
} else if (arguments.length == 1) {
|
||||||
|
item = pandora.user.ui.item;
|
||||||
}
|
}
|
||||||
return (
|
return (
|
||||||
!item ? ['calendar', 'clip', 'map'] : ['calendar', 'clips', 'map']
|
!item ? ['calendar', 'clip', 'map'] : ['calendar', 'clips', 'map']
|
||||||
|
|
Loading…
Reference in a new issue