Skip to content

Commit

Permalink
[5.x] Fix asset tile buttons in read-only mode (#10622)
Browse files Browse the repository at this point in the history
  • Loading branch information
daun authored Aug 13, 2024
1 parent c6180f6 commit 3b69981
Showing 1 changed file with 31 additions and 28 deletions.
59 changes: 31 additions & 28 deletions resources/js/components/fieldtypes/assets/AssetTile.vue
Original file line number Diff line number Diff line change
Expand Up @@ -38,37 +38,40 @@
</template>
</template>

<div class="asset-controls" v-if="!readOnly">
<div class="h-full w-full flex items-center justify-center space-x-1 rtl:space-x-reverse">
<button @click="edit" class="btn btn-icon" :title="__('Edit')">
<svg-icon name="micro/sharp-pencil" class="h-4 my-2" />
</button>

<button @click="remove" class="btn btn-icon" :title="__('Remove')">
<span class="text-lg antialiased w-4">×</span>
</button>
<div class="asset-controls">
<div class="flex items-center justify-center space-x-1 rtl:space-x-reverse">
<template v-if="!readOnly">
<button @click="edit" class="btn btn-icon" :title="__('Edit')">
<svg-icon name="micro/sharp-pencil" class="h-4 my-2" />
</button>

<button @click="remove" class="btn btn-icon" :title="__('Remove')">
<span class="text-lg antialiased w-4">×</span>
</button>
</template>

<template v-else>
<button
v-if="asset.url && asset.isMedia && this.canDownload"
@click="open"
class="btn btn-icon"
:title="__('Open in a new window')"
>
<svg-icon name="light/external-link" class="h-4 my-2" />
</button>

<button
v-if="asset.allowDownloading && this.canDownload"
@click="download"
class="btn btn-icon"
:title="__('Download file')"
>
<svg-icon name="light/download" class="h-4 my-2" />
</button>
</template>
</div>
</div>

<div class="asset-controls" v-if="readOnly">
<button
v-if="asset.url && asset.isMedia && this.canDownload"
@click="open"
class="btn btn-icon"
:title="__('Open in a new window')"
>
<svg-icon name="light/external-link" class="h-4 my-2" />
</button>

<button
v-if="asset.allowDownloading && this.canDownload"
@click="download"
class="btn btn-icon"
:title="__('Download file')"
>
<svg-icon name="download" class="h-4 my-2" />
</button>
</div>
</div>
</div>

Expand Down

0 comments on commit 3b69981

Please sign in to comment.