don't reload groups when changing list view or list sort
This commit is contained in:
parent
bd88297eb9
commit
ef30225ed7
6 changed files with 41 additions and 17 deletions
|
@ -78,7 +78,6 @@ pandora.URL = (function() {
|
|||
url = '/' + url;
|
||||
}
|
||||
history.pushState({}, pandora.site.site.name + (title ? ' - ' + title : ''), url);
|
||||
oldUserUI = Ox.clone(pandora.user.ui);
|
||||
this.update();
|
||||
},
|
||||
|
||||
|
@ -97,18 +96,39 @@ pandora.URL = (function() {
|
|||
});
|
||||
},
|
||||
|
||||
push: function(title, url) {
|
||||
if (arguments.length == 1) { // fixme: remove later
|
||||
url = title;
|
||||
}
|
||||
if (url[0] != '/') {
|
||||
url = '/' + url;
|
||||
}
|
||||
history.pushState({}, pandora.site.site.name + (title ? ' - ' + title : ''), url);
|
||||
},
|
||||
|
||||
update: function() {
|
||||
var oldUserUI = Ox.clone(pandora.user.ui);
|
||||
this.parse();
|
||||
if (pandora.user.ui.section != oldUserUI.section) {
|
||||
pandora.$ui.appPanel.replaceElement(1, pandora.$ui.mainPanel = pandora.ui.mainPanel());
|
||||
} else if (pandora.user.ui.sitePage != oldUserUI.sitePage) {
|
||||
pandora.$ui.mainPanel.replaceElement(1, pandora.$ui.rightPanel = pandora.ui.rightPanel());
|
||||
} else if (!pandora.user.ui.item && !oldUserUI.item) {
|
||||
// list to list
|
||||
// fixme: isEqual doesn't work here
|
||||
if (Ox.isEqual(pandora.user.ui.findQuery, oldUserUI.findQuery) && false) {
|
||||
Ox.print('EQUAL', pandora.user.ui.findQuery, oldUserUI.findQuery)
|
||||
pandora.$ui.contentPanel.replaceElement(1, pandora.ui.list());
|
||||
} else {
|
||||
pandora.$ui.leftPanel.replaceElement(2, pandora.$ui.info = pandora.ui.info());
|
||||
pandora.$ui.mainPanel.replaceElement(1, pandora.$ui.rightPanel = pandora.ui.rightPanel());
|
||||
}
|
||||
} else if (!pandora.user.ui.item || !oldUserUI.item) {
|
||||
// list to list, list to item, item to list
|
||||
// list to item or item to list
|
||||
pandora.$ui.leftPanel.replaceElement(2, pandora.$ui.info = pandora.ui.info());
|
||||
pandora.$ui.mainPanel.replaceElement(1, pandora.$ui.rightPanel = pandora.ui.rightPanel());
|
||||
} else {
|
||||
// item to items
|
||||
// item to item
|
||||
pandora.$ui.leftPanel.replaceElement(2, pandora.$ui.info = pandora.ui.info());
|
||||
pandora.$ui.contentPanel.replaceElement(1, pandora.ui.item());
|
||||
}
|
||||
|
|
|
@ -130,7 +130,7 @@ pandora.reloadGroups = function(i) {
|
|||
});
|
||||
}
|
||||
});
|
||||
history.pushState({}, '', pandora.Query.toString());
|
||||
pandora.URL.push(pandora.Query.toString());
|
||||
};
|
||||
|
||||
pandora.getListData = function() {
|
||||
|
|
|
@ -47,6 +47,7 @@ pandora.ui.list = function() { // fixme: remove view argument
|
|||
}), callback);
|
||||
},
|
||||
scrollbarVisible: true,
|
||||
selected: pandora.user.ui.lists[pandora.user.ui.list].selected,
|
||||
sort: pandora.user.ui.lists[pandora.user.ui.list].sort
|
||||
})
|
||||
.bindEvent({
|
||||
|
@ -413,7 +414,8 @@ pandora.ui.list = function() { // fixme: remove view argument
|
|||
},
|
||||
select: function(event, data) {
|
||||
var $still, $timeline;
|
||||
pandora.user.ui.lists[pandora.user.ui.list].selected = data.ids;
|
||||
pandora.UI.set(['lists', pandora.user.ui.list, 'selected'].join('|'), data.ids);
|
||||
//pandora.user.ui.lists[pandora.user.ui.list].selected = data.ids;
|
||||
if (data.ids.length) {
|
||||
pandora.$ui.mainMenu.enableItem('copy');
|
||||
pandora.$ui.mainMenu.enableItem('openmovie');
|
||||
|
@ -438,6 +440,7 @@ pandora.ui.list = function() { // fixme: remove view argument
|
|||
});
|
||||
},
|
||||
sort: function(event, data) {
|
||||
Ox.print('--SORT--', pandora.user.ui.sort[0].key)
|
||||
/* some magic has already set user.ui.sort
|
||||
Ox.print(':', user.ui.sort[0])
|
||||
if (data.key != user.ui.sort[0].key) {
|
||||
|
|
|
@ -17,18 +17,17 @@ pandora.ui.sortSelect = function() {
|
|||
})
|
||||
.bindEvent({
|
||||
change: function(event, data) {
|
||||
var id = data.selected[0].id,
|
||||
operator = pandora.getSortOperator(id);
|
||||
/*
|
||||
pandora.user.ui.lists[pandora.user.ui.list].sort[0] = {
|
||||
key: id,
|
||||
operator: operator
|
||||
};
|
||||
*/
|
||||
pandora.$ui.mainMenu.checkItem('sortMenu_sortmovies_' + id);
|
||||
var key = data.selected[0].id,
|
||||
operator = pandora.getSortOperator(key);
|
||||
pandora.$ui.mainMenu.checkItem('sortMenu_sortmovies_' + key);
|
||||
pandora.$ui.mainMenu.checkItem('sortMenu_ordermovies_' + (operator === '' ? 'ascending' : 'descending'));
|
||||
pandora.$ui.list.sortList(id, operator);
|
||||
pandora.URL.set(pandora.Query.toString());
|
||||
pandora.$ui.list.options({
|
||||
sort: [{key: key, operator: operator}]
|
||||
});
|
||||
// fixme: why does this not work??
|
||||
//pandora.UI.set(['lists', pandora.user.ui.list, 'sort'].join('|'), [{key: key, operator: operator}]);
|
||||
pandora.user.ui.lists[pandora.user.ui.list].sort[0] = {key: key, operator: operator};
|
||||
pandora.URL.push(pandora.Query.toString());
|
||||
}
|
||||
});
|
||||
return that;
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
// vim: et:ts=4:sw=4:sts=4:ft=javascript
|
||||
|
||||
pandora.ui.toolbar = function() {
|
||||
var that = Ox.Bar({
|
||||
size: 24
|
||||
|
|
|
@ -26,7 +26,8 @@ pandora.ui.viewSelect = function() {
|
|||
var id = data.selected[0].id;
|
||||
pandora.$ui.mainMenu.checkItem('viewMenu_movies_' + id);
|
||||
pandora.UI.set(['lists', pandora.user.ui.list, 'listView'].join('|'), id);
|
||||
pandora.URL.set(pandora.Query.toString());
|
||||
pandora.$ui.contentPanel.replaceElement(1, pandora.$ui.list = pandora.ui.list());
|
||||
pandora.URL.push(pandora.Query.toString());
|
||||
} : function(event, data) {
|
||||
var id = data.selected[0].id;
|
||||
//pandora.UI.set({itemView: id});
|
||||
|
|
Loading…
Reference in a new issue