make set of groups sticky

This commit is contained in:
rolux 2011-09-17 18:54:59 +00:00
parent c094b1c5fe
commit 412a5d2bbe

View file

@ -139,7 +139,8 @@ pandora.ui.group = function(id) {
type: 'image' type: 'image'
}) })
.bindEvent('change', function(data) { .bindEvent('change', function(data) {
var id_ = data.selected[0].id, var groups = Ox.clone(pandora.user.ui.groups),
id_ = data.selected[0].id,
i_ = pandora.user.ui.groups.indexOf(id_); i_ = pandora.user.ui.groups.indexOf(id_);
if (i_ == -1) { if (i_ == -1) {
// new group was not part of old group set // new group was not part of old group set
@ -150,17 +151,17 @@ pandora.ui.group = function(id) {
pandora.URL.push(pandora.Query.toString()); pandora.URL.push(pandora.Query.toString());
pandora.reloadGroups(i); pandora.reloadGroups(i);
} }
pandora.user.ui.groups[i] = id_; groups[i] = id_;
pandora.UI.set({groups: pandora.user.ui.groups}); pandora.UI.set({groups: groups});
replaceGroup(i, id_); replaceGroup(i, id_);
} else { } else {
// swap two existing groups // swap two existing groups
var groupsData = Ox.clone(pandora.user.ui.groupsData[i]); var groupsData = Ox.clone(pandora.user.ui.groupsData[i]);
pandora.user.ui.groupsData[i] = pandora.user.ui.groupsData[i_]; pandora.user.ui.groupsData[i] = pandora.user.ui.groupsData[i_];
pandora.user.ui.groupsData[i_] = groupsData; pandora.user.ui.groupsData[i_] = groupsData;
pandora.user.ui.groups[i] = id_; groups[i] = id_;
pandora.user.ui.groups[i_] = id; groups[i_] = id;
pandora.UI.set({groups: pandora.user.ui.groups}); pandora.UI.set({groups: groups});
replaceGroup(i, id_); replaceGroup(i, id_);
replaceGroup(i_, id); replaceGroup(i_, id);
} }
@ -179,7 +180,7 @@ pandora.ui.group = function(id) {
pandora.ui.groups = function() { pandora.ui.groups = function() {
var $groups = []; var $groups = [];
pandora.user.queryGroups = []; //pandora.user.queryGroups = [];
pandora.user.ui.groups.forEach(function(id, i) { pandora.user.ui.groups.forEach(function(id, i) {
$groups[i] = pandora.ui.group(id); $groups[i] = pandora.ui.group(id);
}); });