Skip to content

Commit

Permalink
Merge pull request #1847 from dandi/open-on-click
Browse files Browse the repository at this point in the history
Open asset on click
  • Loading branch information
waxlamp authored Feb 9, 2024
2 parents 6837233 + c127907 commit cdb7327
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions web/src/views/FileBrowserView/FileBrowser.vue
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@
v-for="item in items"
:key="item.path"
color="primary"
@click="selectPath(item)"
@click.self="openItem(item)"
>
<v-icon
class="mr-2"
Expand Down Expand Up @@ -158,7 +158,7 @@
</v-icon>
</v-btn>
</template>
<span>Open asset in browser</span>
<span>Open asset in browser (you can also click on the item itself)</span>
</v-tooltip>
</v-list-item-action>

Expand Down Expand Up @@ -445,12 +445,16 @@ function locationSlice(index: number) {
return `${splitLocation.value.slice(0, index + 1).join('/')}/`;
}
function selectPath(item: AssetPath) {
function openItem(item: AssetPath) {
const { asset, path } = item;
// Return early if path is a file
if (asset) { return; }
location.value = path;
if (asset) {
// If the item is an asset, open it in the browser.
window.open(inlineURI(asset.asset_id), "_self");
} else {
// If it's a directory, move into it.
location.value = path;
}
}
function navigateToParent() {
Expand Down

0 comments on commit cdb7327

Please sign in to comment.