Skip to content

Commit ce53746

Browse files
committed
Add action to select documents and retrieve their data
1 parent 314526c commit ce53746

File tree

4 files changed

+46
-7
lines changed

4 files changed

+46
-7
lines changed

package.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "laravel-file-manager-element",
3-
"version": "2.5.0",
3+
"version": "2.5.1",
44
"description": "File manager for Laravel with Vue.js and Element Style",
55
"keywords": [
66
"laravel",
@@ -11,6 +11,9 @@
1111
"private": false,
1212
"license": "MIT",
1313
"main": "src/init.js",
14+
"repository": {
15+
"url": "[email protected]:vhs1092/vue-laravel-file-manager.git"
16+
},
1417
"scripts": {
1518
"serve": "vue-cli-service serve",
1619
"build": "vue-cli-service build",

src/components/manager/GridView.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<template>
22
<div class="fm-grid">
3-
<div class="d-flex align-content-start flex-wrap">
3+
<div class="d-flex align-content-start flex-wrap" style="display: flex; align-content: start; flex-wrap: wrap;">
44
<div v-if="!isRootPath" v-on:click="levelUp" class="fm-grid-item text-center" >
55
<div class="fm-item-icon">
66
<i class="far fa-level-up-alt fa-5x pb-2"/>

src/components/manager/Manager.vue

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<!--disk-list v-bind:manager="manager"/-->
44
<breadcrumb v-bind:manager="manager"/>
55
<div class="fm-content-body">
6-
<table-view v-if="viewType === 'table'" v-bind:manager="manager"/>
6+
<table-view v-if="viewType === 'table'" @attachFilesToEmail="attachFilesToEmail" v-bind:manager="manager"/>
77
<grid-view v-else v-bind:manager="manager"/>
88
</div>
99
</div>
@@ -25,7 +25,7 @@ export default {
2525
GridView,
2626
},
2727
props: {
28-
manager: { type: String, required: true },
28+
manager: { type: String, required: true }
2929
},
3030
computed: {
3131
/**
@@ -36,6 +36,11 @@ export default {
3636
return this.$store.state.fm[this.manager].viewType;
3737
},
3838
},
39+
methods:{
40+
attachFilesToEmail(data){
41+
this.$emit('attachFilesToEmail', data);
42+
}
43+
}
3944
};
4045
</script>
4146

src/components/manager/TableView.vue

Lines changed: 34 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
<table class="table table-sm">
44
<thead>
55
<tr>
6+
<th class="w-auto" v-if="files.length > 0"></th>
67
<th class="w-65" v-on:click="sortBy('name')">
78
{{ lang.manager.table.name }}
89
<template v-if="sortSettings.field === 'name'">
@@ -42,6 +43,7 @@
4243
</tr>
4344
</thead>
4445
<tbody>
46+
4547
<tr v-if="!isRootPath">
4648
<td colspan="4" class="fm-content-item" v-on:click="levelUp">
4749
<i class="far fa-level-up-alt"/>
@@ -69,6 +71,8 @@
6971
v-on:click="selectItem('files', file.path, $event)"
7072
v-on:dblclick="selectAction(file.path, file.extension)"
7173
v-on:contextmenu.prevent="contextMenu(file, $event)">
74+
<td><el-checkbox @change.native="confirm_send_files(file)"
75+
align="center"></el-checkbox></td>
7276
<td class="fm-content-item unselectable"
7377
v-bind:class="(acl && file.acl === 0) ? 'text-hidden' : ''">
7478
<i class="far" v-bind:class="extensionToIcon(file.extension)"/>
@@ -91,12 +95,12 @@
9195
import translate from '../../mixins/translate';
9296
import helper from '../../mixins/helper';
9397
import managerHelper from './mixins/manager';
94-
98+
import EventBus from '../../eventBus';
9599
export default {
96100
name: 'table-view',
97101
mixins: [translate, helper, managerHelper],
98-
props: {
99-
manager: { type: String, required: true },
102+
props:{
103+
manager: { type: String, required: true }
100104
},
101105
computed: {
102106
/**
@@ -107,6 +111,12 @@ export default {
107111
return this.$store.state.fm[this.manager].sort;
108112
},
109113
},
114+
data() {
115+
return {
116+
filesToSend:[],
117+
filesToAttach:[]
118+
};
119+
},
110120
methods: {
111121
/**
112122
* Sort by field
@@ -115,6 +125,27 @@ export default {
115125
sortBy(field) {
116126
this.$store.dispatch(`fm/${this.manager}/sortBy`, { field, direction: null });
117127
},
128+
/***
129+
* Files to send through email
130+
*/
131+
confirm_send_files(file){
132+
133+
const result = this.filesToSend.find( ({ file_path }) => file_path === file.path );
134+
if(result !== undefined){
135+
this.filesToSend = this.filesToSend.filter(function(el) { return el.file_path != file.path; });
136+
}else{
137+
138+
let data = {};
139+
data.file_name = file.basename;
140+
data.file_path = file.path;
141+
data.url = file.path;
142+
data.folder_and_file_path = file.path;
143+
data.name = file.basename;
144+
this.filesToSend.push(data);
145+
}
146+
147+
this.$emit('attachFilesToEmail', this.filesToSend);
148+
}
118149
},
119150
};
120151
</script>

0 commit comments

Comments
 (0)