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() && } +