You've already forked AstralRinth
forked from didirus/AstralRinth
Fix various gallery issues reported on Discord (#854)
* Fix various gallery issues reported on Discord Fixes #849 * fix stupidity on my part
This commit is contained in:
@@ -104,6 +104,7 @@
|
|||||||
<button
|
<button
|
||||||
v-if="editIndex === -1"
|
v-if="editIndex === -1"
|
||||||
class="iconified-button brand-button"
|
class="iconified-button brand-button"
|
||||||
|
:disabled="shouldPreventActions"
|
||||||
@click="createGalleryItem"
|
@click="createGalleryItem"
|
||||||
>
|
>
|
||||||
<PlusIcon />
|
<PlusIcon />
|
||||||
@@ -112,6 +113,7 @@
|
|||||||
<button
|
<button
|
||||||
v-else
|
v-else
|
||||||
class="iconified-button brand-button"
|
class="iconified-button brand-button"
|
||||||
|
:disabled="shouldPreventActions"
|
||||||
@click="editGalleryItem"
|
@click="editGalleryItem"
|
||||||
>
|
>
|
||||||
<SaveIcon />
|
<SaveIcon />
|
||||||
@@ -353,6 +355,7 @@ export default {
|
|||||||
editOrder: null,
|
editOrder: null,
|
||||||
editFile: null,
|
editFile: null,
|
||||||
previewImage: null,
|
previewImage: null,
|
||||||
|
shouldPreventActions: false,
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
head() {
|
head() {
|
||||||
@@ -452,6 +455,7 @@ export default {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
async createGalleryItem() {
|
async createGalleryItem() {
|
||||||
|
this.shouldPreventActions = true
|
||||||
this.$nuxt.$loading.start()
|
this.$nuxt.$loading.start()
|
||||||
|
|
||||||
try {
|
try {
|
||||||
@@ -463,8 +467,10 @@ export default {
|
|||||||
: null
|
: null
|
||||||
}&featured=${this.editFeatured}`
|
}&featured=${this.editFeatured}`
|
||||||
|
|
||||||
if (this.editTitle) url += `&title=${this.editTitle}`
|
if (this.editTitle)
|
||||||
if (this.editDescription) url += `&description=${this.editDescription}`
|
url += `&title=${encodeURIComponent(this.editTitle)}`
|
||||||
|
if (this.editDescription)
|
||||||
|
url += `&description=${encodeURIComponent(this.editDescription)}`
|
||||||
if (this.editOrder) url += `&ordering=${this.editOrder}`
|
if (this.editOrder) url += `&ordering=${this.editOrder}`
|
||||||
|
|
||||||
await this.$axios.post(url, this.editFile, this.$defaultHeaders())
|
await this.$axios.post(url, this.editFile, this.$defaultHeaders())
|
||||||
@@ -481,8 +487,10 @@ export default {
|
|||||||
}
|
}
|
||||||
|
|
||||||
this.$nuxt.$loading.finish()
|
this.$nuxt.$loading.finish()
|
||||||
|
this.shouldPreventActions = false
|
||||||
},
|
},
|
||||||
async editGalleryItem() {
|
async editGalleryItem() {
|
||||||
|
this.shouldPreventActions = true
|
||||||
this.$nuxt.$loading.start()
|
this.$nuxt.$loading.start()
|
||||||
|
|
||||||
try {
|
try {
|
||||||
@@ -490,8 +498,10 @@ export default {
|
|||||||
this.project.gallery[this.editIndex].url
|
this.project.gallery[this.editIndex].url
|
||||||
)}&featured=${this.editFeatured}`
|
)}&featured=${this.editFeatured}`
|
||||||
|
|
||||||
if (this.editTitle) url += `&title=${this.editTitle}`
|
if (this.editTitle)
|
||||||
if (this.editDescription) url += `&description=${this.editDescription}`
|
url += `&title=${encodeURIComponent(this.editTitle)}`
|
||||||
|
if (this.editDescription)
|
||||||
|
url += `&description=${encodeURIComponent(this.editDescription)}`
|
||||||
if (this.editOrder) url += `&ordering=${this.editOrder}`
|
if (this.editOrder) url += `&ordering=${this.editOrder}`
|
||||||
|
|
||||||
await this.$axios.patch(url, {}, this.$defaultHeaders())
|
await this.$axios.patch(url, {}, this.$defaultHeaders())
|
||||||
@@ -508,6 +518,7 @@ export default {
|
|||||||
}
|
}
|
||||||
|
|
||||||
this.$nuxt.$loading.finish()
|
this.$nuxt.$loading.finish()
|
||||||
|
this.shouldPreventActions = false
|
||||||
},
|
},
|
||||||
async deleteGalleryImage() {
|
async deleteGalleryImage() {
|
||||||
this.$nuxt.$loading.start()
|
this.$nuxt.$loading.start()
|
||||||
|
|||||||
@@ -185,7 +185,7 @@ export default {
|
|||||||
id += 'LicenseRef-'
|
id += 'LicenseRef-'
|
||||||
id += this.license.short
|
id += this.license.short
|
||||||
if (this.license.requiresOnlyOrLater)
|
if (this.license.requiresOnlyOrLater)
|
||||||
id += this.allowOrLater ? 'or-later' : '-only'
|
id += this.allowOrLater ? '-or-later' : '-only'
|
||||||
if (this.nonSpdxLicense && this.license.short === 'Custom')
|
if (this.nonSpdxLicense && this.license.short === 'Custom')
|
||||||
id.replaceAll(' ', '-')
|
id.replaceAll(' ', '-')
|
||||||
return id
|
return id
|
||||||
|
|||||||
@@ -119,7 +119,11 @@
|
|||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
<div v-if="isCreating" class="input-group">
|
<div v-if="isCreating" class="input-group">
|
||||||
<button class="iconified-button brand-button" @click="createVersion">
|
<button
|
||||||
|
class="iconified-button brand-button"
|
||||||
|
:disabled="shouldPreventActions"
|
||||||
|
@click="createVersion"
|
||||||
|
>
|
||||||
<PlusIcon aria-hidden="true" />
|
<PlusIcon aria-hidden="true" />
|
||||||
Create
|
Create
|
||||||
</button>
|
</button>
|
||||||
@@ -137,6 +141,7 @@
|
|||||||
<div v-else-if="isEditing" class="input-group">
|
<div v-else-if="isEditing" class="input-group">
|
||||||
<button
|
<button
|
||||||
class="iconified-button brand-button"
|
class="iconified-button brand-button"
|
||||||
|
:disabled="shouldPreventActions"
|
||||||
@click="saveEditedVersion"
|
@click="saveEditedVersion"
|
||||||
>
|
>
|
||||||
<SaveIcon aria-hidden="true" />
|
<SaveIcon aria-hidden="true" />
|
||||||
@@ -904,6 +909,7 @@ export default {
|
|||||||
packageLoaders: ['forge', 'fabric', 'quilt'],
|
packageLoaders: ['forge', 'fabric', 'quilt'],
|
||||||
|
|
||||||
showKnownErrors: false,
|
showKnownErrors: false,
|
||||||
|
shouldPreventActions: false,
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
async fetch() {
|
async fetch() {
|
||||||
@@ -1344,6 +1350,7 @@ export default {
|
|||||||
this.$nuxt.$loading.finish()
|
this.$nuxt.$loading.finish()
|
||||||
},
|
},
|
||||||
async createVersion() {
|
async createVersion() {
|
||||||
|
this.shouldPreventActions = true
|
||||||
this.$nuxt.$loading.start()
|
this.$nuxt.$loading.start()
|
||||||
if (this.fieldErrors) {
|
if (this.fieldErrors) {
|
||||||
this.showKnownErrors = true
|
this.showKnownErrors = true
|
||||||
@@ -1365,6 +1372,7 @@ export default {
|
|||||||
}
|
}
|
||||||
|
|
||||||
this.$nuxt.$loading.finish()
|
this.$nuxt.$loading.finish()
|
||||||
|
this.shouldPreventActions = false
|
||||||
},
|
},
|
||||||
async createVersionRaw(version) {
|
async createVersionRaw(version) {
|
||||||
const formData = new FormData()
|
const formData = new FormData()
|
||||||
@@ -1470,6 +1478,7 @@ export default {
|
|||||||
this.$nuxt.$loading.finish()
|
this.$nuxt.$loading.finish()
|
||||||
},
|
},
|
||||||
async createDataPackVersion() {
|
async createDataPackVersion() {
|
||||||
|
this.shouldPreventActions = true
|
||||||
this.$nuxt.$loading.start()
|
this.$nuxt.$loading.start()
|
||||||
try {
|
try {
|
||||||
const blob = await createDataPackVersion(
|
const blob = await createDataPackVersion(
|
||||||
@@ -1518,6 +1527,7 @@ export default {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
this.$nuxt.$loading.finish()
|
this.$nuxt.$loading.finish()
|
||||||
|
this.shouldPreventActions = false
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user