Rename avatar and description

This commit is contained in:
Natsumi
2021-03-09 01:13:11 +13:00
parent 260ea0a541
commit 97d0e5aadd
2 changed files with 69 additions and 8 deletions

View File

@@ -7054,6 +7054,56 @@ speechSynthesis.getVoices();
});
};
$app.methods.promptRenameAvatar = function (avatar) {
this.$prompt('Enter avatar name', 'Rename Avatar', {
distinguishCancelAndClose: true,
confirmButtonText: 'OK',
cancelButtonText: 'Cancel',
inputValue: avatar.ref.name,
inputErrorMessage: 'Valid name is required',
callback: (action, instance) => {
if (action === 'confirm' &&
instance.inputValue !== avatar.ref.name) {
API.saveAvatar({
id: avatar.id,
name: instance.inputValue
}).then((args) => {
this.$message({
message: 'Avatar renamed',
type: 'success'
});
return args;
});
}
}
});
};
$app.methods.promptChangeDescription = function (avatar) {
this.$prompt('Enter avatar description', 'Change Description', {
distinguishCancelAndClose: true,
confirmButtonText: 'OK',
cancelButtonText: 'Cancel',
inputValue: avatar.ref.description,
inputErrorMessage: 'Valid description is required',
callback: (action, instance) => {
if (action === 'confirm' &&
instance.inputValue !== avatar.ref.description) {
API.saveAvatar({
id: avatar.id,
description: instance.inputValue
}).then((args) => {
this.$message({
message: 'Avatar description changed',
type: 'success'
});
return args;
});
}
}
});
};
// App: Dialog
var adjustDialogZ = (el) => {
@@ -8126,12 +8176,20 @@ speechSynthesis.getVoices();
if (D.visible === false) {
return;
}
if (command === 'Add Favorite') {
this.showFavoriteDialog('avatar', D.id);
} else {
this.$confirm(`Continue? ${command}`, 'Confirm', {
confirmButtonText: 'Confirm',
cancelButtonText: 'Cancel',
switch (command) {
case 'Rename':
this.promptRenameAvatar(D);
break;
case 'Change Description':
this.promptChangeDescription(D);
break;
case 'Add Favorite':
this.showFavoriteDialog('avatar', D.id);
break;
default:
this.$confirm(`Continue? ${command}`, 'Confirm', {
confirmButtonText: 'Confirm',
cancelButtonText: 'Cancel',
type: 'info',
callback: (action) => {
if (action !== 'confirm') {
@@ -8180,9 +8238,10 @@ speechSynthesis.getVoices();
break;
default:
break;
}
}
}
});
});
break;
}
};

View File

@@ -1151,6 +1151,8 @@ html
template(v-if="avatarDialog.ref.authorId === API.currentUser.id")
el-dropdown-item(v-if="avatarDialog.ref.releaseStatus === 'public'" icon="el-icon-user-solid" command="Make Private" divided) Make Private
el-dropdown-item(v-else icon="el-icon-user" command="Make Public" divided) Make Public
el-dropdown-item(icon="el-icon-edit" command="Rename") Rename
el-dropdown-item(icon="el-icon-edit" command="Change Description") Change Description
el-tabs
el-tab-pane(label="Info")
.x-friend-list