diff --git a/README.md b/README.md index ed6005d1..a940d0e5 100644 --- a/README.md +++ b/README.md @@ -48,6 +48,7 @@ I'm new to using ESLint, but I decided on a configuration based on some popular ##Dump of links I'm saving for reference +* https://github.com/brigade/scss-lint * https://github.com/petehunt/react-howto * https://github.com/jsbin/jsbin (especially look at the console) * Need to figure out how to solve the XSS issue, https://github.com/jsbin/jsbin/wiki/Best-practices-for-building-your-own-live-paste-bin diff --git a/client/modules/IDE/actions/project.js b/client/modules/IDE/actions/project.js index af2b580d..1759c74b 100644 --- a/client/modules/IDE/actions/project.js +++ b/client/modules/IDE/actions/project.js @@ -11,7 +11,8 @@ export function getProject(id) { browserHistory.push(`/projects/${id}`); dispatch({ type: ActionTypes.SET_PROJECT, - project: response.data + project: response.data, + file: response.data.file }); }) .catch(response => dispatch({ diff --git a/client/modules/IDE/reducers/files.js b/client/modules/IDE/reducers/files.js index 3c43f097..3067b546 100644 --- a/client/modules/IDE/reducers/files.js +++ b/client/modules/IDE/reducers/files.js @@ -21,7 +21,12 @@ const file = (state = initialState, action) => { case ActionTypes.NEW_PROJECT: return { name: action.file.name, - content: action.file.conent + content: action.file.content + }; + case ActionTypes.SET_PROJECT: + return { + name: action.file.name, + content: action.file.content }; default: return state; diff --git a/client/modules/IDE/reducers/project.js b/client/modules/IDE/reducers/project.js index 6d3a6b83..70a1447c 100644 --- a/client/modules/IDE/reducers/project.js +++ b/client/modules/IDE/reducers/project.js @@ -18,11 +18,7 @@ const project = (state = initialState, action) => { case ActionTypes.SET_PROJECT: return { id: action.project.id, - name: action.project.name, - file: { - name: action.project.file.name, - content: action.project.file.content - } + name: action.project.name }; default: return state; diff --git a/server/controllers/project.controller.js b/server/controllers/project.controller.js index 376e3a8f..656c884f 100644 --- a/server/controllers/project.controller.js +++ b/server/controllers/project.controller.js @@ -49,7 +49,7 @@ export function getProject(req, res) { name: project.name, file: { name: project.file.name, - content: project.file.conent + content: project.file.content } }); }); diff --git a/server/models/project.js b/server/models/project.js index 0710e2ec..4dcac580 100644 --- a/server/models/project.js +++ b/server/models/project.js @@ -2,9 +2,16 @@ import mongoose from 'mongoose'; const Schema = mongoose.Schema; import shortid from 'shortid'; +const defaultSketch = `setup() { + createCanvas(400, 400); +} +draw() { + background(220); +}` + const fileSchema = new Schema({ name: { type: String, default: 'sketch.js' }, - content: { type: String } + content: { type: String, default: defaultSketch } }, { timestamps: true }); const projectSchema = new Schema({