update filter, add list dialog
This commit is contained in:
parent
4b523361fe
commit
f597de57b5
11 changed files with 75 additions and 48 deletions
|
@ -31,7 +31,7 @@
|
||||||
{
|
{
|
||||||
"id": "all",
|
"id": "all",
|
||||||
"title": "All",
|
"title": "All",
|
||||||
"type": "string",
|
"type": "text",
|
||||||
"find": true
|
"find": true
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|
|
@ -94,7 +94,7 @@ function constructList() {
|
||||||
app.api.api(function(results) {
|
app.api.api(function(results) {
|
||||||
var items = [];
|
var items = [];
|
||||||
Ox.forEach(results.data.actions, function(v, k) {
|
Ox.forEach(results.data.actions, function(v, k) {
|
||||||
items.push({'name': v})
|
items.push({'name': k})
|
||||||
});
|
});
|
||||||
items.sort(_sort);
|
items.sort(_sort);
|
||||||
var result = {'data': {'items': items.length}};
|
var result = {'data': {'items': items.length}};
|
||||||
|
@ -104,7 +104,7 @@ function constructList() {
|
||||||
app.api.api(function(results) {
|
app.api.api(function(results) {
|
||||||
var items = [];
|
var items = [];
|
||||||
Ox.forEach(results.data.actions, function(v, k) {
|
Ox.forEach(results.data.actions, function(v, k) {
|
||||||
items.push({'name': v})
|
items.push({'name': k})
|
||||||
});
|
});
|
||||||
items.sort(_sort);
|
items.sort(_sort);
|
||||||
var result = {'data': {'items': items}};
|
var result = {'data': {'items': items}};
|
||||||
|
@ -142,7 +142,7 @@ function constructList() {
|
||||||
.addClass("margin")
|
.addClass("margin")
|
||||||
.click(function() { $code.toggle()})
|
.click(function() { $code.toggle()})
|
||||||
.appendTo(info)
|
.appendTo(info)
|
||||||
var f = app.actions[k].code[0];
|
var f = app.actions[id].code[0];
|
||||||
$('<span>').html(' View Source ('+f+')').appendTo(info)
|
$('<span>').html(' View Source ('+f+')').appendTo(info)
|
||||||
$('<pre>').append($code).appendTo(info)
|
$('<pre>').append($code).appendTo(info)
|
||||||
hljs.highlightBlock($code[0], ' ');
|
hljs.highlightBlock($code[0], ' ');
|
||||||
|
|
|
@ -96,7 +96,7 @@ pandora.Query = (function() {
|
||||||
find: {index: -1, key: '', value: ''},
|
find: {index: -1, key: '', value: ''},
|
||||||
groups: [], // {index, query, selected}
|
groups: [], // {index, query, selected}
|
||||||
list: '',
|
list: '',
|
||||||
query: {conditions: [], operator: ''}
|
query: {conditions: [], operator: '&'}
|
||||||
},
|
},
|
||||||
subconditions = [];
|
subconditions = [];
|
||||||
if (str.length) {
|
if (str.length) {
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
// vim: et:ts=4:sw=4:sts=4:ft=javascript
|
// vim: et:ts=4:sw=4:sts=4:ft=javascript
|
||||||
pandora.ui.filter = function() {
|
pandora.ui.filter = function(list) {
|
||||||
var that = Ox.Filter({
|
var that = Ox.Filter({
|
||||||
findKeys: Ox.map(pandora.site.itemKeys, function(key) {
|
findKeys: Ox.merge(Ox.map(pandora.site.itemKeys, function(key) {
|
||||||
return key.id == 'all' ? null : {
|
return {
|
||||||
autocomplete: key.autocomplete,
|
autocomplete: key.autocomplete,
|
||||||
autocompleteSortKey: key.autocompleteSortKey,
|
autocompleteSortKey: key.autocompleteSortKey,
|
||||||
format: key.format,
|
format: key.format,
|
||||||
|
@ -12,10 +12,16 @@ pandora.ui.filter = function() {
|
||||||
pandora.site.layers, key.id
|
pandora.site.layers, key.id
|
||||||
).type : key.type
|
).type : key.type
|
||||||
};
|
};
|
||||||
|
}), {
|
||||||
|
id: 'list',
|
||||||
|
title: 'List',
|
||||||
|
type: 'list'
|
||||||
}),
|
}),
|
||||||
|
query: list ? list.query : pandora.user.ui.query,
|
||||||
sortKeys: pandora.site.sortKeys,
|
sortKeys: pandora.site.sortKeys,
|
||||||
viewKeys: pandora.site.listViews
|
viewKeys: pandora.site.listViews
|
||||||
});
|
})
|
||||||
|
.css({padding: '16px'});
|
||||||
return that;
|
return that;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
// vim: et:ts=4:sw=4:sts=4:ft=javascript
|
// vim: et:ts=4:sw=4:sts=4:ft=javascript
|
||||||
pandora.ui.filterDialog = function() {
|
pandora.ui.filterDialog = function(list) {
|
||||||
var that = Ox.Dialog({
|
var that = Ox.Dialog({
|
||||||
buttons: [
|
buttons: [
|
||||||
Ox.Button({
|
Ox.Button({
|
||||||
|
@ -11,6 +11,7 @@ pandora.ui.filterDialog = function() {
|
||||||
alert(JSON.stringify(pandora.$ui.filter.options('query')));
|
alert(JSON.stringify(pandora.$ui.filter.options('query')));
|
||||||
}
|
}
|
||||||
}),
|
}),
|
||||||
|
/*
|
||||||
Ox.Button({
|
Ox.Button({
|
||||||
id: 'cancel',
|
id: 'cancel',
|
||||||
title: 'Cancel'
|
title: 'Cancel'
|
||||||
|
@ -20,9 +21,10 @@ pandora.ui.filterDialog = function() {
|
||||||
pandora.$ui.filterDialog.close();
|
pandora.$ui.filterDialog.close();
|
||||||
}
|
}
|
||||||
}),
|
}),
|
||||||
|
*/
|
||||||
Ox.Button({
|
Ox.Button({
|
||||||
id: 'save',
|
id: 'done',
|
||||||
title: 'Save'
|
title: 'Done'
|
||||||
})
|
})
|
||||||
.bindEvent({
|
.bindEvent({
|
||||||
click: function() {
|
click: function() {
|
||||||
|
@ -30,13 +32,13 @@ pandora.ui.filterDialog = function() {
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
],
|
],
|
||||||
content: pandora.$ui.filter = pandora.ui.filter().css({padding: '16px'}),
|
content: pandora.$ui.filter = pandora.ui.filter(list),
|
||||||
maxWidth: 648 + Ox.UI.SCROLLBAR_SIZE,
|
maxWidth: 648 + Ox.UI.SCROLLBAR_SIZE,
|
||||||
minHeight: 264,
|
minHeight: 264,
|
||||||
minWidth: 648 + Ox.UI.SCROLLBAR_SIZE,
|
minWidth: 648 + Ox.UI.SCROLLBAR_SIZE,
|
||||||
height: 264,
|
height: 264,
|
||||||
keys: {enter: 'save', escape: 'cancel'},
|
// keys: {enter: 'save', escape: 'cancel'},
|
||||||
title: 'Advanced Find',
|
title: list ? 'Smart List - ' + list.name : 'Advanced Find',
|
||||||
width: 648 + Ox.UI.SCROLLBAR_SIZE
|
width: 648 + Ox.UI.SCROLLBAR_SIZE
|
||||||
});
|
});
|
||||||
return that;
|
return that;
|
||||||
|
|
|
@ -138,7 +138,11 @@ pandora.ui.folderBrowserList = function(id) {
|
||||||
.bindEvent({
|
.bindEvent({
|
||||||
click: function(data) {
|
click: function(data) {
|
||||||
if (data.key == 'type') {
|
if (data.key == 'type') {
|
||||||
alert('...');
|
/*
|
||||||
|
if (that.value(data.id, 'type') == 'smart') {
|
||||||
|
pandora.$ui.filterDialog = pandora.ui.filterDialog(that.value(data.id, 'query')).open();
|
||||||
|
}
|
||||||
|
*/
|
||||||
} else if (data.key == 'subscribed') {
|
} else if (data.key == 'subscribed') {
|
||||||
var subscribed = that.value(data.id, 'subscribed');
|
var subscribed = that.value(data.id, 'subscribed');
|
||||||
pandora.api[subscribed ? 'unsubscribeFromList' : 'subscribeToList']({
|
pandora.api[subscribed ? 'unsubscribeFromList' : 'subscribeToList']({
|
||||||
|
|
|
@ -8,6 +8,9 @@ pandora.ui.folderList = function(id) {
|
||||||
if (id != 'volumes') {
|
if (id != 'volumes') {
|
||||||
columns = [
|
columns = [
|
||||||
{
|
{
|
||||||
|
clickable: function(data) {
|
||||||
|
return data.user == pandora.user.username;
|
||||||
|
},
|
||||||
format: function() {
|
format: function() {
|
||||||
return $('<img>').attr({
|
return $('<img>').attr({
|
||||||
src: Ox.UI.getImageURL('symbolIcon')
|
src: Ox.UI.getImageURL('symbolIcon')
|
||||||
|
@ -19,6 +22,9 @@ pandora.ui.folderList = function(id) {
|
||||||
},
|
},
|
||||||
id: 'user',
|
id: 'user',
|
||||||
operator: '+',
|
operator: '+',
|
||||||
|
tooltip: function(data) {
|
||||||
|
return data.user == pandora.user.username ? 'Edit Icon' : '';
|
||||||
|
},
|
||||||
visible: true,
|
visible: true,
|
||||||
width: 16
|
width: 16
|
||||||
},
|
},
|
||||||
|
@ -229,6 +235,7 @@ pandora.ui.folderList = function(id) {
|
||||||
that = Ox.TextList({
|
that = Ox.TextList({
|
||||||
columns: columns,
|
columns: columns,
|
||||||
items: items,
|
items: items,
|
||||||
|
keys: ['query'],
|
||||||
max: 1,
|
max: 1,
|
||||||
min: 0,
|
min: 0,
|
||||||
pageLength: 1000,
|
pageLength: 1000,
|
||||||
|
@ -282,15 +289,20 @@ pandora.ui.folderList = function(id) {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
click: function(data) {
|
click: function(data) {
|
||||||
var $list = pandora.$ui.folderList[id];
|
//var $list = pandora.$ui.folderList[id];
|
||||||
if (data.key == 'type') {
|
if (data.key == 'user') {
|
||||||
pandora.$ui.filterDialog = pandora.ui.filterDialog().open();
|
pandora.$ui.filterDialog = pandora.ui.listDialog(that.value(data.id), 'icon').open();
|
||||||
|
|
||||||
|
} else if (data.key == 'type') {
|
||||||
|
if (that.value(data.id, 'type') == 'smart') {
|
||||||
|
pandora.$ui.filterDialog = pandora.ui.listDialog(that.value(data.id), 'query').open();
|
||||||
|
}
|
||||||
} else if (data.key == 'status') {
|
} else if (data.key == 'status') {
|
||||||
pandora.api.editList({
|
pandora.api.editList({
|
||||||
id: data.id,
|
id: data.id,
|
||||||
status: $list.value(data.id, data.key) == 'private' ? 'public' : 'private'
|
status: that.value(data.id, data.key) == 'private' ? 'public' : 'private'
|
||||||
}, function(result) {
|
}, function(result) {
|
||||||
$list.value(result.data.id, 'status', result.data.status);
|
that.value(result.data.id, 'status', result.data.status);
|
||||||
});
|
});
|
||||||
} else if (data.key == 'path') {
|
} else if (data.key == 'path') {
|
||||||
|
|
||||||
|
@ -300,23 +312,23 @@ pandora.ui.folderList = function(id) {
|
||||||
},
|
},
|
||||||
'delete': function(data) {
|
'delete': function(data) {
|
||||||
// fixme: add a confirmation dialog
|
// fixme: add a confirmation dialog
|
||||||
var $list = pandora.$ui.folderList[id];
|
//var $list = pandora.$ui.folderList[id];
|
||||||
pandora.URL.set('?find=');
|
pandora.URL.set('?find=');
|
||||||
$list.options({selected: []});
|
that.options({selected: []});
|
||||||
if (id == 'personal') {
|
if (id == 'personal') {
|
||||||
pandora.api.removeList({
|
pandora.api.removeList({
|
||||||
id: data.ids[0]
|
id: data.ids[0]
|
||||||
}, function(result) {
|
}, function(result) {
|
||||||
pandora.UI.set(['lists', data.ids[0]].join('|'), null);
|
pandora.UI.set(['lists', data.ids[0]].join('|'), null);
|
||||||
Ox.Request.clearCache(); // fixme: remove
|
Ox.Request.clearCache(); // fixme: remove
|
||||||
$list.reloadList();
|
that.reloadList();
|
||||||
});
|
});
|
||||||
} else if (id == 'favorite') {
|
} else if (id == 'favorite') {
|
||||||
pandora.api.unsubscribeFromList({
|
pandora.api.unsubscribeFromList({
|
||||||
id: data.ids[0]
|
id: data.ids[0]
|
||||||
}, function(result) {
|
}, function(result) {
|
||||||
Ox.Request.clearCache(); // fixme: remove
|
Ox.Request.clearCache(); // fixme: remove
|
||||||
$list.reloadList();
|
that.reloadList();
|
||||||
});
|
});
|
||||||
} else if (id == 'featured' && pandora.user.level == 'admin') {
|
} else if (id == 'featured' && pandora.user.level == 'admin') {
|
||||||
pandora.api.editList({
|
pandora.api.editList({
|
||||||
|
@ -330,7 +342,7 @@ pandora.ui.folderList = function(id) {
|
||||||
result.data.user == pandora.user.username ? 'personal' : 'favorite'
|
result.data.user == pandora.user.username ? 'personal' : 'favorite'
|
||||||
].reloadList();
|
].reloadList();
|
||||||
}
|
}
|
||||||
$list.reloadList();
|
that.reloadList();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
|
@ -27,9 +27,11 @@ pandora.ui.info = function() {
|
||||||
if (result.data) {
|
if (result.data) {
|
||||||
pandora.$ui.videoPreview && pandora.$ui.videoPreview.removeElement();
|
pandora.$ui.videoPreview && pandora.$ui.videoPreview.removeElement();
|
||||||
pandora.$ui.videoPreview = pandora.ui.videoPreview({
|
pandora.$ui.videoPreview = pandora.ui.videoPreview({
|
||||||
id: id,
|
|
||||||
duration: result.data.duration,
|
duration: result.data.duration,
|
||||||
frameRatio: result.data.videoRatio
|
frameRatio: result.data.videoRatio,
|
||||||
|
height: pandora.getInfoHeight(),
|
||||||
|
id: id,
|
||||||
|
width: pandora.user.ui.sidebarSize
|
||||||
}).appendTo(pandora.$ui.info);
|
}).appendTo(pandora.$ui.info);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
@ -23,6 +23,7 @@ pandora.ui.leftPanel = function() {
|
||||||
.bindEvent({
|
.bindEvent({
|
||||||
resize: function(data) {
|
resize: function(data) {
|
||||||
pandora.user.ui.sidebarSize = data.size;
|
pandora.user.ui.sidebarSize = data.size;
|
||||||
|
var infoHeight = pandora.getInfoHeight();
|
||||||
if (data.size < pandora.site.sectionButtonsWidth && pandora.$ui.sectionButtons) {
|
if (data.size < pandora.site.sectionButtonsWidth && pandora.$ui.sectionButtons) {
|
||||||
pandora.$ui.sectionButtons.removeElement();
|
pandora.$ui.sectionButtons.removeElement();
|
||||||
delete pandora.$ui.sectionButtons;
|
delete pandora.$ui.sectionButtons;
|
||||||
|
@ -32,8 +33,8 @@ pandora.ui.leftPanel = function() {
|
||||||
delete pandora.$ui.sectionSelect;
|
delete pandora.$ui.sectionSelect;
|
||||||
pandora.$ui.sectionbar.append(pandora.$ui.sectionButtons = pandora.ui.sectionButtons());
|
pandora.$ui.sectionbar.append(pandora.$ui.sectionButtons = pandora.ui.sectionButtons());
|
||||||
}
|
}
|
||||||
!pandora.user.ui.showInfo && pandora.$ui.leftPanel.css({bottom: -infoSize});
|
!pandora.user.ui.showInfo && pandora.$ui.leftPanel.css({bottom: -infoHeight});
|
||||||
pandora.$ui.leftPanel.size(2, pandora.getInfoHeight());
|
pandora.$ui.leftPanel.size(2, infoHeight);
|
||||||
pandora.$ui.info.resizeInfo();
|
pandora.$ui.info.resizeInfo();
|
||||||
pandora.resizeFolders();
|
pandora.resizeFolders();
|
||||||
},
|
},
|
||||||
|
|
|
@ -4,20 +4,19 @@ pandora.ui.videoPreview = function(data) {
|
||||||
var that = Ox.VideoPreview({
|
var that = Ox.VideoPreview({
|
||||||
duration: data.duration,
|
duration: data.duration,
|
||||||
getFrame: function(position) {
|
getFrame: function(position) {
|
||||||
var width = pandora.user.ui.sidebarSize,
|
var resolution = Ox.filter(pandora.site.video.resolutions, function(resolution, i) {
|
||||||
height = Math.min(width, 256),
|
return resolution >= data.height || i == pandora.site.video.resolutions.length - 1;
|
||||||
resolution = Ox.filter(pandora.site.video.resolutions, function(resolution, i) {
|
|
||||||
return resolution >= height || i == pandora.site.video.resolutions.length - 1;
|
|
||||||
})[0];
|
})[0];
|
||||||
return '/' + data.id + '/' + resolution + 'p' + (
|
return '/' + data.id + '/' + resolution + 'p' + (
|
||||||
Ox.isUndefined(position) ? '' : position
|
Ox.isUndefined(position) ? '' : position
|
||||||
) + '.jpg';
|
) + '.jpg';
|
||||||
},
|
},
|
||||||
|
frameCSS: data.frameCSS,
|
||||||
frameRatio: data.frameRatio,
|
frameRatio: data.frameRatio,
|
||||||
height: pandora.getInfoHeight(),
|
height: data.height,
|
||||||
scaleToFill: true,
|
scaleToFill: true,
|
||||||
timeline: '/' + data.id + '/timeline16p.png',
|
timeline: '/' + data.id + '/timeline16p.png',
|
||||||
width: pandora.user.ui.sidebarSize
|
width: data.width
|
||||||
})
|
})
|
||||||
.bindEvent({
|
.bindEvent({
|
||||||
click: function(event) {
|
click: function(event) {
|
||||||
|
|
|
@ -43,5 +43,6 @@
|
||||||
"js/pandora/ui/mediaView.js",
|
"js/pandora/ui/mediaView.js",
|
||||||
"js/pandora/ui/home.js",
|
"js/pandora/ui/home.js",
|
||||||
"js/pandora/ui/preferencesDialog.js",
|
"js/pandora/ui/preferencesDialog.js",
|
||||||
|
"js/pandora/ui/listDialog.js",
|
||||||
"js/pandora/ui/siteDialog.js"
|
"js/pandora/ui/siteDialog.js"
|
||||||
]
|
]
|
||||||
|
|
Loading…
Reference in a new issue