Skip to content
This repository was archived by the owner on May 22, 2025. It is now read-only.

Commit 313f6d8

Browse files
committed
v2.2.1
- change config `hide_ext` to `hide_files_ext` - fix the damn move btn disable/enable for good - fixed enabling directory even if its inside the locked list - fixed going to prev folder in restricted path - fixed refresh issue in restricted path - use plain html for form instead of laravel-collection - use axios instead of jquery ajax - jquery is now only handling “keydown & player events” (if anyone can convert those to plain js i would deeply appreciate it) - optimize fileSelected event to fire only when using the manager from a modal. - updated https://github.com/ctf0/Laravel-Media-Manager/wiki/Folder-Restriction - updated https://github.com/ctf0/Laravel-Media-Manager/wiki/Lock-Files-&-Folder - update assets - update view - update readme
1 parent 40f219d commit 313f6d8

File tree

14 files changed

+303
-262
lines changed

14 files changed

+303
-262
lines changed

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@
4343
- directly copy selected file link.
4444
- use manager [from modal with ease](https://github.com/ctf0/Laravel-Media-Manager/wiki/Use-The-Manager-From-A-Modal)
4545
- auto scroll to selected item when using (left/up, right/down, home, end)
46-
- [lock selected files/folders](https://github.com/ctf0/Laravel-Media-Manager/wiki/Lock-Files-Folder)
46+
- [lock selected files/folders](https://github.com/ctf0/Laravel-Media-Manager/wiki/Lock-Files-&-Folder)
4747
- search
4848
- filter by type
4949
+ folder
@@ -174,9 +174,9 @@ return [
174174
- install dependencies
175175

176176
```bash
177-
yarn add vue dropzone keycode vue-tippy vue2-filters vuemit vue-notif vue-clipboard2 vue-touch@next babel-preset-es2015-node6 babel-preset-stage-2
177+
yarn add vue axios dropzone keycode vue-tippy vue2-filters vuemit vue-notif vue-clipboard2 vue-touch@next babel-preset-es2015-node6 babel-preset-stage-2
178178
# or
179-
npm install vue dropzone keycode vue-tippy vue2-filters vuemit vue-notif vue-clipboard2 vue-touch@next babel-preset-es2015-node6 babel-preset-stage-2 --save
179+
npm install vue axios dropzone keycode vue-tippy vue2-filters vuemit vue-notif vue-clipboard2 vue-touch@next babel-preset-es2015-node6 babel-preset-stage-2 --save
180180
```
181181

182182
- for styling we use ***bulma***

logs/v2.2.0.txt

Lines changed: 0 additions & 11 deletions
This file was deleted.

logs/v2.2.1.txt

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
- change config `hide_ext` to `hide_files_ext`
2+
- fix the damn move btn disable/enable for good
3+
- fixed enabling directory even if its inside the locked list
4+
- fixed going to prev folder in restricted path
5+
- fixed refresh issue in restricted path
6+
- use plain html for form instead of laravel-collection
7+
- use axios instead of jquery ajax
8+
- jquery is now only handling “keydown & player events” (if anyone can convert those to plain js i would deeply appreciate it)
9+
- optimize fileSelected event to fire only when using the manager from a modal.
10+
- updated https://github.com/ctf0/Laravel-Media-Manager/wiki/Folder-Restriction
11+
- updated https://github.com/ctf0/Laravel-Media-Manager/wiki/Lock-Files-&-Folder
12+
- update assets
13+
- update view
14+
- update readme

src/resources/assets/js/components/media.vue

Lines changed: 60 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -36,12 +36,18 @@ export default {
3636
data() {
3737
return {
3838
isLoading: false,
39-
linkCopied: false,
39+
no_files: false,
40+
file_loader: false,
41+
ajax_error: false,
4042
toggleInfo: true,
43+
uploadToggle: false,
44+
uploadStart: false,
45+
uploadProgress: 0,
46+
47+
linkCopied: false,
4148
bulkSelectAll: false,
4249
bulkSelect: false,
4350
folderWarning: false,
44-
uploadToggle: false,
4551
checkForFolders: false,
4652
4753
files: [],
@@ -51,18 +57,24 @@ export default {
5157
bulkList: [],
5258
lockedList: [],
5359
54-
moveToPath: undefined,
55-
selectedFile: undefined,
56-
sortBy: undefined,
57-
currentFilterName: undefined,
58-
searchItemsCount: undefined,
59-
searchFor: undefined,
60-
new_folder_name: undefined,
61-
new_filename: undefined
60+
moveToPath: null,
61+
selectedFile: null,
62+
currentFileIndex: null,
63+
sortBy: null,
64+
currentFilterName: null,
65+
searchItemsCount: null,
66+
searchFor: null,
67+
new_folder_name: null,
68+
new_filename: null,
69+
active_modal: null
6270
}
6371
},
6472
created() {
65-
this.loadFiles()
73+
if (this.checkForRestrictedPath()) {
74+
return this.restrictAccess()
75+
}
76+
77+
this.getFiles()
6678
},
6779
mounted() {
6880
this.fileUpload()
@@ -86,17 +98,14 @@ export default {
8698
fileUpload() {
8799
let manager = this
88100
89-
$('#new-upload').dropzone({
101+
new Dropzone('#new-upload', {
90102
createImageThumbnails: false,
91103
parallelUploads: 10,
92104
uploadMultiple: true,
93105
forceFallback: false,
94106
previewsContainer: '#uploadPreview',
95107
processingmultiple() {
96-
$('#uploadProgress').fadeIn()
97-
},
98-
totaluploadprogress(uploadProgress) {
99-
$('.progress-bar').css('width', uploadProgress + '%')
108+
manager.uploadStart = true
100109
},
101110
successmultiple(files, res) {
102111
res.data.map((item) => {
@@ -107,16 +116,18 @@ export default {
107116
}
108117
})
109118
110-
manager.loadFiles(manager.folders)
119+
manager.getFiles(manager.folders)
120+
},
121+
totaluploadprogress(uploadProgress) {
122+
return manager.uploadProgress = `${uploadProgress}%`
111123
},
112124
errormultiple(files, res) {
113-
this.showNotif(res, 'danger')
125+
manager.showNotif(res, 'danger')
114126
},
115127
queuecomplete() {
128+
manager.uploadStart = false
129+
manager.uploadProgress = 0
116130
manager.toggleUploadPanel()
117-
$('#uploadProgress').fadeOut(() => {
118-
$('.progress-bar').css('width', 0)
119-
})
120131
}
121132
})
122133
},
@@ -125,9 +136,9 @@ export default {
125136
$(document).keydown((e) => {
126137
127138
// when modal isnt visible
128-
if (!$('.mm-modal').hasClass('is-active')) {
139+
if (!this.active_modal) {
129140
// when search is not focused
130-
if (!$('.input').is(':focus')) {
141+
if (document.activeElement.dataset.search == undefined) {
131142
// when no bulk selecting
132143
if (!this.isBulkSelecting()) {
133144
@@ -162,15 +173,15 @@ export default {
162173
// "show" image quick view
163174
if (this.selectedFileIs('image')) {
164175
this.noScroll('add')
165-
this.toggleModal('#preview_modal')
176+
this.toggleModal('preview_modal')
166177
}
167178
}
168179
}
169180
// end of when there are files
170181
171182
// refresh
172183
if (keycode(e) == 'r') {
173-
this.loadFiles(this.folders)
184+
this.getFiles(this.folders)
174185
}
175186
176187
// file upload
@@ -234,12 +245,7 @@ export default {
234245
235246
// when modal is visible
236247
else {
237-
if (keycode(e) == 'enter') {
238-
e.preventDefault()
239-
$('.mm-modal.is-active').find('button[type="submit"]').trigger('click')
240-
}
241-
242-
if (this.lightBoxIsActive()) {
248+
if (this.isActiveModal('preview_modal')) {
243249
// hide lb
244250
if (keycode(e) == 'space') {
245251
e.preventDefault()
@@ -278,26 +284,23 @@ export default {
278284
})
279285
}
280286
281-
this.toggleModal('#confirm_delete_modal')
287+
this.toggleModal('confirm_delete_modal')
282288
},
283289
moveItem() {
284-
this.toggleModal('#move_file_modal')
290+
this.toggleModal('move_file_modal')
285291
},
286292
renameItem() {
287-
this.toggleModal('#rename_file_modal')
293+
this.toggleModal('rename_file_modal')
288294
},
289295
blkSlct() {
290296
this.bulkSelect = !this.bulkSelect
291-
292-
// reset when toggled off
293-
if (this.isBulkSelecting()) {
294-
return this.clearSelected()
295-
}
296-
297297
this.bulkSelectAll = false
298-
this.clearSelected()
299298
this.resetInput('bulkList', [])
300-
this.selectFirst()
299+
this.resetInput('selectedFile')
300+
301+
if (!this.isBulkSelecting()) {
302+
this.selectFirst()
303+
}
301304
},
302305
blkSlctAll() {
303306
// if no items in bulk list
@@ -309,26 +312,30 @@ export default {
309312
}
310313
311314
// if found search items
312-
if (this.searchItemsCount) {
315+
if (this.searchFor && this.searchItemsCount) {
313316
this.bulkSelectAll = true
314-
$('#files li').each(function() {
315-
$(this).trigger('click')
316-
})
317+
318+
let list = this.filesList
319+
for (let i = list.length - 1; i >= 0; i--) {
320+
list[i].click()
321+
}
317322
}
318323
}
319324
320325
// if having search + having bulk items < search found items
321326
else if (this.searchFor && this.bulkItemsCount < this.searchItemsCount) {
322327
this.resetInput('bulkList', [])
323-
this.clearSelected()
328+
this.resetInput('selectedFile')
324329
325330
if (this.bulkSelectAll) {
326331
this.bulkSelectAll = false
327332
} else {
328333
this.bulkSelectAll = true
329-
$('#files li').each(function() {
330-
$(this).trigger('click')
331-
})
334+
335+
let list = this.filesList
336+
for (let i = list.length - 1; i >= 0; i--) {
337+
list[i].click()
338+
}
332339
}
333340
}
334341
@@ -342,14 +349,14 @@ export default {
342349
this.bulkList = this.allFiles.slice(0)
343350
}
344351
345-
this.clearSelected()
352+
this.resetInput('selectedFile')
346353
}
347354
348355
// otherwise
349356
else {
350357
this.bulkSelectAll = false
351358
this.resetInput('bulkList', [])
352-
this.clearSelected()
359+
this.resetInput('selectedFile')
353360
}
354361
355362
// if we have items in bulk list, select first item
@@ -400,7 +407,7 @@ export default {
400407
}
401408
402409
if (!this.allItemsCount) {
403-
this.clearSelected()
410+
this.resetInput('selectedFile')
404411
}
405412
}
406413
},

src/resources/assets/js/components/mixins/computed.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,15 @@ export default {
1717
return this.allFiles.length
1818
}
1919
},
20+
filesList() {
21+
return this.$refs.filesList.$el.children
22+
},
2023
bulkItemsCount() {
2124
if (typeof this.bulkList !== 'undefined' && this.bulkList.length > 0) {
2225
return this.bulkList.length
2326
}
2427
},
28+
2529
// this is made so we can still use move/delete
2630
// incase we have multiple files selected
2731
// and one or more of them is locked

src/resources/assets/js/components/mixins/filtration.js

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ export default {
4545
}
4646

4747
if (!this.isBulkSelecting()) {
48-
this.clearSelected()
48+
this.resetInput('selectedFile')
4949
this.selectFirst()
5050
}
5151

@@ -71,23 +71,18 @@ export default {
7171
let oldCount = this.searchItemsCount
7272

7373
this.$nextTick(() => {
74-
this.searchItemsCount = parseInt($('#files li').length)
75-
76-
if (this.searchItemsCount == 0 && oldCount == 0) {
77-
return
78-
}
74+
this.searchItemsCount = this.filesList.length
7975

8076
if (this.searchItemsCount == 0) {
77+
if (oldCount == 0) {
78+
return
79+
}
80+
8181
return this.noFiles('show')
8282
}
8383

8484
this.noFiles('hide')
8585
})
86-
},
87-
updateFoundCount(count) {
88-
if (this.searchFor) {
89-
this.searchItemsCount = parseInt(this.searchItemsCount - count)
90-
}
9186
}
9287
}
9388
}

0 commit comments

Comments
 (0)