Skip to content

Commit

Permalink
fix(files): better doc and code cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
josephmcg committed Apr 28, 2022
1 parent 9c35a2d commit 80b5b1e
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 19 deletions.
4 changes: 2 additions & 2 deletions components/views/files/aside/Aside.html
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@

<div>
<TypographyText :size="6" :text="$t('pages.files.aside.quick_access')" />
<UiSimpleList :items="quickAccessOptions" />
<FilesAsideList :items="quickAccessOptions" />
</div>
<div>
<TypographyText :size="6" :text="$t('pages.files.aside.shared_items')" />
<UiSimpleList :items="sharedItemsOptions" />
<FilesAsideList :items="sharedItemsOptions" />
</div>
</div>
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<ul class="menu-list">
<li
v-for="item in items"
:class="[{'is-active' : isActiveRoute(item.route)}, {'no-icon' : !item.icon}]"
:class="{'is-active' : isActiveRoute(item.route)}"
@click="setActive(item.route)"
>
<component v-if="item.icon" :is="icons[item.icon]" size="1x" />
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<template src="./SimpleList.html"></template>
<template src="./List.html"></template>

<script lang="ts">
import Vue, { PropType } from 'vue'
Expand Down Expand Up @@ -46,13 +46,7 @@ export default Vue.extend({
this.$router.push({ query: { route } })
},
isActiveRoute(route: FileAsideRouteEnum) {
if (!this.$route.query.route && route === FileAsideRouteEnum.DEFAULT) {
return true
}
if (
!Object.values(FileAsideRouteEnum).includes(this.$route.query.route) &&
route === FileAsideRouteEnum.DEFAULT
) {
if (!this.$route.query.route && !route) {
return true
}
return route === this.$route.query.route
Expand All @@ -61,4 +55,4 @@ export default Vue.extend({
})
</script>

<style scoped lang="less" src="./SimpleList.less"></style>
<style scoped lang="less" src="./List.less"></style>
10 changes: 6 additions & 4 deletions components/views/files/list/List.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,16 @@
<thead>
<th @click="setSort(FileSortEnum.NAME)">
{{ $t('pages.files.browse.name') }}
<template v-if="sort.category===FileSortEnum.NAME">
<template v-if="sort.category===FileSortEnum.NAME && !$route.query.route">
<chevron-up-icon v-if="sort.asc" size="1x" />
<chevron-down-icon v-else size="1x" />
</template>
</th>
<th @click="setSort(FileSortEnum.MODIFIED)">
{{ $t('pages.files.browse.modified') }}
<template v-if="sort.category===FileSortEnum.MODIFIED">
<template
v-if="sort.category===FileSortEnum.MODIFIED && !$route.query.route"
>
<chevron-up-icon v-if="sort.asc" size="1x" />
<chevron-down-icon v-else size="1x" />
</template>
Expand All @@ -20,14 +22,14 @@
class="open-sidebar-hide"
>
{{ $t('pages.files.browse.type') }}
<template v-if="sort.category===FileSortEnum.TYPE">
<template v-if="sort.category===FileSortEnum.TYPE && !$route.query.route">
<chevron-up-icon v-if="sort.asc" size="1x" />
<chevron-down-icon v-else size="1x" />
</template>
</th>
<th @click="setSort(FileSortEnum.SIZE)" class="open-sidebar-hide">
{{ $t('pages.files.browse.size') }}
<template v-if="sort.category===FileSortEnum.SIZE">
<template v-if="sort.category===FileSortEnum.SIZE && !$route.query.route">
<chevron-up-icon v-if="sort.asc" size="1x" />
<chevron-down-icon v-else size="1x" />
</template>
Expand Down
8 changes: 5 additions & 3 deletions pages/files/browse/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,13 @@ export default Vue.extend({
},
},
watch: {
'$route.params.route': {
handler() {
'$route.query.route': {
handler(value) {
this.fileSystem.goBackToDirectory('root')
if (!Object.values(FileAsideRouteEnum).includes(value)) {
this.$router.push({ query: {} })
}
},
deep: true,
},
},
methods: {
Expand Down

0 comments on commit 80b5b1e

Please sign in to comment.