diff --git a/ElectronClient/app/gui/MainScreen.jsx b/ElectronClient/app/gui/MainScreen.jsx index 1ed236aa0..e83f48baa 100644 --- a/ElectronClient/app/gui/MainScreen.jsx +++ b/ElectronClient/app/gui/MainScreen.jsx @@ -145,6 +145,28 @@ class MainScreenComponent extends React.Component { } }, }); + } else if (command.name === 'renameTag') { + const tag = await Tag.load(command.id); + if(!tag) return; + + this.setState({ + promptOptions: { + label: _('Rename tag:'), + value: tag.title, + onClose: async (answer) => { + if (answer !== null) { + try { + tag.title = answer; + await Tag.save(tag, { fields: ['title'], userSideValidation: true }); + } catch (error) { + bridge().showErrorMessageBox(error.message); + } + } + this.setState({promptOptions: null }); + } + } + }) + } else if (command.name === 'search') { if (!this.searchId_) this.searchId_ = uuid.create(); diff --git a/ElectronClient/app/gui/SideBar.jsx b/ElectronClient/app/gui/SideBar.jsx index fefdd4837..127166ec0 100644 --- a/ElectronClient/app/gui/SideBar.jsx +++ b/ElectronClient/app/gui/SideBar.jsx @@ -250,6 +250,21 @@ class SideBarComponent extends React.Component { ); } + if (itemType === BaseModel.TYPE_TAG) { + menu.append( + new MenuItem({ + label: _('Rename'), + click: async () => { + this.props.dispatch({ + type: "WINDOW_COMMAND", + name: "renameTag", + id: itemId + }); + }, + }) + ); + } + menu.popup(bridge().window()); }