add to current item

This commit is contained in:
j 2020-09-11 14:07:08 +02:00
parent 40edf9dd4a
commit 1c0462393c
3 changed files with 33 additions and 29 deletions

View file

@ -106,7 +106,7 @@ pandora.ui.addFilesDialog = function(options) {
}); });
var selectItems = []; var selectItems = [];
if (!pandora.site.itemRequiresVideo && pandora.user.ui.item) { if (pandora.user.ui.item && options.editable) {
selectItems.push({ selectItems.push({
id: 'add', id: 'add',
title: Ox._( title: Ox._(
@ -114,31 +114,23 @@ pandora.ui.addFilesDialog = function(options) {
[pandora.site.itemName.singular.toLowerCase()] [pandora.site.itemName.singular.toLowerCase()]
) )
}); });
}
if (options.items.length > 1) {
selectItems.push({ selectItems.push({
id: 'one', id: 'multiple',
title: Ox._( title: Ox._(
options.items.length > 1 ? 'Create new {0} with multiple parts' : 'Create new {0}', 'Create multiple {0}',
[pandora.site.itemName.singular.toLowerCase()] [pandora.site.itemName.plural.toLowerCase()]
)
});
} else {
if (options.items.length > 1) {
selectItems.push({
id: 'multiple',
title: Ox._(
'Create multiple {0}',
[pandora.site.itemName.plural.toLowerCase()]
)
});
}
selectItems.push({
id: 'one',
title: Ox._(
'Create one {0} with multiple parts',
[pandora.site.itemName.singular.toLowerCase()]
) )
}); });
} }
selectItems.push({
id: 'one',
title: Ox._(
options.items.length > 1 ? 'Create new {0} with multiple parts' : 'Create new {0}',
[pandora.site.itemName.singular.toLowerCase()]
)
});
var $select = Ox.Select({ var $select = Ox.Select({
items: selectItems, items: selectItems,
width: 256 width: 256

View file

@ -270,10 +270,16 @@ pandora.ui.addItemDialog = function(options) {
} else { } else {
$screen.stop(); $screen.stop();
that.close(); that.close();
pandora.ui.addFilesDialog({ (pandora.user.ui.item ? pandora.api.get : Ox.noop)({
action: selected, id: pandora.user.ui.item,
items: items keys: ['editable']
}).open(); }, function(result) {
pandora.ui.addFilesDialog({
action: selected,
items: items,
editable: pandora.user.ui.item && result.data.editable
}).open();
})
} }
}) })
} }

View file

@ -58,10 +58,16 @@ pandora.ui.mediaExistsDialog = function(options) {
return existing.indexOf(item.oshash) == -1; return existing.indexOf(item.oshash) == -1;
}); });
that.close(); that.close();
pandora.ui.addFilesDialog({ (pandora.user.ui.item ? pandora.api.get : Ox.noop)({
action: options.action, id: pandora.user.ui.item,
items: items keys: ['editable']
}).open(); }, function(result) {
pandora.ui.addFilesDialog({
action: options.action,
items: items,
editable: pandora.user.ui.item && result.data.editable
}).open();
})
} }
}) })
]; ];