Skip to content

Commit ef3873c

Browse files
committed
refactor
1 parent 5519577 commit ef3873c

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

web_src/js/components/ViewFileTreeItem.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,10 +58,9 @@ const onItemClick = (e: MouseEvent) => {
5858
'type-file': item.entryMode === 'blob' || item.entryMode === 'exec',
5959
}"
6060
:title="item.entryName"
61-
:href="store.getWebUrl(item.fullPath)"
61+
:href="store.buildTreePathWebUrl(item.fullPath)"
6262
@click.stop="onItemClick"
6363
>
64-
<!-- directory -->
6564
<div v-if="item.entryMode === 'tree'" class="item-toggle">
6665
<SvgIcon v-if="isLoading" name="octicon-sync" class="circular-spin"/>
6766
<SvgIcon v-else :name="collapsed ? 'octicon-chevron-right' : 'octicon-chevron-down'" @click.stop="doLoadChildren"/>
@@ -77,6 +76,7 @@ const onItemClick = (e: MouseEvent) => {
7776
<ViewFileTreeItem v-for="childItem in children" :key="childItem.entryName" :item="childItem" :store="store"/>
7877
</div>
7978
</template>
79+
8080
<style scoped>
8181
.sub-items {
8282
display: flex;

web_src/js/components/ViewFileTreeStore.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,13 +30,13 @@ export function createViewFileTreeStore(props: { repoLink: string, treePath: str
3030
},
3131

3232
async navigateTreeView(treePath: string) {
33-
const url = store.getWebUrl(treePath);
33+
const url = store.buildTreePathWebUrl(treePath);
3434
window.history.pushState({treePath, url}, null, url);
3535
store.selectedItem = treePath;
3636
await store.loadViewContent(url);
3737
},
3838

39-
getWebUrl(treePath: string) {
39+
buildTreePathWebUrl(treePath: string) {
4040
return `${props.repoLink}/src/${props.currentRefNameSubURL}/${pathEscapeSegments(treePath)}`;
4141
},
4242
});

0 commit comments

Comments
 (0)