refactoring (intermediate state)
This commit is contained in:
parent
164961e562
commit
1f2bfe2f76
16 changed files with 206 additions and 169 deletions
|
|
@ -9,7 +9,7 @@ pandora.ui.backButton = function() {
|
|||
})
|
||||
.bindEvent({
|
||||
click: function() {
|
||||
pandora.UI.set({item: null});
|
||||
pandora.UI.set({item: ''});
|
||||
}
|
||||
});
|
||||
return that;
|
||||
|
|
|
|||
|
|
@ -80,7 +80,6 @@ pandora.ui.browser = function() {
|
|||
},
|
||||
select: function(data) {
|
||||
pandora.UI.set({
|
||||
'listSelection': data.ids,
|
||||
'item': data.ids[0]
|
||||
});
|
||||
},
|
||||
|
|
|
|||
|
|
@ -33,7 +33,9 @@ pandora.ui.contentPanel = function() {
|
|||
that.replaceElement(1, pandora.$ui.list = pandora.ui.list());
|
||||
},
|
||||
item: function(value) {
|
||||
value && that.replaceElement(1, pandora.$ui.item = pandora.ui.item());
|
||||
if (value && pandora.UI.getPrevious('item')) {
|
||||
that.replaceElement(1, pandora.$ui.item = pandora.ui.item());
|
||||
}
|
||||
},
|
||||
itemView: function() {
|
||||
that.replaceElement(1, pandora.$ui.item = pandora.ui.item());
|
||||
|
|
|
|||
|
|
@ -241,7 +241,7 @@ pandora.ui.folderList = function(id) {
|
|||
max: 1,
|
||||
min: 0,
|
||||
pageLength: 1000,
|
||||
selected: pandora.getListData().folder == id ? [pandora.user.ui.list] : [],
|
||||
//selected: pandora.getListData().folder == id ? [pandora.user.ui._list] : [],
|
||||
sort: [{key: 'position', operator: '+'}],
|
||||
sortable: id != 'featured' || pandora.user.level == 'admin'
|
||||
})
|
||||
|
|
|
|||
|
|
@ -113,17 +113,32 @@ pandora.ui.group = function(id) {
|
|||
// nothing selected
|
||||
find.conditions.splice(index, 1);
|
||||
if (find.conditions.length == 1) {
|
||||
find.operator = '&';
|
||||
if (find.conditions[0].conditions) {
|
||||
// unwrap single remaining bracketed query
|
||||
find = {
|
||||
conditions: find.conditions[0].conditions,
|
||||
operator: '|'
|
||||
};
|
||||
} else {
|
||||
find.operator = '&';
|
||||
}
|
||||
}
|
||||
} else if (conditions.length == 1) {
|
||||
// one item selected
|
||||
find.conditions[index] = conditions[0];
|
||||
} else {
|
||||
// multiple items selected
|
||||
find.conditions[index].conditions = conditions;
|
||||
find.conditions[index].operator = '|';
|
||||
delete find.conditions[index].key;
|
||||
delete find.conditions[index].value;
|
||||
if (pandora.user.ui.find.conditions.length == 1) {
|
||||
find = {
|
||||
conditions: conditions,
|
||||
operator: '|'
|
||||
};
|
||||
} else {
|
||||
find.conditions[index] = {
|
||||
conditions: conditions,
|
||||
operator: '|'
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
/*
|
||||
|
|
|
|||
|
|
@ -18,6 +18,22 @@ pandora.ui.mainPanel = function() {
|
|||
orientation: 'horizontal'
|
||||
});
|
||||
pandora.UI.bind({
|
||||
find: function() {
|
||||
var previousUI = pandora.UI.getPrevious();
|
||||
if (pandora.user.ui._list == previousUI._list) {
|
||||
pandora.$ui.list.reloadList();
|
||||
pandora.user.ui._groupsState.forEach(function(data, i) {
|
||||
if (!Ox.isEqual(data.selected, previousUI._groupsState[i].selected)) {
|
||||
pandora.$ui.groups[i].options({selected: data.selected});
|
||||
}
|
||||
if (!Ox.isEqual(data.find, previousUI._groupsState[i].find)) {
|
||||
pandora.$ui.groups[i].reloadList();
|
||||
}
|
||||
});
|
||||
} else {
|
||||
that.replaceElement(1, pandora.$ui.rightPanel = pandora.ui.rightPanel());
|
||||
}
|
||||
},
|
||||
item: function(value) {
|
||||
if (!value || !pandora.UI.getPrevious('item')) {
|
||||
that.replaceElement(1, pandora.$ui.rightPanel = pandora.ui.rightPanel());
|
||||
|
|
|
|||
|
|
@ -272,10 +272,11 @@ pandora.ui.mainMenu = function() {
|
|||
return { id: 'sortMenu', title: 'Sort', items: [
|
||||
{ id: 'sortmovies', title: 'Sort ' + (isClipView ? 'Clips' : pandora.site.itemName.plural) + ' by', items: [
|
||||
{ group: 'sortmovies', min: 1, max: 1, items: Ox.merge(isClipView ? Ox.merge(pandora.site.clipKeys.map(function(key) {
|
||||
return Ox.extend({
|
||||
checked: ui.listSort[0].key == key.id
|
||||
}, key);
|
||||
}), {}) : [], pandora.site.sortKeys.map(function(key) {
|
||||
return Ox.extend(Ox.clone(key), {
|
||||
checked: ui.listSort[0].key == key.id,
|
||||
title: 'Clip ' + key.title
|
||||
});
|
||||
}), /*{}*/[]) : [], pandora.site.sortKeys.map(function(key) {
|
||||
return Ox.extend({
|
||||
checked: ui.listSort[0].key == key.id
|
||||
}, key);
|
||||
|
|
@ -349,6 +350,15 @@ pandora.ui.mainMenu = function() {
|
|||
});
|
||||
});
|
||||
|
||||
pandora.UI.bind({
|
||||
listView: function(value) {
|
||||
if (pandora.isClipView() != pandora.isClipView(pandora.UI.getPrevious('listView'))) {
|
||||
that.replaceMenu('sortMenu', getSortMenu());
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
return that;
|
||||
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@ pandora.ui.orderButton = function() {
|
|||
key: pandora.user.ui.listSort[0].key,
|
||||
operator: pandora.user.ui.listSort[0].operator == '+' ? '-' : '+'
|
||||
}]
|
||||
})
|
||||
});
|
||||
that.options({title: getTitle()});
|
||||
}
|
||||
});
|
||||
|
|
|
|||
|
|
@ -58,22 +58,6 @@ pandora.ui.rightPanel = function() {
|
|||
});
|
||||
}
|
||||
pandora.UI.bind({
|
||||
find: function() {
|
||||
var previousUI = pandora.UI.getPrevious();
|
||||
if (pandora.user.ui.list == previousUI.list) {
|
||||
pandora.$ui.list.reloadList();
|
||||
pandora.user.ui._groupsState.forEach(function(data, i) {
|
||||
if (!Ox.isEqual(data.selected, previousUI._groupsState[i].selected)) {
|
||||
pandora.$ui.groups[i].options({selected: data.selected});
|
||||
}
|
||||
if (!Ox.isEqual(data.find, previousUI._groupsState[i].find)) {
|
||||
pandora.$ui.groups[i].reloadList();
|
||||
}
|
||||
});
|
||||
} else {
|
||||
that.replaceElement(1, pandora.$ui.contentPanel = pandora.ui.contentPanel());
|
||||
}
|
||||
},
|
||||
itemView: function(value) {
|
||||
if (pandora.isClipView() != pandora.isClipView(pandora.UI.getPrevious('itemView'))) {
|
||||
that.replaceElement(0, pandora.$ui.toolbar = pandora.ui.toolbar());
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ pandora.ui.sortSelect = function() {
|
|||
title: 'Sort by ' + (!pandora.user.ui.item ? 'Clip ' : '') + key.title
|
||||
});
|
||||
});
|
||||
!pandora.user.ui.item && items.push({});
|
||||
//!pandora.user.ui.item && items.push({});
|
||||
}
|
||||
if (!pandora.user.ui.item) {
|
||||
items = Ox.merge(items, pandora.site.sortKeys.map(function(key) {
|
||||
|
|
@ -32,19 +32,15 @@ pandora.ui.sortSelect = function() {
|
|||
.bindEvent({
|
||||
change: function(data) {
|
||||
pandora.UI.set(sortKey, [{key: data.selected[0].id, operator: ''}]);
|
||||
},
|
||||
pandora_listsort: function(data) {
|
||||
that.selectItem(data.value[0].key);
|
||||
},
|
||||
pandora_itemsort: function(value) {
|
||||
that.selectItem(data.value[0].key);
|
||||
}
|
||||
});
|
||||
pandora.UI.bind({
|
||||
listSort: function(value) {
|
||||
that.selectItem(value[0].key);
|
||||
},
|
||||
item: function(value) {
|
||||
|
||||
},
|
||||
itemSort: function(value) {
|
||||
that.selectItem(value[0].key);
|
||||
}
|
||||
});
|
||||
|
||||
return that;
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -25,6 +25,15 @@ pandora.ui.toolbar = function() {
|
|||
that.append(
|
||||
pandora.$ui.findElement = pandora.ui.findElement()
|
||||
);
|
||||
pandora.UI.bind({
|
||||
listView: function(value) {
|
||||
if (pandora.isClipView() != pandora.isClipView(pandora.UI.getPrevious('listView'))) {
|
||||
pandora.$ui.sortSelect.replaceWith(
|
||||
pandora.$ui.sortSelect = pandora.ui.sortSelect()
|
||||
);
|
||||
}
|
||||
}
|
||||
})
|
||||
return that;
|
||||
};
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue