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

Commit 07f0ea3

Browse files
committed
use map , add render, fix showBy
1 parent 10e45dc commit 07f0ea3

File tree

1 file changed

+39
-38
lines changed
  • src/resources/assets/js/components/bulma

1 file changed

+39
-38
lines changed

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

Lines changed: 39 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
<template></template>
2-
31
<script>
42
/* external classes */
53
// is-warning
@@ -20,7 +18,7 @@ export default {
2018
directories: [],
2119
filterdList: [],
2220
bulkList: [],
23-
showBy: undefined,
21+
showBy: null,
2422
currentFilterName: undefined,
2523
selectedFile: undefined,
2624
searchItemsCount: undefined,
@@ -508,7 +506,7 @@ export default {
508506
$('#file_loader').show()
509507
this.searchFor = ''
510508
this.showFilesOfType('all')
511-
this.showBy = undefined
509+
this.showBy = null
512510
513511
var folder_location = ''
514512
@@ -527,11 +525,11 @@ export default {
527525
this.selectFirst()
528526
$('#right').fadeIn()
529527
530-
for (var i = this.allItemsCount - 1; i >= 0; i--) {
531-
if (typeof this.allFiles[i].size !== 'undefined') {
532-
this.allFiles[i].size = this.bytesToSize(this.allFiles[i].size)
528+
this.allFiles.map((e) => {
529+
if (typeof e.size !== 'undefined') {
530+
e.size = this.bytesToSize(e.size)
533531
}
534-
}
532+
})
535533
})
536534
537535
// dirs list
@@ -606,11 +604,11 @@ export default {
606604
})
607605
608606
// update folder count when folder is moved into another
609-
for (var i = files.length - 1; i >= 0; i--) {
610-
if (files[i].items && files[i].items > 0) {
611-
this.updateFolderCount(destination, files[i].items)
607+
files.map((e) => {
608+
if (e.items && e.items > 0) {
609+
this.updateFolderCount(destination, e.items)
612610
}
613-
}
611+
})
614612
615613
$('#move_file_modal').modal('hide')
616614
this.updateFoundCount(files.length)
@@ -769,29 +767,33 @@ export default {
769767
770768
/* Operations */
771769
removeFromLists(name) {
772-
var i = 0
773-
774770
if (this.filterdList.length) {
775-
for (i = this.filterdList.length - 1; i >= 0; i--) {
776-
if (this.filterdList[i].name.includes(name)) {
777-
this.filterdList.splice(i, 1)
771+
let list = this.filterdList
772+
773+
list.map((e) => {
774+
if (e.name.includes(name)) {
775+
list.splice(list.indexOf(e), 1)
778776
}
779-
}
777+
})
780778
}
781779
782780
if (this.directories.length) {
783-
for (i = this.directories.length - 1; i >= 0; i--) {
784-
if (this.directories[i].includes(name)) {
785-
this.directories.splice(i, 1)
781+
let list = this.directories
782+
783+
list.map((e) => {
784+
if (e.includes(name)) {
785+
list.splice(list.indexOf(e), 1)
786786
}
787-
}
787+
})
788788
}
789789
790-
for (i = this.files.items.length - 1; i >= 0; i--) {
791-
if (this.files.items[i].name.includes(name)) {
792-
this.files.items.splice(i, 1)
790+
this.files.items.map((e) => {
791+
if (e.name.includes(name)) {
792+
let list = this.files.items
793+
794+
list.splice(list.indexOf(e), 1)
793795
}
794-
}
796+
})
795797
796798
this.clearSelected()
797799
},
@@ -802,21 +804,19 @@ export default {
802804
destination = destination.split('/').shift()
803805
}
804806
805-
var i = 0
806-
807807
if (this.filterdList.length) {
808-
for (i = this.filterdList.length - 1; i >= 0; i--) {
809-
if (this.filterdList[i].name.includes(destination)) {
810-
this.filterdList[i].items += parseInt(count)
808+
this.filterdList.map((e) => {
809+
if (e.name.includes(destination)) {
810+
e.items += parseInt(count)
811811
}
812-
}
812+
})
813813
}
814814
815-
for (i = this.files.items.length - 1; i >= 0; i--) {
816-
if (this.files.items[i].name.includes(destination)) {
817-
this.files.items[i].items += parseInt(count)
815+
this.files.items.map((e) => {
816+
if (e.name.includes(destination)) {
817+
e.items += parseInt(count)
818818
}
819-
}
819+
})
820820
}
821821
},
822822
updateItemName(item, oldName, newName) {
@@ -937,13 +937,14 @@ export default {
937937
showBy(val) {
938938
if (val) {
939939
if (val == 'clear') {
940-
this.showBy = undefined
940+
this.showBy = null
941941
}
942942
if (!this.isBulkSelecting()) {
943943
this.selectFirst()
944944
}
945945
}
946946
}
947-
}
947+
},
948+
render () {}
948949
}
949950
</script>

0 commit comments

Comments
 (0)