refactoring (intermediate state)

This commit is contained in:
rolux 2011-09-28 00:10:26 +00:00
commit ce8656ef53
11 changed files with 46 additions and 38 deletions

View file

@ -98,7 +98,7 @@ pandora.ui.browser = function() {
}).reloadList(true);
},
pandora_showsiteposter: function() {
pandora.user.ui.icons == 'poster' && that.reloadList(true);
pandora.user.ui.icons == 'posters' && that.reloadList(true);
}
});
pandora.enableDragAndDrop(that, false);

View file

@ -4,7 +4,7 @@ pandora.ui.findElement = function() {
findKey = pandora.user.ui._findState.key,
findValue = pandora.user.ui._findState.value;
var that = Ox.FormElementGroup({
elements: Ox.merge(pandora.user.ui.list ? [
elements: Ox.merge(pandora.user.ui._list ? [
pandora.$ui.findListSelect = Ox.Select({
items: [
{id: 'all', title: 'Find: All ' + pandora.site.itemName.plural},
@ -74,7 +74,7 @@ pandora.ui.findElement = function() {
}
},
submit: function(data) {
var findInList = pandora.user.ui.list
var findInList = pandora.user.ui._list
&& pandora.$ui.findListSelect.value() == 'list',
key = pandora.$ui.findSelect.value(),
conditions = data.value ? [{
@ -86,7 +86,7 @@ pandora.ui.findElement = function() {
pandora.UI.set('find', {
conditions: Ox.merge([{
key: 'list',
value: pandora.user.ui.list,
value: pandora.user.ui._list,
operator: '=='
}], conditions),
operator: '&'
@ -94,7 +94,7 @@ pandora.ui.findElement = function() {
// fixme: what was this?
// data.value && findIndex == 0 && pandora.user.ui.find.conditions.reverse();
} else {
if (pandora.user.ui.list) {
if (pandora.user.ui._list) {
Ox.forEach(pandora.$ui.folderList, function($list) {
$list.options({selected: []});
});
@ -117,7 +117,7 @@ pandora.ui.findElement = function() {
function autocompleteFunction() {
return pandora.user.ui.find.conditions.length ? function(value, callback) {
var elementValue = that.value(),
key = elementValue[pandora.user.ui.list ? 1 : 0],
key = elementValue[pandora.user.ui._list ? 1 : 0],
findKey = Ox.getObjectById(pandora.site.findKeys, key);
value === '' && Ox.print('Warning: autocomplete function should never be called with empty value');
if (findKey.autocomplete) {
@ -125,7 +125,7 @@ pandora.ui.findElement = function() {
key: key,
query: {
conditions: pandora.$ui.findListSelect.value() == 'list'
? [{key: 'list', value: pandora.user.ui.list, operator: '=='}] : [],
? [{key: 'list', value: pandora.user.ui._list, operator: '=='}] : [],
operator: '&'
},
range: [0, 20],

View file

@ -130,7 +130,7 @@ pandora.ui.folderBrowserList = function(id) {
// not-featured list may be in the user's favorites folder
keys: id == 'featured' ? ['subscribed'] : [],
pageLength: 1000,
selected: pandora.getListData().folder == id ? [pandora.user.ui.list] : [],
selected: pandora.getListData().folder == id ? [pandora.user.ui._list] : [],
sort: [
{key: 'name', operator: '+'}
]
@ -181,16 +181,20 @@ pandora.ui.folderBrowserList = function(id) {
},
select: function(data) {
// fixme: duplicated
if (data.ids.length) {
var list = data.ids.length ? data.ids[0] : '';
if (list) {
Ox.forEach(pandora.$ui.folderList, function($list, id_) {
id != id_ && $list.options('selected', []);
});
//pandora.UI.set({list: data.ids[0]});
pandora.URL.set('?find=list:' + data.ids[0]);
} else {
//pandora.UI.set({list: ''});
pandora.URL.set('');
}
pandora.UI.set({
find: {
conditions: list ? [
{key: 'list', value: data.ids[0], operator: '=='}
] : [],
operator: '&'
}
});
}
});
return that;

View file

@ -16,7 +16,7 @@ pandora.ui.info = function() {
});
Ox.print('INFO', view)
if (view == 'list') {
that.empty().append(pandora.$ui.listInfo = pandora.ui.listInfo(pandora.user.ui.list));
that.empty().append(pandora.$ui.listInfo = pandora.ui.listInfo(pandora.user.ui._list));
} else if (view == 'poster') {
pandora.api.get({id: id, keys: ['director', 'posterRatio', 'title']}, function(result) {
var ratio = result.data.posterRatio,
@ -75,10 +75,10 @@ pandora.ui.info = function() {
pandora.ui.listInfo = function(data) {
var that = $('<div>').css({padding: '16px', textAlign: 'center'});
var $icon = $('<img>')
.attr({src: !pandora.user.ui.list ? '/static/png/icon256.png' : Ox.UI.getImageURL('symbolIcon')})
.attr({src: !pandora.user.ui._list ? '/static/png/icon256.png' : Ox.UI.getImageURL('symbolIcon')})
.css(getIconCSS())
.appendTo(that);
$('<div>').css({padding: '16px 0 16px 0', fontWeight: 'bold'}).html(!pandora.user.ui.list ? 'All Movies' : pandora.user.ui.list.replace(':', ': ')).appendTo(that);
$('<div>').css({padding: '16px 0 16px 0', fontWeight: 'bold'}).html(!pandora.user.ui._list ? 'All Movies' : pandora.user.ui._list.replace(':', ': ')).appendTo(that);
$('<div>').css({textAlign: 'left'}).html(Ox.repeat('This is the list info text. ', 10)).appendTo(that);
function getIconCSS() {
var size = Math.round(pandora.user.ui.sidebarSize / 2);

View file

@ -518,7 +518,7 @@ pandora.ui.infoView = function(data) {
that.bindEvent({
pandora_icons: that.reload,
pandora_showsiteposter: function() {
pandora.user.ui.icons == 'poster' && that.reload();
pandora.user.ui.icons == 'posters' && that.reload();
}
});

View file

@ -550,7 +550,7 @@ pandora.ui.list = function() {
},
'delete': function(data) {
pandora.getListData().editable && pandora.api.removeListItems({
list: pandora.user.ui.list,
list: pandora.user.ui._list,
items: data.ids
}, pandora.reloadList);
},
@ -641,7 +641,7 @@ pandora.ui.list = function() {
},
paste: function(data) {
data.items && pandora.getListData().editable && pandora.api.addListItems({
list: pandora.user.ui.list,
list: pandora.user.ui._list,
items: data.items
}, pandora.reloadList);
},
@ -689,7 +689,7 @@ pandora.ui.list = function() {
}).reloadList(true);
},
pandora_showsiteposter: function() {
pandora.user.ui.icons == 'poster' && that.reloadList(true);
pandora.user.ui.icons == 'posters' && that.reloadList(true);
}
});
}

View file

@ -251,7 +251,7 @@ pandora.ui.mainMenu = function() {
return {
id: 'viewlist' + list.id,
title: (folder == 'favorite' ? list.user + ': ' : '') + list.name,
checked: list.id == pandora.user.ui.list
checked: list.id == pandora.user.ui._list
};
}) : [{id: 'loading', title: 'Loading...', disabled: true}]
}]