add functionality to timelines view

This commit is contained in:
rolux 2011-10-17 10:19:17 +00:00
parent f5fa1b59b4
commit e1fb2d8064
4 changed files with 31 additions and 6 deletions

View file

@ -69,7 +69,8 @@ pandora.UI = (function() {
if (Object.keys(listSettings).indexOf(key) > -1) { if (Object.keys(listSettings).indexOf(key) > -1) {
// if applicable, copy setting to list setting // if applicable, copy setting to list setting
add['lists.' + that.encode(pandora.user.ui._list || '') + '.' + listSettings[key]] = val; add['lists.' + that.encode(pandora.user.ui._list || '') + '.' + listSettings[key]] = val;
} else if (key == 'item' && val) { }
if (key == 'item' && val) {
// when switching to an item, update list selection // when switching to an item, update list selection
add['listSelection'] = [val]; add['listSelection'] = [val];
add['lists.' + that.encode(pandora.user.ui._list || '') + '.selection'] = [val]; add['lists.' + that.encode(pandora.user.ui._list || '') + '.selection'] = [val];
@ -88,6 +89,10 @@ pandora.UI = (function() {
key == 'item' ? val : pandora.user.ui.item key == 'item' ? val : pandora.user.ui.item
)] = {'in': 0, out: 0, position: 0}; )] = {'in': 0, out: 0, position: 0};
} }
if (key == 'itemView' && ['video', 'timeline'].indexOf(val) > -1) {
// when switching to a video view, add it as default video view
add.videoView = val;
}
}); });
[args, add].forEach(function(obj, isAdd) { [args, add].forEach(function(obj, isAdd) {
Ox.forEach(obj, function(val, key) { Ox.forEach(obj, function(val, key) {

View file

@ -76,7 +76,7 @@ pandora.ui.accountDialogOptions = function(action, value) {
return { return {
buttons: Ox.merge(buttons[action].map(function(type) { buttons: Ox.merge(buttons[action].map(function(type) {
return button(type); return button(type);
}), [button('cancel'), button('submit')]), }), [{}, button('cancel'), button('submit')]),
content: Ox.Element() content: Ox.Element()
.append( .append(
$('<img>') $('<img>')

View file

@ -218,14 +218,29 @@ pandora.ui.list = function() {
width: Math.round(ratio >= 1 ? size : size * ratio) width: Math.round(ratio >= 1 ? size : size * ratio)
}, },
info: { info: {
/*
css: { css: {
margin: '-4px 0 0 -4px' margin: '4px'
}, },
*/
element: Ox.BlockVideoTimeline, element: Ox.BlockVideoTimeline,
events: {
position: function(event) {
//that.options({selected: [data.id]});
pandora.$ui.videoPreview.options({
position: event.position
});
pandora.UI.set('videoPoints.' + data.id + '.position', event.position);
}
},
id: data.id, id: data.id,
options: { options: {
duration: data.duration, duration: data.duration,
getImageURL: '/' + data.id + '/timeline16p.png' getImageURL: function(i) {
return '/' + data.id + '/timeline16p' + i + '.png';
},
position: pandora.user.ui.videoPoints[data.id]
? pandora.user.ui.videoPoints[data.id].position : 0
} }
} }
}; };
@ -294,7 +309,11 @@ pandora.ui.list = function() {
pandora.$ui.selected.html(pandora.ui.status('selected', data)); pandora.$ui.selected.html(pandora.ui.status('selected', data));
}, },
open: function(data) { open: function(data) {
pandora.UI.set({item: data.ids[0]}); pandora.UI.set(Ox.extend({
item: data.ids[0]
}, view == 'timelines' && data.isSpecialTarget ? {
itemView: pandora.user.ui.videoView
} : {}));
}, },
openpreview: function(data) { openpreview: function(data) {
pandora.requests.preview && pandora.api.cancel(pandora.requests.preview); pandora.requests.preview && pandora.api.cancel(pandora.requests.preview);
@ -409,7 +428,7 @@ pandora.ui.list = function() {
} }
if (pandora.user.ui.listView == 'grid') { if (['grid', 'timelines'].indexOf(pandora.user.ui.listView) > -1) {
that.bindEvent({ that.bindEvent({
pandora_icons: function(data) { pandora_icons: function(data) {
that.options({ that.options({

View file

@ -27,6 +27,7 @@ pandora.ui.viewSelect = function() {
var key = data.selected[0].id, var key = data.selected[0].id,
set = {}; set = {};
set[viewKey] = key; set[viewKey] = key;
// FIXME: this may not work on page load, and would then have to be part of UI.js
if (!ui.item) { if (!ui.item) {
// when changing the list view ... // when changing the list view ...
if (pandora.isClipView(key)) { if (pandora.isClipView(key)) {