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