Popup attached for delete Button

This commit is contained in:
Soumya Himanish Mohapatra 2017-12-23 08:50:19 +05:30
parent 1d2b0cb093
commit 9f162c0703

View file

@ -65,7 +65,23 @@ module.exports = function(state, emit) {
<button id="delete-file" <button id="delete-file"
class="btn" class="btn"
title="${state.translate('deleteFileButton')}" title="${state.translate('deleteFileButton')}"
onclick=${deleteFile}>${state.translate('deleteFileButton')}</button> onclick=${showPopup}>${state.translate('deleteFileButton')}
<div class="popup">
<div class="popuptext" onblur=${cancel} tabindex="-1">
<div class="popup-message">${state.translate(
'deletePopupText'
)}</div>
<div class="popup-action">
<span class="popup-no" onclick=${cancel}>${state.translate(
'deletePopupCancel'
)}</span>
<span class="popup-yes" onclick=${deleteFile}>${state.translate(
'deletePopupYes'
)}</span>
</div>
</div>
</div>
</button>
<a class="send-new" <a class="send-new"
data-state="completed" data-state="completed"
href="/" href="/"
@ -74,6 +90,17 @@ module.exports = function(state, emit) {
</div> </div>
`; `;
function showPopup() {
const popupText = document.querySelector('.popuptext');
popupText.classList.add('show');
}
function cancel(e) {
e.stopPropagation();
const popupText = e.target.parentElement.parentElement;
popupText.classList.remove('show');
}
async function sendNew(e) { async function sendNew(e) {
e.preventDefault(); e.preventDefault();
await fadeOut('share-link'); await fadeOut('share-link');