mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2025-12-17 14:19:05 +08:00
Add dropable area to step [SCI-6814]
This commit is contained in:
parent
5fe3613eb8
commit
2ee5a31d3d
4 changed files with 51 additions and 3 deletions
|
|
@ -111,6 +111,34 @@
|
||||||
&.showing-comments {
|
&.showing-comments {
|
||||||
border: 1px dotted $brand-primary;
|
border: 1px dotted $brand-primary;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.drop-message {
|
||||||
|
@include font-h3;
|
||||||
|
align-items: center;
|
||||||
|
color: $brand-primary;
|
||||||
|
display: none;
|
||||||
|
height: 100%;
|
||||||
|
justify-content: center;
|
||||||
|
left: 0;
|
||||||
|
pointer-events: none;
|
||||||
|
position: absolute;
|
||||||
|
top: 0;
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
&.draging-file {
|
||||||
|
background-color: $brand-focus-light;
|
||||||
|
position: relative;
|
||||||
|
|
||||||
|
.drop-message {
|
||||||
|
display: flex;
|
||||||
|
}
|
||||||
|
|
||||||
|
*:not(.drop-message) {
|
||||||
|
opacity: 0;
|
||||||
|
pointer-events: none;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.step-element-header {
|
.step-element-header {
|
||||||
|
|
@ -137,7 +165,12 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
.step-element-controls {
|
.step-element-controls {
|
||||||
background: linear-gradient(90deg, rgba(255,255,255,0) 0%, $color-concrete 15%, $color-concrete 100%);
|
background: linear-gradient(
|
||||||
|
90deg,
|
||||||
|
transparent,
|
||||||
|
$color-concrete 15%,
|
||||||
|
$color-concrete 100%
|
||||||
|
);
|
||||||
display: flex;
|
display: flex;
|
||||||
margin-left: auto;
|
margin-left: auto;
|
||||||
position: absolute;
|
position: absolute;
|
||||||
|
|
|
||||||
|
|
@ -11,6 +11,12 @@ export default {
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
dropFile(e) {
|
||||||
|
if (!this.showFileModal && e.dataTransfer && e.dataTransfer.files.length) {
|
||||||
|
this.dragingFile = false;
|
||||||
|
this.uploadFiles(e.dataTransfer.files);
|
||||||
|
}
|
||||||
|
},
|
||||||
uploadFiles(files) {
|
uploadFiles(files) {
|
||||||
const filesToUploadCntr = files.length;
|
const filesToUploadCntr = files.length;
|
||||||
let filesUploadedCntr = 0;
|
let filesUploadedCntr = 0;
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,15 @@
|
||||||
<template>
|
<template>
|
||||||
<div class="step-container"
|
<div class="step-container"
|
||||||
:id="`stepContainer${step.id}`"
|
:id="`stepContainer${step.id}`"
|
||||||
:class="{'showing-comments': showCommentsSidebar}"
|
@drop.prevent="dropFile"
|
||||||
|
@dragenter.prevent="!showFileModal ? dragingFile = true : null"
|
||||||
|
@dragleave.prevent="!showFileModal ? dragingFile = false : null"
|
||||||
|
@dragover.prevent
|
||||||
|
:class="{ 'draging-file': dragingFile, 'showing-comments': showCommentsSidebar }"
|
||||||
>
|
>
|
||||||
|
<div class="drop-message">
|
||||||
|
{{ i18n.t('protocols.steps.drop_message', {position: step.attributes.position + 1}) }}
|
||||||
|
</div>
|
||||||
<div class="step-header">
|
<div class="step-header">
|
||||||
<a class="step-collapse-link"
|
<a class="step-collapse-link"
|
||||||
:href="'#stepBody' + step.id"
|
:href="'#stepBody' + step.id"
|
||||||
|
|
@ -123,7 +130,8 @@
|
||||||
attachments: [],
|
attachments: [],
|
||||||
confirmingDelete: false,
|
confirmingDelete: false,
|
||||||
showFileModal: false,
|
showFileModal: false,
|
||||||
showCommentsSidebar: false
|
showCommentsSidebar: false,
|
||||||
|
dragingFile: false
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
mixins: [AttachmentsMixin],
|
mixins: [AttachmentsMixin],
|
||||||
|
|
|
||||||
|
|
@ -2515,6 +2515,7 @@ en:
|
||||||
comments: "Comments"
|
comments: "Comments"
|
||||||
empty_checklist: "No items"
|
empty_checklist: "No items"
|
||||||
comment_title: "%{user} at %{time}:"
|
comment_title: "%{user} at %{time}:"
|
||||||
|
drop_message: "Drop file to add to step %{position}"
|
||||||
insert:
|
insert:
|
||||||
button: 'Insert'
|
button: 'Insert'
|
||||||
title: 'insert content'
|
title: 'insert content'
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue