add lists to sidebar

This commit is contained in:
rlx 2011-01-06 03:11:00 +00:00
parent e9023227c0
commit 87f1622e83
4 changed files with 123 additions and 17 deletions

View file

@ -51,7 +51,7 @@ class Annotation(models.Model):
created = models.DateTimeField(auto_now_add=True) created = models.DateTimeField(auto_now_add=True)
modified = models.DateTimeField(auto_now=True) modified = models.DateTimeField(auto_now=True)
user = models.ForeignKey(User) user = models.ForeignKey(User)
item = models.ForeignKey('item.Item') item = models.ForeignKey('item.Item', related_name='annotations')
#seconds #seconds
start = models.FloatField(default=-1) start = models.FloatField(default=-1)

View file

@ -68,7 +68,7 @@
}, },
"sections": [ "sections": [
{"id": "history", "title": "History"}, {"id": "history", "title": "History"},
{"id": "lists", "title": "My Lists"}, {"id": "my", "title": "My Lists"},
{"id": "public", "title": "Public Lists"}, {"id": "public", "title": "Public Lists"},
{"id": "featured", "title": "Featured Lists"} {"id": "featured", "title": "Featured Lists"}
], ],
@ -83,7 +83,7 @@
{"id": "producer", "title": "Producer", "width": 180, "type": "person"}, {"id": "producer", "title": "Producer", "width": 180, "type": "person"},
{"id": "cinematographer", "title": "Cinematographer", "width": 180, "type": "person"}, {"id": "cinematographer", "title": "Cinematographer", "width": 180, "type": "person"},
{"id": "editor", "title": "Editor", "width": 180, "type": "person"}, {"id": "editor", "title": "Editor", "width": 180, "type": "person"},
{"id": "numberofactors", "title": "Number of Actors", "width": 60, "key": "actor", "type": "length"}, {"id": "actor", "title": "Number of Actors", "width": 60, "type": "person"},
{"id": "genre", "title": "Genre", "width": 120, "type": "string"}, {"id": "genre", "title": "Genre", "width": 120, "type": "string"},
{"id": "numberofkeywords", "title": "Number of Keywords", "width": 60, "key": "keyword", "type": "length"}, {"id": "numberofkeywords", "title": "Number of Keywords", "width": 60, "key": "keyword", "type": "length"},
{"id": "wordsinsummary", "title": "Words in Summary", "width": 60, "key": "summary", "type": "words"}, {"id": "wordsinsummary", "title": "Words in Summary", "width": 60, "key": "summary", "type": "words"},
@ -126,6 +126,24 @@
], ],
"user": { "user": {
"group": "guest", "group": "guest",
"lists": {
"history": [
{"id": "all_movies", "title": "All Movies", "query": {}}
],
"my": [
{"id": "favorites", "title": "Favorites", "public": true, "items": []},
{"id": "most_popular", "title": "Most Popular", "query": {}},
{"id": "recently_viewed", "title": "Recently Viewed", "query": {}},
{"id": "1960s", "title": "1960s", "query": {"conditions": [{"key": "year", "value": "196", "operator": "^"}], "operator": ""}}
],
"public": [
{"id": "rlx_watchme", "title": "rlx: watchme", "public": true, "items": [0, 1, 2, 3, 4]}
],
"featured": [
{"id": "situationist_film", "title": "Situationist Film", "query": {}},
{"id": "timelines", "title": "Timelines", "items": [0, 1, 2, 3, 4, 5, 6, 7, 8]}
]
},
"preferences": {}, "preferences": {},
"ui": { "ui": {
"annotationsSize": 256, "annotationsSize": 256,
@ -139,7 +157,7 @@
"listQuery": {"conditions": [], "operator": ""}, "listQuery": {"conditions": [], "operator": ""},
"listView": "icons", "listView": "icons",
"section": "items", "section": "items",
"sections": ["history", "lists", "public", "featured"], "sections": ["history", "my", "public", "featured"],
"showAnnotations": true, "showAnnotations": true,
"showGroups": true, "showGroups": true,
"showInfo": true, "showInfo": true,

View file

@ -1 +1 @@
pan.do/ra is broken. We'll be back in a minute.

View file

@ -802,6 +802,7 @@ var pandora = new Ox.App({
width: 40 width: 40
} }
], ],
columnsVisible: true,
id: 'group_' + id, id: 'group_' + id,
request: function(data, callback) { request: function(data, callback) {
Ox.print('sending request', data) Ox.print('sending request', data)
@ -1092,6 +1093,17 @@ var pandora = new Ox.App({
delete app.$ui.sectionSelect; delete app.$ui.sectionSelect;
app.$ui.sectionbar.append(app.$ui.sectionButtons = ui.sectionButtons()); app.$ui.sectionbar.append(app.$ui.sectionButtons = ui.sectionButtons());
} }
///*
app.$ui.leftPanel.find('.OxTextList').css({
width: data + 'px'
});
app.$ui.leftPanel.find('.OxItem').css({
width: data + 'px'
});
app.$ui.leftPanel.find('.OxCell.OxColumnTitle').css({
width: (data - 80) + 'px'
});
//*/
Ox.print('resize', data, data / app.ui.infoRatio + 16); Ox.print('resize', data, data / app.ui.infoRatio + 16);
app.$ui.leftPanel.size('infoPanel', Math.round(data / app.ui.infoRatio) + 16); app.$ui.leftPanel.size('infoPanel', Math.round(data / app.ui.infoRatio) + 16);
}, },
@ -1118,6 +1130,7 @@ var pandora = new Ox.App({
columnsMovable: true, columnsMovable: true,
columnsRemovable: true, columnsRemovable: true,
columnsResizable: true, columnsResizable: true,
columnsVisible: true,
format: { format: {
releasedate: {type: 'date', args: ['%a, %b %e, %Y']}, releasedate: {type: 'date', args: ['%a, %b %e, %Y']},
runtime: {type: 'duration', args: [0, 'medium']}, runtime: {type: 'duration', args: [0, 'medium']},
@ -2097,7 +2110,7 @@ var pandora = new Ox.App({
var $sections = []; var $sections = [];
$.each(app.user.ui.sections, function(i, id) { $.each(app.user.ui.sections, function(i, id) {
var menu = []; var menu = [];
if (id == 'lists') { if (id == 'my') {
menu = [ menu = [
{ id: 'new', title: 'New List...' }, { id: 'new', title: 'New List...' },
{ id: 'newfromselection', title: 'New List from Selection...' }, { id: 'newfromselection', title: 'New List from Selection...' },
@ -2118,6 +2131,80 @@ var pandora = new Ox.App({
title: Ox.getObjectById(app.config.sections, id).title title: Ox.getObjectById(app.config.sections, id).title
}); });
$sections.push($section); $sections.push($section);
$section.$content.css({
height: app.user.lists[id].length * 16 + 'px'
});
var $list = new Ox.TextList({
columns: [
{
align: 'left',
id: 'title',
operator: '+',
unique: true,
visible: true,
width: 184
},
{
align: 'right',
id: 'items',
operator: '-',
visible: true,
width: 40
},
{
align: 'left',
id: 'icon',
operator: '+',
visible: true,
width: 16
},
{
align: 'left',
id: 'public',
operator: '+',
visible: true,
width: 16
}
],
max: 1,
min: 0,
request: function(data, callback) {
if ($.isEmptyObject(data)) {
callback({data: {items: app.user.lists[id].length}});
} else {
callback({data: {items: $.map(app.user.lists[id], function(v, i) {
return $.extend(v, {
edit: $('<img>').attr({
src: 'static/oxjs/build/png/ox.ui.modern/symbolNone.png'
}).mouseover(function() { $(this).attr({
src: 'static/oxjs/build/png/ox.ui.modern/symbolEdit.png'
})}).mouseout(function() { $(this).attr({
src: 'static/oxjs/build/png/ox.ui.modern/symbolNone.png'
})}),
icon: $('<img>').attr({
src: 'static/oxjs/build/png/ox.ui.modern/symbol' + (v.items ? 'None' : 'Find') + '.png'
}),
public: $('<img>').attr({
src: 'static/oxjs/build/png/ox.ui.modern/symbol' + (v.items && v.public ? 'Publish' : 'None') + '.png'
}),
items: v.items ? v.items.length.toString() : (v.title == '1960s' || v.title == 'All Movies' ? '?' : '100')
});
})}});
}
},
sort: [
{key: 'title', operator: '+'}
]
})
.css({
left: 0,
top: 0,
width: app.user.ui.sidebarSize + 'px',
height: app.user.lists[id].length * 16 + 'px'
})
.appendTo($section.$content);
/*
} else {
$section.$content.append( $section.$content.append(
$('<div>').css({ height: '20px' }).append( $('<div>').css({ height: '20px' }).append(
$('<div>').css({ float: 'left', width: '16px', height: '16px', margin: '1px'}).append( $('<div>').css({ float: 'left', width: '16px', height: '16px', margin: '1px'}).append(
@ -2129,6 +2216,7 @@ var pandora = new Ox.App({
$('<div>').css({ float: 'left', width: '40px', height: '14px', margin: '2px', textAlign: 'right' }).html('23') $('<div>').css({ float: 'left', width: '40px', height: '14px', margin: '2px', textAlign: 'right' }).html('23')
) )
); );
} */
}); });
$.each($sections, function(i, $section) { $.each($sections, function(i, $section) {
that.append($section); that.append($section);