mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2025-10-08 21:06:24 +08:00
UI rework of thumbnail view asset controls [SCI-9015] (#6104)
* UI rework of thumbnail view asset controls [SCI-9015] * styling change css -> tailwind
This commit is contained in:
parent
03851503c2
commit
7a1b1b5cf5
3 changed files with 84 additions and 6 deletions
|
@ -84,6 +84,15 @@
|
||||||
white-space: nowrap;
|
white-space: nowrap;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.thumbnail-action-btn {
|
||||||
|
border: 1px solid var(--sn-light-grey);
|
||||||
|
|
||||||
|
&:hover {
|
||||||
|
background-color: var(--sn-white);
|
||||||
|
border-color: var(--sn-blue);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
.attachment-label {
|
.attachment-label {
|
||||||
@include font-main;
|
@include font-main;
|
||||||
margin-top: 1.5em;
|
margin-top: 1.5em;
|
||||||
|
|
|
@ -1,8 +1,11 @@
|
||||||
<template>
|
<template>
|
||||||
<div class="attachment-container asset"
|
<div class="attachment-container asset"
|
||||||
:data-asset-id="attachment.id"
|
:data-asset-id="attachment.id"
|
||||||
|
@mouseover="isHovered = true"
|
||||||
|
@mouseleave="isHovered = false"
|
||||||
>
|
>
|
||||||
<a :href="attachment.attributes.urls.blob"
|
<a v-if="!isHovered"
|
||||||
|
:href="attachment.attributes.urls.blob"
|
||||||
class="file-preview-link file-name"
|
class="file-preview-link file-name"
|
||||||
:id="`modal_link${attachment.id}`"
|
:id="`modal_link${attachment.id}`"
|
||||||
data-no-turbolink="true"
|
data-no-turbolink="true"
|
||||||
|
@ -27,16 +30,63 @@
|
||||||
{{ i18n.t('attachments.new.description') }}
|
{{ i18n.t('attachments.new.description') }}
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
<div class="attachment-metadata">
|
</a>
|
||||||
{{ i18n.t('assets.placeholder.modified_label') }} {{ attachment.attributes.updated_at_formatted }}<br>
|
<div v-else class="hovered-thumbnail">
|
||||||
|
<a
|
||||||
|
:href="attachment.attributes.urls.blob"
|
||||||
|
class="file-preview-link file-name"
|
||||||
|
:id="`modal_link${attachment.id}`"
|
||||||
|
data-no-turbolink="true"
|
||||||
|
:data-id="attachment.id"
|
||||||
|
:data-gallery-view-id="parentId"
|
||||||
|
:data-preview-url="attachment.attributes.urls.preview"
|
||||||
|
>
|
||||||
|
{{ attachment.attributes.file_name }}
|
||||||
|
</a>
|
||||||
|
<div class="absolute bottom-14 text-sn-grey">
|
||||||
{{ attachment.attributes.file_size_formatted }}
|
{{ attachment.attributes.file_size_formatted }}
|
||||||
</div>
|
</div>
|
||||||
</a>
|
<div class="absolute bottom-2 min-w-[194px] justify-between flex">
|
||||||
|
<a class="btn btn-light icon-btn thumbnail-action-btn image-edit-button"
|
||||||
|
:title="i18n.t('attachments.thumbnail.buttons.edit')"
|
||||||
|
:data-image-id="attachment.id"
|
||||||
|
:data-image-name="attachment.attributes.file_name"
|
||||||
|
:data-image-url="attachment.attributes.urls.asset_file"
|
||||||
|
:data-image-quality="attachment.attributes.image_context.quality"
|
||||||
|
:data-image-mime-type="attachment.attributes.image_context.type"
|
||||||
|
:data-image-start-edit-url="attachment.attributes.urls.start_edit_image"
|
||||||
|
>
|
||||||
|
<i class="sn-icon sn-icon-edit"></i>
|
||||||
|
</a>
|
||||||
|
<a class="btn btn-light icon-btn thumbnail-action-btn" :title="i18n.t('attachments.thumbnail.buttons.move')">
|
||||||
|
<!-- TODO -->
|
||||||
|
<i class="sn-icon sn-icon-move"></i>
|
||||||
|
</a>
|
||||||
|
<a class="btn btn-light icon-btn thumbnail-action-btn"
|
||||||
|
:title="i18n.t('attachments.thumbnail.buttons.download')"
|
||||||
|
:href="attachment.attributes.urls.download" data-turbolinks="false">
|
||||||
|
<i class="sn-icon sn-icon-export"></i>
|
||||||
|
</a>
|
||||||
|
<template v-if="attachment.attributes.urls.delete">
|
||||||
|
<a class="btn btn-light icon-btn thumbnail-action-btn"
|
||||||
|
:title="i18n.t('attachments.thumbnail.buttons.delete')"
|
||||||
|
@click.prevent.stop="deleteModal = true">
|
||||||
|
<i class="sn-icon sn-icon-delete"></i>
|
||||||
|
</a>
|
||||||
|
</template>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
<ContextMenu
|
<ContextMenu
|
||||||
:attachment="attachment"
|
:attachment="attachment"
|
||||||
@attachment:viewMode="updateViewMode"
|
@attachment:viewMode="updateViewMode"
|
||||||
@attachment:delete="deleteAttachment"
|
@attachment:delete="deleteAttachment"
|
||||||
/>
|
/>
|
||||||
|
<deleteAttachmentModal
|
||||||
|
v-if="deleteModal"
|
||||||
|
:fileName="attachment.attributes.file_name"
|
||||||
|
@confirm="deleteAttachment"
|
||||||
|
@cancel="deleteModal = false"
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</template>
|
</template>
|
||||||
|
@ -44,10 +94,12 @@
|
||||||
<script>
|
<script>
|
||||||
import ContextMenuMixin from './mixins/context_menu.js'
|
import ContextMenuMixin from './mixins/context_menu.js'
|
||||||
import ContextMenu from './context_menu.vue'
|
import ContextMenu from './context_menu.vue'
|
||||||
|
import deleteAttachmentModal from './delete_modal.vue'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'thumbnailAttachment',
|
name: 'thumbnailAttachment',
|
||||||
mixins: [ContextMenuMixin],
|
mixins: [ContextMenuMixin],
|
||||||
components: { ContextMenu },
|
components: { ContextMenu, deleteAttachmentModal },
|
||||||
props: {
|
props: {
|
||||||
attachment: {
|
attachment: {
|
||||||
type: Object,
|
type: Object,
|
||||||
|
@ -57,6 +109,18 @@
|
||||||
type: Number,
|
type: Number,
|
||||||
required: true
|
required: true
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
isHovered: false,
|
||||||
|
deleteModal: false
|
||||||
|
};
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
deleteAttachment() {
|
||||||
|
this.deleteModal = false;
|
||||||
|
this.$emit('attachment:delete');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
|
@ -394,7 +394,12 @@ en:
|
||||||
no_more_space: 'Failed to upload: You ran out of space'
|
no_more_space: 'Failed to upload: You ran out of space'
|
||||||
general_error: 'Failed to upload: Something went wrong, please try again'
|
general_error: 'Failed to upload: Something went wrong, please try again'
|
||||||
leaving_warning: 'Your changes will be lost if you navigate away'
|
leaving_warning: 'Your changes will be lost if you navigate away'
|
||||||
|
thumbnail:
|
||||||
|
buttons:
|
||||||
|
edit: "Edit"
|
||||||
|
move: "Move"
|
||||||
|
download: "Download"
|
||||||
|
delete: "Delete"
|
||||||
sort:
|
sort:
|
||||||
new_html: "Newest first ↓"
|
new_html: "Newest first ↓"
|
||||||
old_html: "Oldest first ↑"
|
old_html: "Oldest first ↑"
|
||||||
|
|
Loading…
Add table
Reference in a new issue