Skip to content
GlennGeenen edited this page Oct 17, 2014 · 5 revisions

Welcome to the CoderDojoJavascript wiki!

Run Code

This code uses the grunt task runner. You need to have node.js installed (http://nodejs.org).

If you don't have grunt installed:

npm install -g grunt-cli

If you don't have bower installed:

npm install -g bower

In the project directory:

npm install

bower install

You can launch you code ( and livereload changes ):

grunt serve

You can create a release build:

grunt build

Add Questions

You can find all questions under app/scripts/questions. You have one file for each category containing all questions. A question has following fields:

  • title: displayed left on top
  • task: task displayed left in the green area
  • templateurl: link to the html being loaded on the left as explanation
  • code: code being displayed in the editor
  • validate: function to validate the provided code from the editor. Next question return an error as first parameter and a result as second.

Add a category

First you need to provide your questions, create a new file under app/scripts/questions. You need to provide the getQuestion function that returns a valid question object. Second you need a new controller where you load these questions under app/scripts/controllers. You can copy an existing controller and edit following lines:

line 4: give a correct name to your controller

line 27: provide the correct category

line 76: provide the correct url

line 82: name your controller and include the correct questions

Last part is link your controller in the router in scripts/app.js. Add a when with the correct path and link to your controller.

Package for node-webkit

Make a build:

grunt build

Put the files from the node-webkit folder in your dist folder.

Windows:

Create a zip file from all files in the dist folder (Don't create a zip from the directory). Rename the zip file to package.nw. If you now put this file next to node-webkit executable you can run the app.

Mac OS:

Open your terminal and navigate inside the dist directory.

zip -r ../${PWD##*/}.nw *

This creates a .nw file, rename it to package.nw and put it next to your node-webkit app.

Clone this wiki locally