make icon view the default view

This commit is contained in:
rolux 2010-09-08 18:34:24 +02:00
parent 7a01749b66
commit b360d9d915

View file

@ -3,10 +3,10 @@
***/ ***/
var app = new Ox.App({ var app = new Ox.App({
config: '/pandora.json', config: '/static/json/pandora.json',
init: 'hello', init: 'hello',
id: site.id, id: 'oxdb',
name: site.name, name: 'OxDB',
requestURL: '/api/' requestURL: '/api/'
}).launch(function(data) { }).launch(function(data) {
Ox.print('data', data) Ox.print('data', data)
@ -490,8 +490,7 @@ app.constructInfo = function() {
app.constructList = function(view) { app.constructList = function(view) {
var $list, var $list,
info = $.inArray(app.user.ui.sort[0].key, ['title', 'director']) > -1 ? 'year' : app.user.ui.sort[0].key, keys = ['director', 'id', 'poster', 'title', 'year'];
keys = Ox.unique(['director', 'id', 'poster', 'title', info]);
Ox.print('constructList', view); Ox.print('constructList', view);
if (view == 'list' || view == 'calendar') { if (view == 'list' || view == 'calendar') {
$list = new Ox.TextList({ $list = new Ox.TextList({
@ -519,14 +518,15 @@ app.constructList = function(view) {
return { return {
height: data.poster.height || 128, // fixme: remove later height: data.poster.height || 128, // fixme: remove later
id: data['id'], id: data['id'],
info: data[info], info: data[['title', 'director'].indexOf(sort[0].key) > -1 ? 'year' : sort[0].key],
title: data.title + (data.director ? ' (' + data.director + ')' : ''), title: data.title + (data.director ? ' (' + data.director + ')' : ''),
url: 'http://0xdb.org/' + data.id + '/poster.' + size + '.' + 'jpg', //url: data.poster.url.replace(/.jpg/, size + '.jpg'), url: 'http://0xdb.org/' + data.id + '/poster.' + size + '.' + 'jpg',
width: data.poster.width || 80 // fixme: remove later width: data.poster.width || 80 // fixme: remove later
}; };
}, },
keys: keys, keys: keys,
request: function(options) { request: function(options) {
Ox.print('options, Query.toObject', options, app.Query.toObject())
app.request('find', $.extend(options, { app.request('find', $.extend(options, {
query: app.Query.toObject() query: app.Query.toObject()
}), options.callback); }), options.callback);
@ -907,12 +907,12 @@ app.constructMainMenu = function() {
app.$ui.findSelect.selectItem(id); app.$ui.findSelect.selectItem(id);
} else if (data.id == 'ordermovies') { } else if (data.id == 'ordermovies') {
var id = data.checked[0].id; var id = data.checked[0].id;
app.$ui.list.sort(user.ui.sort[0].key, id == 'ascending' ? '' : '-'); app.$ui.list.sortList(user.ui.sort[0].key, id == 'ascending' ? '' : '-');
} else if (data.id == 'sortmovies') { } else if (data.id == 'sortmovies') {
var id = data.checked[0].id, var id = data.checked[0].id,
operator = Ox.getObjectById(app.config.sortKeys, id).operator; operator = Ox.getObjectById(app.config.sortKeys, id).operator;
app.$ui.mainMenu.checkItem('sortMenu_ordermovies_' + (operator === '' ? 'ascending' : 'descending')); app.$ui.mainMenu.checkItem('sortMenu_ordermovies_' + (operator === '' ? 'ascending' : 'descending'));
app.$ui.list.sort(id, operator); app.$ui.list.sortList(id, operator);
} }
}, },
click: function(event, data) { click: function(event, data) {
@ -1941,4 +1941,4 @@ app.getGroupWidth = function(pos, panelWidth) {
}); });
*/ */