From 41c1613d109c14bbcfc8dd3d98df21d217c0f02d Mon Sep 17 00:00:00 2001 From: Cassie Tarakajian Date: Fri, 4 Nov 2016 18:54:14 -0400 Subject: [PATCH] fix #191 --- client/modules/IDE/components/Toolbar.js | 26 ++++++++++++++++++------ client/modules/IDE/pages/IDEView.js | 4 +++- 2 files changed, 23 insertions(+), 7 deletions(-) diff --git a/client/modules/IDE/components/Toolbar.js b/client/modules/IDE/components/Toolbar.js index 13762062..fcc9dbaf 100644 --- a/client/modules/IDE/components/Toolbar.js +++ b/client/modules/IDE/components/Toolbar.js @@ -31,6 +31,12 @@ class Toolbar extends React.Component { } } + canEditProjectName() { + return (this.props.owner && this.props.owner.username + && this.props.owner.username === this.props.currentUser) + || !this.props.owner || !this.props.owner.username; + } + render() { let playButtonClass = classNames({ 'toolbar__play-button': true, @@ -89,12 +95,19 @@ class Toolbar extends React.Component {
{ - this.originalProjectName = this.props.project.name; - this.props.showEditProjectName(); - setTimeout(() => this.refs.projectNameInput.focus(), 0); + href={`/projects/${this.props.project.id}`} + onClick={(e) => { + if (this.canEditProjectName()) { + e.preventDefault(); + this.originalProjectName = this.props.project.name; + this.props.showEditProjectName(); + setTimeout(() => this.refs.projectNameInput.focus(), 0); + } }} - >{this.props.project.name} + > + {this.props.project.name}  + {this.canEditProjectName() && } +