mirror of
https://github.com/lrsjng/h5ai.git
synced 2025-05-25 12:34:47 -04:00
Merge pull request #380 from dfransway/master
Special case the naming of archives based on a single selection.
This commit is contained in:
commit
015d1f58e6
2 changed files with 10 additions and 2 deletions
|
@ -29,9 +29,17 @@ modulejs.define('ext/download', ['_', '$', 'core/settings', 'core/resource', 'co
|
||||||
|
|
||||||
var type = settings.type;
|
var type = settings.type;
|
||||||
var extension = (type === 'shell-zip') ? 'zip' : 'tar';
|
var extension = (type === 'shell-zip') ? 'zip' : 'tar';
|
||||||
|
|
||||||
|
var name;
|
||||||
|
if (selectedItems.length === 1) {
|
||||||
|
name = selectedItems[0].label;
|
||||||
|
} else {
|
||||||
|
name = location.getItem().label;
|
||||||
|
}
|
||||||
|
|
||||||
var query = {
|
var query = {
|
||||||
action: 'download',
|
action: 'download',
|
||||||
as: (settings.packageName || location.getItem().label) + '.' + extension,
|
as: (settings.packageName || name) + '.' + extension,
|
||||||
type: type,
|
type: type,
|
||||||
hrefs: _.pluck(selectedItems, 'absHref').join('|:|')
|
hrefs: _.pluck(selectedItems, 'absHref').join('|:|')
|
||||||
};
|
};
|
||||||
|
|
|
@ -84,7 +84,7 @@ Options
|
||||||
To select files the "select"-extension needs to be enabled.
|
To select files the "select"-extension needs to be enabled.
|
||||||
|
|
||||||
- type: "php-tar", "shell-tar" or "shell-zip"
|
- type: "php-tar", "shell-tar" or "shell-zip"
|
||||||
- packageName: basename of the download package, null for current foldername
|
- packageName: basename of the download package, null for current filename or foldername
|
||||||
- alwaysVisible: always show download button (defaults to download the current folder)
|
- alwaysVisible: always show download button (defaults to download the current folder)
|
||||||
*/
|
*/
|
||||||
"download": {
|
"download": {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue