mirror of
https://github.com/vector-im/element-web.git
synced 2024-11-17 22:14:58 +08:00
Add delete widget confirmation dialog.
This commit is contained in:
parent
625b87d346
commit
ee60155846
@ -172,6 +172,17 @@ export default React.createClass({
|
|||||||
*/
|
*/
|
||||||
_onDeleteClick: function() {
|
_onDeleteClick: function() {
|
||||||
if (this._canUserModify()) {
|
if (this._canUserModify()) {
|
||||||
|
// Show delete confirmation dialog
|
||||||
|
const QuestionDialog = sdk.getComponent("dialogs.QuestionDialog");
|
||||||
|
Modal.createTrackedDialog('Delete Widget', '', QuestionDialog, {
|
||||||
|
title: _t("Delete Widget"),
|
||||||
|
description:
|
||||||
|
<div>
|
||||||
|
{ _t("Deleting a widget removes it for all users in this room - are you sure you want to delete this widget?") }
|
||||||
|
</div>,
|
||||||
|
button: _t("OK"),
|
||||||
|
onFinished: (confirmed) => {
|
||||||
|
if (confirmed) {
|
||||||
console.log("Delete widget %s", this.props.id);
|
console.log("Delete widget %s", this.props.id);
|
||||||
this.setState({deleting: true});
|
this.setState({deleting: true});
|
||||||
MatrixClientPeg.get().sendStateEvent(
|
MatrixClientPeg.get().sendStateEvent(
|
||||||
@ -185,6 +196,9 @@ export default React.createClass({
|
|||||||
console.error('Failed to delete widget', e);
|
console.error('Failed to delete widget', e);
|
||||||
this.setState({deleting: false});
|
this.setState({deleting: false});
|
||||||
});
|
});
|
||||||
|
}
|
||||||
|
},
|
||||||
|
});
|
||||||
} else {
|
} else {
|
||||||
console.log("Revoke widget permissions - %s", this.props.id);
|
console.log("Revoke widget permissions - %s", this.props.id);
|
||||||
this._revokeWidgetPermission();
|
this._revokeWidgetPermission();
|
||||||
@ -305,7 +319,7 @@ export default React.createClass({
|
|||||||
let deleteIcon = 'img/cancel.svg';
|
let deleteIcon = 'img/cancel.svg';
|
||||||
let deleteClasses = 'mx_filterFlipColor mx_AppTileMenuBarWidget';
|
let deleteClasses = 'mx_filterFlipColor mx_AppTileMenuBarWidget';
|
||||||
if(this._canUserModify()) {
|
if(this._canUserModify()) {
|
||||||
deleteIcon = 'img/cancel-red.svg';
|
deleteIcon = 'img/icon-delete-pink.svg';
|
||||||
deleteClasses += ' mx_AppTileMenuBarWidgetDelete';
|
deleteClasses += ' mx_AppTileMenuBarWidgetDelete';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -201,6 +201,8 @@
|
|||||||
"Authentication": "Authentication",
|
"Authentication": "Authentication",
|
||||||
"Failed to delete device": "Failed to delete device",
|
"Failed to delete device": "Failed to delete device",
|
||||||
"Delete": "Delete",
|
"Delete": "Delete",
|
||||||
|
"Delete Widget": "Delete Widget",
|
||||||
|
"Deleting a widget removes it for all users in this room - are you sure you want to delete this widget?": "Deleting a widget removes it for all users in this room - are you sure you want to delete this widget?",
|
||||||
"Disable Notifications": "Disable Notifications",
|
"Disable Notifications": "Disable Notifications",
|
||||||
"Enable Notifications": "Enable Notifications",
|
"Enable Notifications": "Enable Notifications",
|
||||||
"Cannot add any more widgets": "Cannot add any more widgets",
|
"Cannot add any more widgets": "Cannot add any more widgets",
|
||||||
|
Loading…
Reference in New Issue
Block a user