Confirm popups (#135)

* Added confirmation popup for account deletion
(I nearly deleted my account twice, please help me)
Added component for easy adding of new confirmation popups.

* Add confirmation popup for mod deleting

* Add confirmation popup for version & file deletion

* Changed the placeholder to a generic value
This commit is contained in:
Redblueflame
2021-03-30 18:02:45 +02:00
committed by GitHub
parent 1dc6e085cc
commit 464f336790
5 changed files with 214 additions and 5 deletions

View File

@@ -11,6 +11,22 @@
]"
:user-follows="userFollows"
>
<ConfirmPopup
ref="delete_file_popup"
title="Are you sure you want to delete this file?"
description="This will remove this file forever (like really forever)"
:has-to-type="false"
proceed-label="Delete File"
@proceed="deleteFile(popup_data)"
/>
<ConfirmPopup
ref="delete_version_popup"
title="Are you sure you want to delete this version?"
description="This will remove this version forever (like really forever), and if some mods depends on this version, it won't work anymore."
:has-to-type="false"
proceed-label="Delete Version"
@proceed="deleteVersion()"
/>
<div class="version">
<div class="version-header">
<h4>{{ version.name }}</h4>
@@ -39,7 +55,7 @@
<button
v-if="currentMember"
class="action iconified-button"
@click="deleteVersion"
@click="deleteVersionPopup"
>
<TrashIcon />
Delete
@@ -108,7 +124,9 @@
<div class="text-wrapper">
<p>{{ file.filename }}</p>
<div v-if="currentMember" class="actions">
<button @click="deleteFile(file.hashes.sha1)">Delete File</button>
<button @click="deleteFilePopup(file.hashes.sha1)">
Delete File
</button>
<button @click="makePrimary(file.hashes.sha1)">
Make Primary
</button>
@@ -231,6 +249,7 @@ export default {
data() {
return {
filesToUpload: [],
popup_data: null,
}
},
methods: {
@@ -244,6 +263,10 @@ export default {
elem.href = url
elem.click()
},
deleteFilePopup(hash) {
this.popup_data = hash
this.$refs.delete_file_popup.show()
},
async deleteFile(hash) {
this.$nuxt.$loading.start()
@@ -314,6 +337,9 @@ export default {
this.$nuxt.$loading.finish()
},
deleteVersionPopup() {
this.$refs.delete_version_popup.show()
},
async deleteVersion() {
this.$nuxt.$loading.start()