-
-
Notifications
You must be signed in to change notification settings - Fork 182
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
14 changed files
with
362 additions
and
188 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
# Edits | ||
|
||
- in image preview, click the name to copy its url. | ||
- move upload panel bg patterns to its own branch to minimize package size. | ||
- more cleanup. | ||
- uploading new items while the manager is already uploading is now disabled, also the call to update the files list will run only once at the end of the upload to minimize the load on the server. | ||
|
||
# Bulk Select | ||
|
||
- show total selected items size | ||
- show folders nested items count | ||
- fix not being able to manually deselect last item in bulk list | ||
- show items size when deleting + total if more than one | ||
- if you want you can now download a zip file with all the selected files instead of separate ones. https://github.com/ctf0/Laravel-Media-Manager/wiki/Download-Files-as-a-ZipFile | ||
|
||
- update readme | ||
- update assets |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,48 +1,83 @@ | ||
export default { | ||
computed: { | ||
filesList() { | ||
return this.$refs.filesList.$el.children | ||
}, | ||
allFiles() { | ||
if (this.filteredItemsCount) { | ||
return this.filterdList | ||
} | ||
|
||
return this.files.items | ||
}, | ||
filteredItemsCount() { | ||
if (typeof this.filterdList !== 'undefined' && this.filterdList.length > 0) { | ||
return this.filterdList.length | ||
} | ||
}, | ||
allItemsCount() { | ||
if (typeof this.allFiles !== 'undefined' && this.allFiles.length > 0) { | ||
return this.allFiles.length | ||
} | ||
}, | ||
filesList() { | ||
return this.$refs.filesList.$el.children | ||
filteredItemsCount() { | ||
if (typeof this.filterdList !== 'undefined' && this.filterdList.length > 0) { | ||
return this.filterdList.length | ||
} | ||
}, | ||
|
||
// bulk | ||
bulkItemsCount() { | ||
if (typeof this.bulkList !== 'undefined' && this.bulkList.length > 0) { | ||
return this.bulkList.length | ||
} | ||
}, | ||
uploadPanelImg() { | ||
if (this.uploadToggle) { | ||
let list = this.uploadPanelImgList | ||
let url = list[Math.floor(Math.random() * list.length)] | ||
bulkItemsSize() { | ||
let count = 0 | ||
|
||
return { | ||
'background-image': `url("${url}")` | ||
this.bulkList.map((item) => {count += item.size}) | ||
|
||
return this.getFileSize(count) | ||
}, | ||
bulkItemsChild() { | ||
let bulk = this.bulkItemsCount | ||
|
||
if (bulk) { | ||
if (bulk == 1 && !this.selectedFileIs('folder')) { | ||
return | ||
} | ||
|
||
let count = 0 | ||
|
||
this.bulkList.map((item) => { | ||
let list = item.items | ||
|
||
if (list) { | ||
count += list | ||
} | ||
}) | ||
|
||
return count | ||
} | ||
}, | ||
|
||
// this is made so we can still use move/delete | ||
// incase we have multiple files selected | ||
// and one or more of them is locked | ||
bulkListFilter() { | ||
return this.lockedList.length | ||
? this.bulkList.filter((e) => {return !this.lockedList.includes(e.path)}) | ||
: this.bulkList | ||
}, | ||
|
||
// upload panel | ||
uploadPanelImg() { | ||
if (this.uploadToggle) { | ||
let imgs = this.uploadPanelImgList | ||
let grds = this.gradients | ||
|
||
let url = imgs[Math.floor(Math.random() * imgs.length)] | ||
let color = grds[Math.floor(Math.random() * grds.length)] | ||
|
||
return { | ||
'--gradient': color, | ||
'background-image': `url("${url}")` | ||
} | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
// for normal download | ||
require('./../../vendor/download.min') | ||
|
||
// for zip download | ||
const JSZip = require('jszip') | ||
const JSZipUtils = require('jszip-utils') | ||
const FileSaver = require('file-saver') | ||
|
||
export default { | ||
methods: { | ||
// download | ||
saveFile(item) { | ||
if (this.isBulkSelecting()) { | ||
return typeof JSZip != 'undefined' | ||
? this.zipFiles(this.bulkList) | ||
: this.downloadFiles(this.bulkList) | ||
} | ||
|
||
this.downloadFiles([item]) | ||
this.showNotif(`"${item.name}" ${this.trans('downloaded')}`) | ||
}, | ||
downloadFiles(list) { | ||
list.forEach((e) => { | ||
downloadFile(e.path) | ||
}) | ||
this.showNotif('All Done') | ||
}, | ||
zipFiles(list) { | ||
let zip = new JSZip() | ||
let count = 0 | ||
|
||
let folders = this.folders | ||
let folder_name = folders.length | ||
? folders[folders.length - 1] | ||
: 'media_manager' | ||
|
||
list.forEach((e) => { | ||
JSZipUtils.getBinaryContent(e.path, (err, data) => { | ||
if (err) { | ||
console.error(err) | ||
this.showNotif(this.trans('ajax_error'), 'danger') | ||
} | ||
|
||
zip.file(e.name, data, {binary:true}) | ||
count++ | ||
|
||
if (count == list.length) { | ||
zip.generateAsync({ | ||
type:'blob', | ||
compression: 'DEFLATE', | ||
platform: 'UNIX' | ||
}).then((content) => { | ||
FileSaver.saveAs(content, `${folder_name}.zip`) | ||
this.showNotif(`"${folder_name}.zip" ${this.trans('downloaded')}`) | ||
}) | ||
} | ||
}) | ||
}) | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.