From c3486af0311c0b41fc9007b607ca175b356803f4 Mon Sep 17 00:00:00 2001 From: catarak Date: Fri, 15 Jul 2016 11:54:47 -0400 Subject: [PATCH] add author name to sketches --- client/modules/IDE/actions/project.js | 7 +++++- client/modules/IDE/components/Toolbar.js | 10 ++++++++- client/modules/IDE/pages/IDEView.js | 6 +++++- client/modules/IDE/reducers/project.js | 10 ++++----- client/styles/components/_toolbar.scss | 4 ++++ server/controllers/project.controller.js | 27 ++++++++++++++++-------- 6 files changed, 47 insertions(+), 17 deletions(-) diff --git a/client/modules/IDE/actions/project.js b/client/modules/IDE/actions/project.js index 8f820c30..913d979e 100644 --- a/client/modules/IDE/actions/project.js +++ b/client/modules/IDE/actions/project.js @@ -8,12 +8,14 @@ export function getProject(id) { return (dispatch) => { axios.get(`${ROOT_URL}/projects/${id}`, { withCredentials: true }) .then(response => { + console.log(response.data); browserHistory.push(`/projects/${id}`); dispatch({ type: ActionTypes.SET_PROJECT, project: response.data, files: response.data.files, - selectedFile: response.data.selectedFile + selectedFile: response.data.selectedFile, + owner: response.data.user }); }) .catch(response => dispatch({ @@ -61,6 +63,7 @@ export function saveProject() { type: ActionTypes.NEW_PROJECT, name: response.data.name, id: response.data.id, + owner: response.data.user, selectedFile: response.data.selectedFile, files: response.data.files }); @@ -78,11 +81,13 @@ export function createProject() { return (dispatch) => { axios.post(`${ROOT_URL}/projects`, {}, { withCredentials: true }) .then(response => { + console.log(response.data); browserHistory.push(`/projects/${response.data.id}`); dispatch({ type: ActionTypes.NEW_PROJECT, name: response.data.name, id: response.data.id, + owner: response.data.user, selectedFile: response.data.selectedFile, files: response.data.files }); diff --git a/client/modules/IDE/components/Toolbar.js b/client/modules/IDE/components/Toolbar.js index fd8d3289..1d4a66c7 100644 --- a/client/modules/IDE/components/Toolbar.js +++ b/client/modules/IDE/components/Toolbar.js @@ -40,6 +40,13 @@ function Toolbar(props) { > {props.projectName} + {(() => { // eslint-disable-line + if (props.owner) { + return ( +

by {props.owner.username}

+ ); + } + })()}