enable/disable files
This commit is contained in:
parent
48f078db5f
commit
5beba72d39
5 changed files with 34 additions and 12 deletions
|
|
@ -46,6 +46,9 @@ pandora.ui.filesView = function(options, self) {
|
|||
self.$filesList = Ox.TextList({
|
||||
columns: [
|
||||
{
|
||||
clickable: function(data) {
|
||||
return true;
|
||||
},
|
||||
format: function(value, data) {
|
||||
Ox.print('File', value, data.wanted, data);
|
||||
return $('<img>')
|
||||
|
|
@ -65,6 +68,11 @@ pandora.ui.filesView = function(options, self) {
|
|||
title: $('<img>').attr({
|
||||
src: Ox.UI.getImageURL('symbolCheck')
|
||||
}),
|
||||
tooltip: function (data) {
|
||||
return data.instances.filter(function(i) {return i.ignore; }).length > 0
|
||||
? 'Use this file'
|
||||
: 'Dont use this file';
|
||||
},
|
||||
visible: true,
|
||||
width: 16
|
||||
},
|
||||
|
|
@ -166,8 +174,21 @@ pandora.ui.filesView = function(options, self) {
|
|||
sort: [{key: 'path', operator: '+'}]
|
||||
})
|
||||
.bindEvent({
|
||||
click: function(data) {
|
||||
if (data.key == 'selected') {
|
||||
var ignored = self.$filesList.value(data.id, 'instances')
|
||||
.filter(function(i) {return i.ignore; }).length > 0;
|
||||
pandora.api.editFile({
|
||||
id: data.id,
|
||||
ignore: !ignored
|
||||
}, function(result) {
|
||||
Ox.Request.clearCache();
|
||||
self.$filesList.reloadList();
|
||||
});
|
||||
}
|
||||
},
|
||||
open: openFiles,
|
||||
select: selectFiles
|
||||
select: selectFiles,
|
||||
});
|
||||
|
||||
self.$instancesList = Ox.TextList({
|
||||
|
|
|
|||
|
|
@ -218,15 +218,12 @@ pandora.ui.folderList = function(id) {
|
|||
}
|
||||
];
|
||||
items = function(data, callback) {
|
||||
var volumes = pandora.user.volumes || [
|
||||
{"name": "Movies A-M", "path": "/Volumes/Movies A-M", "items": 1234},
|
||||
{"name": "Movies N-Z", "path": "/Volumes/Movies N-Z", "items": 987}
|
||||
];
|
||||
var volumes = pandora.user.volumes || [];
|
||||
if (!data.keys) {
|
||||
data = {items: volumes.length};
|
||||
} else {
|
||||
data = {items: volumes.map(function(volume) {
|
||||
return Ox.extend({id: volume.name, user: pandora.user.username, mounted: volume.name == 'Movies A-M'}, volume);
|
||||
return Ox.extend({id: volume.name, user: pandora.user.username}, volume);
|
||||
})};
|
||||
}
|
||||
// fixme: ridiculous (we're binding to init too late)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue