mirror of
https://github.com/pixelfed/pixelfed.git
synced 2024-11-22 14:31:26 +00:00
Merge pull request #4709 from mbliznikova/check_if_collection_empty_in_edit
Add check if collection is empty in Edit Collection before publishing
This commit is contained in:
commit
2b17cc2c0d
1 changed files with 16 additions and 1 deletions
|
@ -205,12 +205,20 @@
|
||||||
|
|
||||||
<div v-else class="float-right">
|
<div v-else class="float-right">
|
||||||
<button
|
<button
|
||||||
|
v-if="posts.length > 0"
|
||||||
type="button"
|
type="button"
|
||||||
class="btn btn-outline-primary btn-sm py-1 font-weight-bold px-3"
|
class="btn btn-outline-primary btn-sm py-1 font-weight-bold px-3"
|
||||||
@click.prevent="publishCollection">
|
@click.prevent="publishCollection">
|
||||||
Publish
|
Publish
|
||||||
</button>
|
</button>
|
||||||
|
|
||||||
|
<button
|
||||||
|
v-else
|
||||||
|
type="button"
|
||||||
|
class="btn btn-outline-primary btn-sm py-1 font-weight-bold px-3 disabled" disabled>
|
||||||
|
Publish
|
||||||
|
</button>
|
||||||
|
|
||||||
<button
|
<button
|
||||||
type="button"
|
type="button"
|
||||||
class="btn btn-primary btn-sm py-1 font-weight-bold px-3"
|
class="btn btn-primary btn-sm py-1 font-weight-bold px-3"
|
||||||
|
@ -527,6 +535,11 @@ export default {
|
||||||
},
|
},
|
||||||
|
|
||||||
publishCollection() {
|
publishCollection() {
|
||||||
|
if (this.posts.length === 0) {
|
||||||
|
swal('Error', 'You cannot publish an empty collection');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if(this.owner == false) {
|
if(this.owner == false) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -541,7 +554,9 @@ export default {
|
||||||
.then(res => {
|
.then(res => {
|
||||||
console.log(res.data);
|
console.log(res.data);
|
||||||
// window.location.href = res.data.url;
|
// window.location.href = res.data.url;
|
||||||
});
|
}).catch(err => {
|
||||||
|
swal('Something went wrong', 'There was a problem with your request, please try again later.', 'error')
|
||||||
|
});
|
||||||
} else {
|
} else {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue