From 3650967f4c1e5b6181ef6af2b6dfa157855ed585 Mon Sep 17 00:00:00 2001 From: Yuya Ochiai Date: Sat, 18 Jun 2016 00:53:03 +0900 Subject: [PATCH] Fix that edited team is adeed to bottom of the list --- src/browser/settings.jsx | 32 ++++++++++---------------------- 1 file changed, 10 insertions(+), 22 deletions(-) diff --git a/src/browser/settings.jsx b/src/browser/settings.jsx index cc83789c..86591482 100644 --- a/src/browser/settings.jsx +++ b/src/browser/settings.jsx @@ -34,9 +34,7 @@ var SettingsPage = React.createClass({ config = settings.loadDefault(); } - this.setState({ - showAddTeamForm: false - }); + config.showAddTeamForm = false; return config; }, @@ -54,10 +52,8 @@ var SettingsPage = React.createClass({ this.setState({ teams: teams }); - - this.handleSave(false); }, - handleSave: function(toIndex) { + handleSave: function() { var config = { teams: this.state.teams, hideMenuBar: this.state.hideMenuBar, @@ -88,9 +84,7 @@ var SettingsPage = React.createClass({ ipcRenderer.send('update-menu', config); ipcRenderer.send('update-config'); - if (typeof toIndex == 'undefined' || toIndex) { - backToIndex(); - } + backToIndex(); }, handleCancel: function() { backToIndex(); @@ -120,16 +114,10 @@ var SettingsPage = React.createClass({ autostart: this.refs.autostart.getChecked() }); }, - handleShowTeamForm: function() { - if (!this.state.showAddTeamForm) { - this.setState({ - showAddTeamForm: true - }); - } else { - this.setState({ - showAddTeamForm: false - }); - } + toggleShowTeamForm: function() { + this.setState({ + showAddTeamForm: !this.state.showAddTeamForm + }); }, handleFlashWindowSetting: function(item) { this.setState({ @@ -169,7 +157,7 @@ var SettingsPage = React.createClass({ } options.push(); - //OSX has an option in the tray, to set the app to autostart, so we choose to not support this option for OSX + //OSX has an option in the Dock, to set the app to autostart, so we choose to not support this option for OSX if (process.platform === 'win32' || process.platform === 'linux') { options.push(); } @@ -223,7 +211,7 @@ var SettingsPage = React.createClass({

Teams

- @@ -267,7 +255,7 @@ var TeamList = React.createClass({ var teams = this.props.teams; // check if team already exists and then change existing team or add new one - if (!team.index && teams[team.index]) { + if ((team.index!==undefined) && teams[team.index]) { teams[team.index].name = team.name; teams[team.index].url = team.url; } else {