|
1 | 1 | <template> |
2 | 2 | <div> |
3 | | - <div class="row" :class="{ clickable: canEdit(file), 'active-selection': contextMenuVisible }" v-on:contextmenu="showContextMenu"> |
4 | | - <div class="flex-none icon"> |
5 | | - <Icon name="file-text" v-if="!file.symlink"/> |
6 | | - <Icon name="link2" v-else/> |
| 3 | + <div v-on:contextmenu="showContextMenu"> |
| 4 | + <div class="row" :class="{ clickable: canEdit(file), 'active-selection': contextMenuVisible }" v-if="!file.directory"> |
| 5 | + <div class="flex-none icon"> |
| 6 | + <Icon name="file-text" v-if="!file.symlink"/> |
| 7 | + <Icon name="link2" v-else/> |
| 8 | + </div> |
| 9 | + <div class="flex-1">{{file.name}}</div> |
| 10 | + <div class="flex-1 text-right text-neutral-600">{{readableSize(file.size)}}</div> |
| 11 | + <div class="flex-1 text-right text-neutral-600">{{formatDate(file.modified)}}</div> |
| 12 | + <div class="flex-none w-1/6"></div> |
7 | 13 | </div> |
8 | | - <div class="flex-1">{{file.name}}</div> |
9 | | - <div class="flex-1 text-right text-neutral-600">{{readableSize(file.size)}}</div> |
10 | | - <div class="flex-1 text-right text-neutral-600">{{formatDate(file.modified)}}</div> |
11 | | - <div class="flex-none w-1/6"></div> |
| 14 | + <router-link class="row clickable" |
| 15 | + :class="{ 'active-selection': contextMenuVisible }" |
| 16 | + :to="{ name: 'server-files', params: { path: getClickablePath(file.name) }}" |
| 17 | + v-else |
| 18 | + > |
| 19 | + <div class="flex-none icon text-primary-700"> |
| 20 | + <Icon name="folder"/> |
| 21 | + </div> |
| 22 | + <div class="flex-1">{{file.name}}</div> |
| 23 | + <div class="flex-1 text-right text-neutral-600"></div> |
| 24 | + <div class="flex-1 text-right text-neutral-600">{{formatDate(file.modified)}}</div> |
| 25 | + <div class="flex-none w-1/6"></div> |
| 26 | + </router-link> |
| 27 | + |
12 | 28 | </div> |
13 | 29 | <FileContextMenu |
14 | 30 | class="context-menu" |
|
41 | 57 | required: true, |
42 | 58 | }, |
43 | 59 | editable: { |
44 | | - type: Array, |
45 | | - required: true, |
| 60 | + type: Array as () => Array<string>, |
| 61 | + default: () => [], |
| 62 | + required: false, |
46 | 63 | }, |
47 | 64 | }, |
48 | 65 |
|
49 | 66 | data: function () { |
50 | 67 | return { |
| 68 | + currentDirectory: this.$route.params.path || '/', |
51 | 69 | contextMenuVisible: false, |
52 | 70 | deleteModalVisible: false, |
53 | 71 | }; |
|
96 | 114 | /** |
97 | 115 | * Determine if a file can be edited on the Panel. |
98 | 116 | */ |
99 | | - canEdit: function (file: any): boolean { |
100 | | - return this.editable.indexOf(file.mime) >= 0; |
| 117 | + canEdit: function (file: DirectoryContentObject): boolean { |
| 118 | + return !file.directory && this.editable.indexOf(file.mime) >= 0; |
101 | 119 | }, |
102 | 120 |
|
103 | 121 | /** |
|
114 | 132 | } |
115 | 133 | }, |
116 | 134 |
|
| 135 | + getClickablePath(directory: string): string { |
| 136 | + return `${this.currentDirectory.replace(/\/$/, '')}/${directory}`; |
| 137 | + }, |
| 138 | +
|
117 | 139 | readableSize: readableSize, |
118 | 140 | formatDate: formatDate, |
119 | 141 | }, |
|
0 commit comments