better mapping between find query string and lists, find input, groups
This commit is contained in:
parent
16b998f760
commit
a8b30f5a48
9 changed files with 347 additions and 329 deletions
|
@ -513,17 +513,14 @@
|
||||||
"preferences": {},
|
"preferences": {},
|
||||||
"ui": {
|
"ui": {
|
||||||
"annotationsSize": 256,
|
"annotationsSize": 256,
|
||||||
"findKey": "",
|
"find": {"index": -1, "key": "", "value": ""},
|
||||||
"findQuery": {"conditions": [], "operator": ""},
|
|
||||||
"groups": ["director", "country", "year", "language", "genre"],
|
"groups": ["director", "country", "year", "language", "genre"],
|
||||||
"groupsQuery": {"conditions": [], "operator": "|"},
|
|
||||||
"groupsSize": 176,
|
"groupsSize": 176,
|
||||||
"icons": "posters",
|
"icons": "posters",
|
||||||
"infoIconSize": 256,
|
"infoIconSize": 256,
|
||||||
"item": "",
|
"item": "",
|
||||||
"itemView": "info",
|
"itemView": "info",
|
||||||
"list": "",
|
"list": "",
|
||||||
"listQuery": {"conditions": [], "operator": ""},
|
|
||||||
"lists": {
|
"lists": {
|
||||||
"": {
|
"": {
|
||||||
"columns": ["title", "director", "country", "year", "language", "runtime", "genre"],
|
"columns": ["title", "director", "country", "year", "language", "runtime", "genre"],
|
||||||
|
@ -535,6 +532,7 @@
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"query": {"conditions": [], "operator": ""},
|
||||||
"section": "items",
|
"section": "items",
|
||||||
"showAnnotations": true,
|
"showAnnotations": true,
|
||||||
"showControls": true,
|
"showControls": true,
|
||||||
|
|
|
@ -1,16 +1,100 @@
|
||||||
// vim: et:ts=4:sw=4:sts=4:ft=javascript
|
// vim: et:ts=4:sw=4:sts=4:ft=javascript
|
||||||
pandora.Query = (function() {
|
pandora.Query = (function() {
|
||||||
|
|
||||||
function parseFind2(str) {
|
function constructFind(query) {
|
||||||
|
return /*encodeURI(*/query.conditions.map(function(condition) {
|
||||||
|
var ret;
|
||||||
|
if (condition.conditions) {
|
||||||
|
ret = '[' + constructFind(condition) + ']';
|
||||||
|
} else {
|
||||||
|
ret = condition.value !== ''
|
||||||
|
? condition.key + (condition.key ? ':' : '')
|
||||||
|
+ constructValue(condition.value, condition.operator)
|
||||||
|
: null;
|
||||||
|
}
|
||||||
|
return ret;
|
||||||
|
}).join(query.operator == '&' ? ',' : '|')/*)*/;
|
||||||
|
}
|
||||||
|
|
||||||
|
function constructValue(value, operator) {
|
||||||
|
operator = operator.replace('=', '^$');
|
||||||
|
if (operator.indexOf('$') > -1) {
|
||||||
|
value = operator.substr(0, operator.length - 1) + value + '$';
|
||||||
|
} else {
|
||||||
|
value = operator + value;
|
||||||
|
}
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
|
||||||
|
function everyCondition(conditions, key, operator) {
|
||||||
|
// if every condition has the given key and operator
|
||||||
|
// (excluding conditions where all subconditions match)
|
||||||
|
// returns true, otherwise false
|
||||||
|
return Ox.every(conditions, function(condition) {
|
||||||
|
return condition.key == key && condition.operator == operator;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function getGroupsData() {
|
||||||
|
// a group is selected if exactly one condition in an & query
|
||||||
|
// or every condition in an | query
|
||||||
|
// has the group id as key and "=" as operator
|
||||||
|
return pandora.user.ui.groups.map(function(key) {
|
||||||
|
var index = -1,
|
||||||
|
query = Ox.clone(pandora.user.ui.query, true),
|
||||||
|
selected = [];
|
||||||
|
if (query.operator == '|') {
|
||||||
|
if (everyCondition(query.conditions, key, '=')) {
|
||||||
|
index = Ox.range(query.conditions.length);
|
||||||
|
selected = query.conditions.map(function(condition) {
|
||||||
|
return condition.value;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
index = oneCondition(query.conditions, key, '=');
|
||||||
|
if (index > -1) {
|
||||||
|
selected = query.conditions[index].conditions
|
||||||
|
? query.conditions[index].conditions.map(function(condition) {
|
||||||
|
return condition.value;
|
||||||
|
})
|
||||||
|
: [query.conditions[index].value];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (selected.length) {
|
||||||
|
if (Ox.isArray(index)) {
|
||||||
|
query = {conditions: [], operator: ''};
|
||||||
|
} else {
|
||||||
|
query.conditions.splice(index, 1);
|
||||||
|
if (query.conditions.length == 1) {
|
||||||
|
if (query.conditions[0].conditions) {
|
||||||
|
// unwrap single remaining bracketed query
|
||||||
|
query = {
|
||||||
|
conditions: query.conditions[0].conditions,
|
||||||
|
operator: query.conditions[0].operator
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
query.operator = '';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return {
|
||||||
|
index: index,
|
||||||
|
query: query,
|
||||||
|
selected: selected
|
||||||
|
};
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function parseFind(str) {
|
||||||
// takes a find query string, returns useful information about the application's state
|
// takes a find query string, returns useful information about the application's state
|
||||||
// (selected lists, find input key/value, group queries and selection, query object)
|
// (selected lists, find input key/value (and index of the corresponding condition), query object)
|
||||||
Ox.print('parseFind2', str)
|
|
||||||
str = str || '';
|
str = str || '';
|
||||||
var conditions,
|
var conditions,
|
||||||
|
index, indices,
|
||||||
ret = {
|
ret = {
|
||||||
find: {key: '', value: ''},
|
find: {index: -1, key: '', value: ''},
|
||||||
groups: [],
|
list: '',
|
||||||
lists: [],
|
|
||||||
query: {conditions: [], operator: ''}
|
query: {conditions: [], operator: ''}
|
||||||
},
|
},
|
||||||
subconditions = str.match(/\[.*?\]/g) || [];
|
subconditions = str.match(/\[.*?\]/g) || [];
|
||||||
|
@ -31,161 +115,61 @@ pandora.Query = (function() {
|
||||||
var kv, ret;
|
var kv, ret;
|
||||||
if (condition[0] == '[') {
|
if (condition[0] == '[') {
|
||||||
// re-insert subcondition
|
// re-insert subcondition
|
||||||
ret = parseFind2(subconditions[parseInt(condition.substr(1, condition.length - 2))]).query;
|
ret = parseFind(subconditions[parseInt(condition.substr(1, condition.length - 2))]).query;
|
||||||
} else {
|
} else {
|
||||||
kv = ((condition.indexOf(':') > -1 ? '' : ':') + condition).split(':');
|
kv = ((condition.indexOf(':') > -1 ? '' : ':') + condition).split(':');
|
||||||
ret = Ox.extend({key: kv[0]}, parseValue(kv[1]));
|
ret = Ox.extend({key: kv[0]}, parseValue(kv[1]));
|
||||||
}
|
}
|
||||||
return ret;
|
return ret;
|
||||||
});
|
});
|
||||||
// lists are selected if exactly one condition in an & query
|
// a list is selected if exactly one condition in an & query
|
||||||
// or every condition in an | query
|
|
||||||
// has "list" as key and "" as operator
|
// has "list" as key and "" as operator
|
||||||
ret.lists = ret.query.operator == '|'
|
if (ret.query.operator != '|') {
|
||||||
? everyCondition(ret.query.conditions, 'list', '')
|
index = oneCondition(ret.query.conditions, 'list', '');
|
||||||
: oneCondition(ret.query.conditions, 'list', '');
|
if (index > -1 && !ret.query.conditions[index].conditions) {
|
||||||
|
ret.list = ret.query.conditions[index].value;
|
||||||
|
}
|
||||||
|
}
|
||||||
// find is populated if exactly one condition in an & query
|
// find is populated if exactly one condition in an & query
|
||||||
// has a findKey as key and "" as operator
|
// has a findKey as key and "" as operator
|
||||||
|
// or if all conditions in an | query have the same group id as key
|
||||||
if (ret.query.operator == '|') {
|
if (ret.query.operator == '|') {
|
||||||
ret.find = {key: 'advanced', value: ''};
|
ret.find = {index: -1, key: 'advanced', value: ''};
|
||||||
} else {
|
Ox.map(pandora.user.ui.groups, function(key) {
|
||||||
conditions = Ox.map(pandora.site.findKeys, function(findKey) {
|
if (everyCondition(ret.query.conditions, key, '=')) {
|
||||||
var values = oneCondition(ret.query.conditions, findKey.id, '');
|
ret.find.key = '';
|
||||||
return values.length ? {key: findKey.id, values: values} : null;
|
return false;
|
||||||
});
|
|
||||||
ret.find = conditions.length == 0 ? {key: '', value: ''}
|
|
||||||
: conditions.length == 1 && conditions[0].values.length == 1
|
|
||||||
? {key: conditions[0].key, value: conditions[0].values[0]}
|
|
||||||
: {key: 'advanced', value: ''}
|
|
||||||
}
|
|
||||||
// a group is selected if exactly one condition in an & query
|
|
||||||
// or every condition in an | query
|
|
||||||
// has the group id as key and "=" as operator
|
|
||||||
ret.groups = pandora.user.ui.groups.map(function(key) {
|
|
||||||
var selected = ret.query.operator == '|'
|
|
||||||
? everyCondition(ret.query.conditions, key, '=')
|
|
||||||
: oneCondition(ret.query.conditions, key, '='),
|
|
||||||
query = ret.query;
|
|
||||||
if (selected.length) {
|
|
||||||
query = {
|
|
||||||
conditions: Ox.map(ret.query.conditions, function(condition) {
|
|
||||||
var ret;
|
|
||||||
if (condition.conditions) {
|
|
||||||
ret = condition.conditions[0].key != key ? condition : null; // fixme: correct? see below...
|
|
||||||
} else {
|
|
||||||
ret = condition.key != key ? condition : null;
|
|
||||||
}
|
|
||||||
return ret;
|
|
||||||
}),
|
|
||||||
operator: ''
|
|
||||||
};
|
|
||||||
if (query.conditions.length == 1) {
|
|
||||||
if (query.conditions[0].conditions) {
|
|
||||||
// unwrap single remaining bracketed query
|
|
||||||
query = {
|
|
||||||
conditions: query.conditions[0].conditions,
|
|
||||||
operator: query.conditions[0].operator
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
query.operator = '';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return {
|
|
||||||
query: query,
|
|
||||||
selected: selected
|
|
||||||
};
|
|
||||||
});
|
|
||||||
function oneCondition(conditions, key, operator) {
|
|
||||||
// if exactly one condition has the given key and operator
|
|
||||||
// (including conditions where all subconditions match)
|
|
||||||
// returns the corresponding value(s), otherwise returns []
|
|
||||||
var values = Ox.map(conditions, function(condition) {
|
|
||||||
var ret, same;
|
|
||||||
if (condition.conditions) {
|
|
||||||
var every = everyCondition(condition.conditions, key, operator); // fixme: what if [key|key],[key|other]?
|
|
||||||
ret = every.length ? every : null;
|
|
||||||
} else {
|
|
||||||
ret = condition.key == key && condition.operator == operator ? [condition.value] : null
|
|
||||||
}
|
}
|
||||||
return ret;
|
|
||||||
});
|
});
|
||||||
return values.length == 1 ? values[0] : [];
|
} else {
|
||||||
}
|
indices = Ox.map(pandora.site.findKeys, function(findKey) {
|
||||||
function everyCondition(conditions, key, operator) {
|
var key = findKey.id == 'all' ? '' : findKey.id,
|
||||||
// if every condition has the given key and operator
|
index = oneCondition(ret.query.conditions, key, '');
|
||||||
// (excluding conditions where all subconditions match)
|
return index > -1 ? index : null;
|
||||||
// returns the corresponding value(s), otherwise returns []
|
|
||||||
var values = Ox.map(conditions, function(condition) {
|
|
||||||
return condition.key == key && condition.operator == operator ? condition.value : null
|
|
||||||
});
|
});
|
||||||
return values.length == conditions.length ? values : [];
|
if (indices.length) {
|
||||||
|
ret.find = indices.length == 1 && !ret.query.conditions[indices[0]].conditions ? {
|
||||||
|
index: indices[0],
|
||||||
|
key: ret.query.conditions[indices[0]].key,
|
||||||
|
value: ret.query.conditions[indices[0]].value
|
||||||
|
} : {index: -1, key: 'advanced', value: ''}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
function constructFind(query) {
|
function oneCondition(conditions, key, operator) {
|
||||||
//Ox.print('cF', query)
|
// if exactly one condition has the given key and operator
|
||||||
return /*encodeURI(*/$.map(query.conditions, function(v, i) {
|
// (including conditions where all subconditions match)
|
||||||
if (!Ox.isUndefined(v.conditions)) {
|
// returns the corresponding index, otherwise returns -1
|
||||||
return '[' + constructFind(v) + ']';
|
var indices = Ox.map(conditions, function(condition, i) {
|
||||||
} else {
|
return (
|
||||||
return v.value !== '' ? v.key + (v.key ? ':' : '') + constructValue(v.value, v.operator) : null;
|
condition.conditions
|
||||||
}
|
? everyCondition(condition.conditions, key, operator)
|
||||||
}).join(query.operator)/*)*/;
|
: condition.key == key && condition.operator == operator
|
||||||
}
|
) ? i : null;
|
||||||
|
|
||||||
function constructValue(value, operator) {
|
|
||||||
operator = operator.replace('=', '^$');
|
|
||||||
if (operator.indexOf('$') > -1) {
|
|
||||||
value = operator.substr(0, operator.length - 1) + value + '$';
|
|
||||||
} else {
|
|
||||||
value = operator + value;
|
|
||||||
}
|
|
||||||
return value;
|
|
||||||
}
|
|
||||||
|
|
||||||
function mergeFind() {
|
|
||||||
}
|
|
||||||
|
|
||||||
function parseFind(str) {
|
|
||||||
str = str || '';
|
|
||||||
var find = {
|
|
||||||
conditions: [],
|
|
||||||
operator: ''
|
|
||||||
},
|
|
||||||
subconditions = str.match(/\[.*?\]/g) || [];
|
|
||||||
$.each(subconditions, function(i, v) {
|
|
||||||
subconditions[i] = v.substr(1, v.length - 2);
|
|
||||||
str = str.replace(v, '[' + i + ']');
|
|
||||||
});
|
});
|
||||||
if (str.indexOf(',') > -1) {
|
return indices.length == 1 ? indices[0] : -1;
|
||||||
find.operator = '&';
|
|
||||||
} else if (str.indexOf('|') > -1) {
|
|
||||||
find.operator = '|';
|
|
||||||
}
|
|
||||||
//Ox.print('pF', str, find.operator)
|
|
||||||
find.conditions = $.map(find.operator === '' ? [str] : str.split(find.operator == '&' ? ',' : '|'), function(v, i) {
|
|
||||||
//Ox.print('v', v)
|
|
||||||
var ret, kv;
|
|
||||||
if (v[0] == '[') {
|
|
||||||
//Ox.print('recursion', subconditions)
|
|
||||||
ret = parseFind(subconditions[parseInt(v.substr(1, v.length - 2))]);
|
|
||||||
} else {
|
|
||||||
kv = ((v.indexOf(':') > - 1 ? '' : ':') + v).split(':');
|
|
||||||
if (kv[0] == 'list') { // fixme: this is just a hack
|
|
||||||
pandora.user.ui.listQuery = {conditions: [$.extend({
|
|
||||||
key: kv[0]
|
|
||||||
}, parseValue(kv[1]))], operator: ''};
|
|
||||||
} else {
|
|
||||||
ret = $.extend({
|
|
||||||
key: kv[0]
|
|
||||||
}, parseValue(kv[1]));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return ret;
|
|
||||||
});
|
|
||||||
return find;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function parseValue(str) {
|
function parseValue(str) {
|
||||||
|
@ -212,23 +196,21 @@ pandora.Query = (function() {
|
||||||
return {
|
return {
|
||||||
|
|
||||||
fromString: function(str) {
|
fromString: function(str) {
|
||||||
var list = '',
|
var data
|
||||||
query = Ox.unserialize(str.substr(1)),
|
query = Ox.unserialize(str.substr(1)),
|
||||||
sort = [];
|
sort = []
|
||||||
if ('find' in query) {
|
if ('find' in query) {
|
||||||
Ox.print(Ox.repeat('-', 80));
|
data = parseFind(query.find);
|
||||||
Ox.print('parseFind2', parseFind2(query.find));
|
Ox.print(Ox.repeat('-', 120));
|
||||||
Ox.print(Ox.repeat('-', 80));
|
Ox.print('STATE', data);
|
||||||
pandora.user.ui.listQuery = {conditions: [], operator: ''}; // fixme: hackish
|
Ox.print(Ox.repeat('-', 120));
|
||||||
pandora.user.ui.findQuery = parseFind(query.find);
|
!pandora.user.ui.lists[data.list] && pandora.UI.set(
|
||||||
if (pandora.user.ui.listQuery.conditions.length) {
|
['lists', data.list].join('|'), pandora.site.user.ui.lists['']
|
||||||
list = pandora.user.ui.listQuery.conditions[0].value;
|
);
|
||||||
!pandora.user.ui.lists[list] && pandora.UI.set(
|
pandora.UI.set({list: data.list});
|
||||||
['lists', list].join('|'), pandora.site.user.ui.lists['']
|
pandora.user.ui.find = data.find;
|
||||||
);
|
pandora.user.ui.query = data.query;
|
||||||
}
|
pandora.user.ui.groupsData = getGroupsData();
|
||||||
pandora.UI.set({list: list});
|
|
||||||
//Ox.print('user.ui.findQuery', pandora.user.ui.findQuery)
|
|
||||||
}
|
}
|
||||||
if ('sort' in query) {
|
if ('sort' in query) {
|
||||||
sort = query.sort.split(',');
|
sort = query.sort.split(',');
|
||||||
|
@ -247,6 +229,7 @@ pandora.Query = (function() {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
/*
|
||||||
toObject: function(groupId) {
|
toObject: function(groupId) {
|
||||||
//Ox.print('tO', pandora.user.ui.findQuery.conditions)
|
//Ox.print('tO', pandora.user.ui.findQuery.conditions)
|
||||||
// the inner $.merge() creates a clone
|
// the inner $.merge() creates a clone
|
||||||
|
@ -268,6 +251,7 @@ pandora.Query = (function() {
|
||||||
operator: operator
|
operator: operator
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
*/
|
||||||
|
|
||||||
toString: function() {
|
toString: function() {
|
||||||
//Ox.print('tS', pandora.user.ui.find)
|
//Ox.print('tS', pandora.user.ui.find)
|
||||||
|
@ -275,10 +259,14 @@ pandora.Query = (function() {
|
||||||
key = sort.key,
|
key = sort.key,
|
||||||
operator = sort.operator;
|
operator = sort.operator;
|
||||||
return '?' + Ox.serialize({
|
return '?' + Ox.serialize({
|
||||||
find: constructFind(pandora.Query.toObject()),
|
find: constructFind(pandora.user.ui.query),
|
||||||
sort: (operator == pandora.getSortOperator(key) ? '' : operator) + key,
|
sort: (operator == pandora.getSortOperator(key) ? '' : operator) + key,
|
||||||
view: pandora.user.ui.lists[pandora.user.ui.list].listView
|
view: pandora.user.ui.lists[pandora.user.ui.list].listView
|
||||||
});
|
});
|
||||||
|
},
|
||||||
|
|
||||||
|
updateGroups: function() {
|
||||||
|
pandora.user.ui.groupsData = getGroupsData();
|
||||||
}
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
|
@ -54,83 +54,10 @@ pandora.getFoldersWidth = function() {
|
||||||
return width;
|
return width;
|
||||||
};
|
};
|
||||||
|
|
||||||
pandora.getGroupWidth = function(pos, panelWidth) { // fixme: don't pass panelWidth
|
pandora.getGroupsSizes = function() {
|
||||||
var width = {};
|
return Ox.divideInt(
|
||||||
width.list = Math.floor(panelWidth / 5) + (panelWidth % 5 > pos);
|
window.innerWidth - pandora.user.ui.showSidebar * pandora.user.ui.sidebarSize - 1, 5
|
||||||
width.column = width.list - 40 - Ox.UI.SCROLLBAR_SIZE;
|
)
|
||||||
return width;
|
|
||||||
};
|
|
||||||
|
|
||||||
pandora.getSortOperator = function(key) { // fixme: make static
|
|
||||||
var type = Ox.getObjectById(pandora.site.itemKeys, key).type;
|
|
||||||
return ['hue', 'string', 'text'].indexOf(
|
|
||||||
Ox.isArray(type) ? type[0] : type
|
|
||||||
) > -1 ? '+' : '-';
|
|
||||||
};
|
|
||||||
|
|
||||||
pandora.login = function(data) {
|
|
||||||
pandora.user = data.user;
|
|
||||||
Ox.Theme(pandora.user.ui.theme);
|
|
||||||
pandora.$ui.appPanel.reload();
|
|
||||||
};
|
|
||||||
|
|
||||||
pandora.logout = function(data) {
|
|
||||||
pandora.user = data.user;
|
|
||||||
Ox.Theme(pandora.site.user.ui.theme);
|
|
||||||
pandora.$ui.appPanel.reload();
|
|
||||||
};
|
|
||||||
|
|
||||||
pandora.reloadGroups = function(i) {
|
|
||||||
var query = pandora.Query.toObject(),
|
|
||||||
view = pandora.user.ui.lists[pandora.user.ui.list].listView;
|
|
||||||
if(view == 'clip') {
|
|
||||||
pandora.$ui.list.options({
|
|
||||||
items: function(data, callback) {
|
|
||||||
return pandora.api.findAnnotations($.extend(data, {
|
|
||||||
itemQuery: query
|
|
||||||
}), callback);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
} else if (view == 'map') {
|
|
||||||
pandora.$ui.map.options({
|
|
||||||
places: function(data, callback) {
|
|
||||||
return pandora.api.findPlaces($.extend(data, {
|
|
||||||
itemQuery: query
|
|
||||||
}), callback);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
} else if (view == 'calendar') {
|
|
||||||
pandora.$ui.list.options({
|
|
||||||
items: function(data, callback) {
|
|
||||||
return pandora.api.findEvents($.extend(data, {
|
|
||||||
itemQuery: query
|
|
||||||
}), callback);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
} else {
|
|
||||||
pandora.$ui.list.options({
|
|
||||||
items: function(data, callback) {
|
|
||||||
return pandora.api.find($.extend(data, {
|
|
||||||
query: query
|
|
||||||
}), callback);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
$.each(pandora.user.queryGroups, function(i_, group_) {
|
|
||||||
if (i_ != i) {
|
|
||||||
//Ox.print('setting groups request', i, i_)
|
|
||||||
pandora.$ui.groups[i_].options({
|
|
||||||
items: function(data, callback) {
|
|
||||||
delete data.keys;
|
|
||||||
return pandora.api.find($.extend(data, {
|
|
||||||
group: group_.id,
|
|
||||||
query: pandora.Query.toObject(group_.id)
|
|
||||||
}), callback);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
});
|
|
||||||
pandora.URL.push(pandora.Query.toString());
|
|
||||||
};
|
};
|
||||||
|
|
||||||
pandora.getListData = function() {
|
pandora.getListData = function() {
|
||||||
|
@ -144,6 +71,13 @@ pandora.getListData = function() {
|
||||||
return data;
|
return data;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
pandora.getSortOperator = function(key) { // fixme: make static
|
||||||
|
var type = Ox.getObjectById(pandora.site.itemKeys, key).type;
|
||||||
|
return ['hue', 'string', 'text'].indexOf(
|
||||||
|
Ox.isArray(type) ? type[0] : type
|
||||||
|
) > -1 ? '+' : '-';
|
||||||
|
};
|
||||||
|
|
||||||
pandora.getVideoPartsAndPoints = function(durations, points) {
|
pandora.getVideoPartsAndPoints = function(durations, points) {
|
||||||
var parts = durations.length,
|
var parts = durations.length,
|
||||||
offsets = Ox.range(parts).map(function(i) {
|
offsets = Ox.range(parts).map(function(i) {
|
||||||
|
@ -168,6 +102,70 @@ pandora.getVideoPartsAndPoints = function(durations, points) {
|
||||||
return ret;
|
return ret;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
pandora.login = function(data) {
|
||||||
|
pandora.user = data.user;
|
||||||
|
Ox.Theme(pandora.user.ui.theme);
|
||||||
|
pandora.$ui.appPanel.reload();
|
||||||
|
};
|
||||||
|
|
||||||
|
pandora.logout = function(data) {
|
||||||
|
pandora.user = data.user;
|
||||||
|
Ox.Theme(pandora.site.user.ui.theme);
|
||||||
|
pandora.$ui.appPanel.reload();
|
||||||
|
};
|
||||||
|
|
||||||
|
pandora.reloadGroups = function(i) {
|
||||||
|
var query = pandora.user.ui.query,
|
||||||
|
view = pandora.user.ui.lists[pandora.user.ui.list].listView;
|
||||||
|
if (view == 'clip') {
|
||||||
|
pandora.$ui.list.options({
|
||||||
|
items: function(data, callback) {
|
||||||
|
return pandora.api.findAnnotations(Ox.extend(data, {
|
||||||
|
itemQuery: query
|
||||||
|
}), callback);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
} else if (view == 'map') {
|
||||||
|
pandora.$ui.map.options({
|
||||||
|
places: function(data, callback) {
|
||||||
|
return pandora.api.findPlaces(Ox.extend(data, {
|
||||||
|
itemQuery: query
|
||||||
|
}), callback);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
} else if (view == 'calendar') {
|
||||||
|
pandora.$ui.list.options({
|
||||||
|
items: function(data, callback) {
|
||||||
|
return pandora.api.findEvents(Ox.extend(data, {
|
||||||
|
itemQuery: query
|
||||||
|
}), callback);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
pandora.$ui.list.options({
|
||||||
|
items: function(data, callback) {
|
||||||
|
return pandora.api.find(Ox.extend(data, {
|
||||||
|
query: query
|
||||||
|
}), callback);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
$.each(pandora.user.ui.groups, function(i_, id) {
|
||||||
|
if (i_ != i) {
|
||||||
|
//Ox.print('setting groups request', i, i_)
|
||||||
|
pandora.$ui.groups[i_].options({
|
||||||
|
items: function(data, callback) {
|
||||||
|
delete data.keys;
|
||||||
|
return pandora.api.find(Ox.extend(data, {
|
||||||
|
group: id,
|
||||||
|
query: pandora.user.ui.groupsData[i_].query
|
||||||
|
}), callback);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
pandora.reloadList = function() {
|
pandora.reloadList = function() {
|
||||||
Ox.print('reloadList')
|
Ox.print('reloadList')
|
||||||
var listData = pandora.getListData();
|
var listData = pandora.getListData();
|
||||||
|
@ -191,14 +189,16 @@ pandora.reloadList = function() {
|
||||||
};
|
};
|
||||||
|
|
||||||
pandora.resizeGroups = function(width) {
|
pandora.resizeGroups = function(width) {
|
||||||
var widths = $.map(pandora.user.queryGroups, function(v, i) {
|
pandora.user.ui.groupsSizes = pandora.getGroupsSizes();
|
||||||
return pandora.getGroupWidth(i, width);
|
Ox.print('{}{}{}', window.innerWidth, window.innerWidth - pandora.user.ui.showSidebar * pandora.user.ui.sidebarSize - 1, pandora.user.ui.groupsSizes)
|
||||||
});
|
pandora.$ui.browser
|
||||||
//Ox.print('widths', widths);
|
.size(0, pandora.user.ui.groupsSizes[0])
|
||||||
pandora.$ui.browser.size(0, widths[0].list).size(2, widths[4].list);
|
.size(2, pandora.user.ui.groupsSizes[4]);
|
||||||
pandora.$ui.groupsInnerPanel.size(0, widths[1].list).size(2, widths[3].list);
|
pandora.$ui.groupsInnerPanel
|
||||||
$.each(pandora.$ui.groups, function(i, list) {
|
.size(0, pandora.user.ui.groupsSizes[1])
|
||||||
list.resizeColumn('name', widths[i].column);
|
.size(2, pandora.user.ui.groupsSizes[3]);
|
||||||
|
pandora.$ui.groups.forEach(function(list, i) {
|
||||||
|
list.resizeColumn('name', pandora.user.ui.groupsSizes[i] - 40 - Ox.UI.SCROLLBAR_SIZE);
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -1,20 +1,21 @@
|
||||||
// vim: et:ts=4:sw=4:sts=4:ft=javascript
|
// vim: et:ts=4:sw=4:sts=4:ft=javascript
|
||||||
pandora.ui.browser = function() {
|
pandora.ui.browser = function() {
|
||||||
var that;
|
var sizes, that;
|
||||||
if (!pandora.user.ui.item) {
|
if (!pandora.user.ui.item) {
|
||||||
|
pandora.user.ui.groupsSizes = pandora.getGroupsSizes();
|
||||||
pandora.$ui.groups = pandora.ui.groups();
|
pandora.$ui.groups = pandora.ui.groups();
|
||||||
that = Ox.SplitPanel({
|
that = Ox.SplitPanel({
|
||||||
elements: [
|
elements: [
|
||||||
{
|
{
|
||||||
element: pandora.$ui.groups[0],
|
element: pandora.$ui.groups[0],
|
||||||
size: pandora.user.queryGroups[0].size
|
size: pandora.user.ui.groupsSizes[0]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
element: pandora.$ui.groupsInnerPanel = pandora.ui.groupsInnerPanel()
|
element: pandora.$ui.groupsInnerPanel = pandora.ui.groupsInnerPanel()
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
element: pandora.$ui.groups[4],
|
element: pandora.$ui.groups[4],
|
||||||
size: pandora.user.queryGroups[4].size
|
size: pandora.user.ui.groupsSizes[4]
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
id: 'browser',
|
id: 'browser',
|
||||||
|
|
|
@ -1,17 +1,14 @@
|
||||||
// vim: et:ts=4:sw=4:sts=4:ft=javascript
|
// vim: et:ts=4:sw=4:sts=4:ft=javascript
|
||||||
pandora.ui.findElement = function() {
|
pandora.ui.findElement = function() {
|
||||||
var findKey = '',
|
var findIndex = pandora.user.ui.find.index,
|
||||||
findValue = '';
|
findKey = pandora.user.ui.find.key,
|
||||||
if (pandora.user.ui.findQuery.conditions.length == 1) {
|
findValue = pandora.user.ui.find.value;
|
||||||
findKey = pandora.user.ui.findQuery.conditions[0].key;
|
|
||||||
findValue = pandora.user.ui.findQuery.conditions[0].value;
|
|
||||||
}
|
|
||||||
var that = Ox.FormElementGroup({
|
var that = Ox.FormElementGroup({
|
||||||
elements: $.merge(pandora.user.ui.list ? [
|
elements: $.merge(pandora.user.ui.list ? [
|
||||||
pandora.$ui.findListSelect = Ox.Select({
|
pandora.$ui.findListSelect = Ox.Select({
|
||||||
items: [
|
items: [
|
||||||
{id: 'all', title: 'Find: All ' + pandora.site.itemName.plural},
|
{id: 'all', title: 'Find: All ' + pandora.site.itemName.plural},
|
||||||
{id: 'list', title: 'Find: This List'}
|
{id: 'list', title: 'Find: This List', checked: true}
|
||||||
],
|
],
|
||||||
overlap: 'right',
|
overlap: 'right',
|
||||||
type: 'image'
|
type: 'image'
|
||||||
|
@ -27,17 +24,20 @@ pandora.ui.findElement = function() {
|
||||||
] : [], [
|
] : [], [
|
||||||
pandora.$ui.findSelect = Ox.Select({
|
pandora.$ui.findSelect = Ox.Select({
|
||||||
id: 'select',
|
id: 'select',
|
||||||
items: $.merge($.map(pandora.site.findKeys,
|
items: Ox.merge(
|
||||||
function(key, i) {
|
pandora.site.findKeys.map(function(key, i) {
|
||||||
return {
|
return {
|
||||||
id: key.id,
|
id: key.id,
|
||||||
checked: key.id == findKey,
|
title: 'Find: ' + key.title,
|
||||||
title: 'Find: ' + key.title
|
checked: findKey == key.id
|
||||||
};
|
};
|
||||||
}), [{}, {
|
}),
|
||||||
id: 'advanced',
|
[{}, {
|
||||||
title: 'Find: Advanced'
|
id: 'advanced',
|
||||||
}]),
|
title: 'Find: Advanced',
|
||||||
|
checked: findKey == 'advanced'
|
||||||
|
}]
|
||||||
|
),
|
||||||
overlap: 'right',
|
overlap: 'right',
|
||||||
width: 112
|
width: 112
|
||||||
})
|
})
|
||||||
|
@ -47,11 +47,6 @@ pandora.ui.findElement = function() {
|
||||||
if (key == 'advanced') {
|
if (key == 'advanced') {
|
||||||
pandora.$ui.filterDialog = pandora.ui.filterDialog().open();
|
pandora.$ui.filterDialog = pandora.ui.filterDialog().open();
|
||||||
} else {
|
} else {
|
||||||
if (!pandora.user.ui.findQuery.conditions.length) { // fixme: can this case happen at all?
|
|
||||||
pandora.user.ui.findQuery.conditions = [{key: key, value: '', operator: ''}];
|
|
||||||
} else {
|
|
||||||
pandora.user.ui.findQuery.conditions[0].key = key;
|
|
||||||
}
|
|
||||||
pandora.$ui.mainMenu.checkItem('findMenu_find_' + key);
|
pandora.$ui.mainMenu.checkItem('findMenu_find_' + key);
|
||||||
pandora.$ui.findInput.options({
|
pandora.$ui.findInput.options({
|
||||||
autocomplete: autocompleteFunction()
|
autocomplete: autocompleteFunction()
|
||||||
|
@ -66,25 +61,47 @@ pandora.ui.findElement = function() {
|
||||||
autocompleteSelectSubmit: true,
|
autocompleteSelectSubmit: true,
|
||||||
clear: true,
|
clear: true,
|
||||||
id: 'input',
|
id: 'input',
|
||||||
|
placeholder: findKey == 'advanced' ? 'Edit...' : '',
|
||||||
value: findValue,
|
value: findValue,
|
||||||
width: 192
|
width: 192
|
||||||
})
|
})
|
||||||
.bindEvent({
|
.bindEvent({
|
||||||
submit: function(event, data) {
|
focus: function(data) {
|
||||||
var key = pandora.user.ui.findQuery.conditions.length ?
|
if (findKey == 'advanced') {
|
||||||
pandora.user.ui.findQuery.conditions[0].key : '';
|
pandora.$ui.filterDialog = pandora.ui.filterDialog().open();
|
||||||
if (pandora.user.ui.list && that.value()[0].id == 'all') {
|
}
|
||||||
$.each(pandora.$ui.folderList, function(k, $list) {
|
},
|
||||||
$list.options({selected: []});
|
submit: function(data) {
|
||||||
});
|
var findInList = pandora.user.ui.list
|
||||||
pandora.UI.set({list: ''});
|
&& pandora.$ui.findListSelect.value() == 'list',
|
||||||
pandora.user.ui.listQuery = {conditions: [], operator: ''};
|
key = pandora.$ui.findSelect.value(),
|
||||||
|
condition = {
|
||||||
|
key: key == 'all' ? '' : key,
|
||||||
|
value: data.value,
|
||||||
|
operator: ''
|
||||||
|
};
|
||||||
|
if (findInList) {
|
||||||
|
pandora.user.ui.query = {
|
||||||
|
conditions: [{
|
||||||
|
key: 'list',
|
||||||
|
value: pandora.user.ui.list,
|
||||||
|
operator: ''
|
||||||
|
}, condition],
|
||||||
|
operator: '&'
|
||||||
|
}
|
||||||
|
findIndex == 0 && pandora.user.ui.query.conditions.reverse();
|
||||||
|
} else {
|
||||||
|
if (pandora.user.ui.list) {
|
||||||
|
Ox.forEach(pandora.$ui.folderList, function($list) {
|
||||||
|
$list.options({selected: []});
|
||||||
|
});
|
||||||
|
pandora.UI.set({list: ''});
|
||||||
|
}
|
||||||
|
pandora.user.ui.query = {
|
||||||
|
conditions: [condition],
|
||||||
|
operator: ''
|
||||||
|
}
|
||||||
}
|
}
|
||||||
pandora.user.ui.findQuery.conditions = [{
|
|
||||||
key: key == 'all' ? '' : key,
|
|
||||||
value: data.value,
|
|
||||||
operator: ''
|
|
||||||
}];
|
|
||||||
pandora.URL.set(pandora.Query.toString());
|
pandora.URL.set(pandora.Query.toString());
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
@ -96,7 +113,7 @@ pandora.ui.findElement = function() {
|
||||||
margin: '4px'
|
margin: '4px'
|
||||||
});
|
});
|
||||||
function autocompleteFunction() {
|
function autocompleteFunction() {
|
||||||
return pandora.user.ui.findQuery.conditions.length ? function(value, callback) {
|
return pandora.user.ui.query.conditions.length ? function(value, callback) {
|
||||||
var elementValue = that.value(),
|
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);
|
findKey = Ox.getObjectById(pandora.site.findKeys, key);
|
||||||
|
|
|
@ -1,16 +1,9 @@
|
||||||
// vim: et:ts=4:sw=4:sts=4:ft=javascript
|
// vim: et:ts=4:sw=4:sts=4:ft=javascript
|
||||||
pandora.ui.group = function(id, query) {
|
pandora.ui.group = function(id) {
|
||||||
//Ox.print('group', id, query);
|
|
||||||
/*
|
|
||||||
query && query.conditions.length && alert($.map(query.conditions, function(v) {
|
|
||||||
return v.value;
|
|
||||||
}));
|
|
||||||
*/
|
|
||||||
//alert(id + ' ' + JSON.stringify(pandora.Query.toObject(id)))
|
|
||||||
var i = pandora.user.ui.groups.indexOf(id),
|
var i = pandora.user.ui.groups.indexOf(id),
|
||||||
panelWidth = pandora.$ui.document.width() - (pandora.user.ui.showSidebar * pandora.user.ui.sidebarSize) - 1,
|
panelWidth = pandora.$ui.document.width() - (pandora.user.ui.showSidebar * pandora.user.ui.sidebarSize) - 1,
|
||||||
title = Ox.getObjectById(pandora.site.groups, id).title,
|
title = Ox.getObjectById(pandora.site.groups, id).title,
|
||||||
width = pandora.getGroupWidth(i, panelWidth),
|
//width = pandora.getGroupWidth(i, panelWidth),
|
||||||
that = Ox.TextList({
|
that = Ox.TextList({
|
||||||
columns: [
|
columns: [
|
||||||
{
|
{
|
||||||
|
@ -20,7 +13,7 @@ pandora.ui.group = function(id, query) {
|
||||||
title: title,
|
title: title,
|
||||||
unique: true,
|
unique: true,
|
||||||
visible: true,
|
visible: true,
|
||||||
width: width.column
|
width: pandora.user.ui.groupsSizes[i] - 40 - Ox.UI.SCROLLBAR_SIZE
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
align: 'right',
|
align: 'right',
|
||||||
|
@ -36,40 +29,61 @@ pandora.ui.group = function(id, query) {
|
||||||
items: function(data, callback) {
|
items: function(data, callback) {
|
||||||
//if (pandora.user.ui.showGroups) {
|
//if (pandora.user.ui.showGroups) {
|
||||||
delete data.keys;
|
delete data.keys;
|
||||||
//alert(id + " pandora.Query.toObject " + JSON.stringify(pandora.Query.toObject(id)) + ' ' + JSON.stringify(data))
|
|
||||||
return pandora.api.find($.extend(data, {
|
return pandora.api.find($.extend(data, {
|
||||||
group: id,
|
group: id,
|
||||||
query: pandora.Query.toObject(id)
|
query: pandora.user.ui.groupsData[i].query
|
||||||
}), callback);
|
}), callback);
|
||||||
//} else {
|
//} else {
|
||||||
// callback({data: {items: data.keys ? [] : 0}});
|
// callback({data: {items: data.keys ? [] : 0}});
|
||||||
//}
|
//}
|
||||||
},
|
},
|
||||||
scrollbarVisible: true,
|
scrollbarVisible: true,
|
||||||
selected: query ? $.map(query.conditions, function(v) {
|
selected: pandora.user.ui.groupsData[i].selected,
|
||||||
return v.value;
|
sort: [{
|
||||||
}) : [],
|
key: id == 'year' ? 'name' : 'items',
|
||||||
sort: [
|
operator: '-'
|
||||||
{
|
}]
|
||||||
key: id == 'year' ? 'name' : 'items',
|
|
||||||
operator: '-'
|
|
||||||
}
|
|
||||||
]
|
|
||||||
})
|
})
|
||||||
.bindEvent({
|
.bindEvent({
|
||||||
paste: function(event, data) {
|
paste: function(event, data) {
|
||||||
pandora.$ui.list.triggerEvent('paste', data);
|
pandora.$ui.list.triggerEvent('paste', data);
|
||||||
},
|
},
|
||||||
select: function(event, data) {
|
select: function(event, data) {
|
||||||
var group = pandora.user.queryGroups[i],
|
var conditions = data.ids.map(function(value) {
|
||||||
query;
|
return {
|
||||||
pandora.user.queryGroups[i].query.conditions = $.map(data.ids, function(v) {
|
key: id,
|
||||||
return {
|
value: value,
|
||||||
key: id,
|
operator: '='
|
||||||
value: v,
|
};
|
||||||
operator: '='
|
}),
|
||||||
};
|
index = pandora.user.ui.groupsData[i].index;
|
||||||
});
|
if (Ox.isArray(index)) {
|
||||||
|
pandora.user.ui.query = {
|
||||||
|
conditions: conditions,
|
||||||
|
operator: conditions.length > 1 ? '|' : ''
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (index == -1) {
|
||||||
|
index = pandora.user.ui.query.conditions.length;
|
||||||
|
pandora.user.ui.query.operator = '&'
|
||||||
|
}
|
||||||
|
if (conditions.length == 0) {
|
||||||
|
pandora.user.ui.query.conditions.splice(index, 1);
|
||||||
|
if (pandora.user.ui.query.conditions.length == 1) {
|
||||||
|
pandora.user.ui.query.operator = '';
|
||||||
|
}
|
||||||
|
} else if (conditions.length == 1) {
|
||||||
|
pandora.user.ui.query.conditions[index] = conditions[0];
|
||||||
|
} else {
|
||||||
|
pandora.user.ui.query.conditions[index].conditions = conditions;
|
||||||
|
pandora.user.ui.query.conditions[index].operator = '|';
|
||||||
|
delete pandora.user.ui.query.conditions[index].key;
|
||||||
|
delete pandora.user.ui.query.conditions[index].value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
pandora.Query.updateGroups();
|
||||||
|
Ox.print('---------', pandora.user.ui.query, pandora.user.ui.groupsData)
|
||||||
|
pandora.URL.push(pandora.Query.toString());
|
||||||
pandora.reloadGroups(i);
|
pandora.reloadGroups(i);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -156,14 +170,14 @@ pandora.ui.groupsInnerPanel = function() {
|
||||||
elements: [
|
elements: [
|
||||||
{
|
{
|
||||||
element: pandora.$ui.groups[1],
|
element: pandora.$ui.groups[1],
|
||||||
size: pandora.user.queryGroups[1].size
|
size: pandora.user.ui.groupsSizes[1]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
element: pandora.$ui.groups[2],
|
element: pandora.$ui.groups[2],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
element: pandora.$ui.groups[3],
|
element: pandora.$ui.groups[3],
|
||||||
size: pandora.user.queryGroups[3].size
|
size: pandora.user.ui.groupsSizes[3]
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
orientation: 'horizontal'
|
orientation: 'horizontal'
|
||||||
|
|
|
@ -89,20 +89,20 @@ pandora.ui.list = function() { // fixme: remove view argument
|
||||||
ratio = icons == 'posters' ? data.posterRatio : 1;
|
ratio = icons == 'posters' ? data.posterRatio : 1;
|
||||||
size = size || 128;
|
size = size || 128;
|
||||||
return {
|
return {
|
||||||
height: ratio <= 1 ? size : size / ratio,
|
height: Math.round(ratio <= 1 ? size : size / ratio),
|
||||||
id: data.id,
|
id: data.id,
|
||||||
info: data[['title', 'director'].indexOf(sort[0].key) > -1 ? 'year' : sort[0].key],
|
info: data[['title', 'director'].indexOf(sort[0].key) > -1 ? 'year' : sort[0].key],
|
||||||
title: data.title + (data.director.length ? ' (' + data.director.join(', ') + ')' : ''),
|
title: data.title + (data.director.length ? ' (' + data.director.join(', ') + ')' : ''),
|
||||||
url: icons == 'posters'
|
url: icons == 'posters'
|
||||||
? '/' + data.id + '/poster' + size + '.jpg'
|
? '/' + data.id + '/poster' + size + '.jpg'
|
||||||
: '/' + data.id + '/icon' + size + '.jpg',
|
: '/' + data.id + '/icon' + size + '.jpg',
|
||||||
width: ratio >= 1 ? size : size * ratio
|
width: Math.round(ratio >= 1 ? size : size * ratio)
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
items: function(data, callback) {
|
items: function(data, callback) {
|
||||||
//Ox.print('data, pandora.Query.toObject', data, pandora.Query.toObject())
|
//Ox.print('data, pandora.Query.toObject', data, pandora.Query.toObject())
|
||||||
pandora.api.find($.extend(data, {
|
pandora.api.find($.extend(data, {
|
||||||
query: pandora.Query.toObject()
|
query: pandora.user.ui.query
|
||||||
}), callback);
|
}), callback);
|
||||||
},
|
},
|
||||||
keys: ['director', 'id', 'posterRatio', 'title', 'year'],
|
keys: ['director', 'id', 'posterRatio', 'title', 'year'],
|
||||||
|
|
|
@ -120,11 +120,11 @@ pandora.ui.mainMenu = function() {
|
||||||
{ id: 'findMenu', title: 'Find', items: [
|
{ id: 'findMenu', title: 'Find', items: [
|
||||||
{ id: 'find', title: 'Find', items: [
|
{ id: 'find', title: 'Find', items: [
|
||||||
{ group: 'find', min: 1, max: 1, items: pandora.site.findKeys.map(function(key, i) {
|
{ group: 'find', min: 1, max: 1, items: pandora.site.findKeys.map(function(key, i) {
|
||||||
|
var index = pandora.user.ui.find.index;
|
||||||
return Ox.extend({
|
return Ox.extend({
|
||||||
checked: pandora.user.ui.findQuery.conditions.length ? (
|
checked: index > -1 && pandora.user.ui.query.conditions[index].key
|
||||||
pandora.user.ui.findQuery.conditions[0].key == key.id ||
|
? pandora.user.ui.query.conditions[index].key == key.id
|
||||||
(pandora.user.ui.findQuery.conditions[0].key === '' && key.id == 'all')
|
: key.id == 'all'
|
||||||
) : key.id == 'all',
|
|
||||||
}, key);
|
}, key);
|
||||||
}) }
|
}) }
|
||||||
] },
|
] },
|
||||||
|
|
|
@ -37,7 +37,7 @@ pandora.ui.rightPanel = function() {
|
||||||
.bindEvent({
|
.bindEvent({
|
||||||
resize: function(event, data) {
|
resize: function(event, data) {
|
||||||
if (!pandora.user.ui.item) {
|
if (!pandora.user.ui.item) {
|
||||||
pandora.resizeGroups(data);
|
pandora.resizeGroups();
|
||||||
pandora.$ui.list.size();
|
pandora.$ui.list.size();
|
||||||
if (pandora.user.ui.lists[pandora.user.ui.list].listView == 'timelines') {
|
if (pandora.user.ui.lists[pandora.user.ui.list].listView == 'timelines') {
|
||||||
pandora.$ui.list.options({
|
pandora.$ui.list.options({
|
||||||
|
|
Loading…
Reference in a new issue