Skip to content

Commit 5c83258

Browse files
author
joeltaylor
committed
Merge branch 'master' into add_spam_filtering
2 parents 45d7201 + 3b1d233 commit 5c83258

102 files changed

Lines changed: 92102 additions & 364 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,3 +28,5 @@ node_modules
2828
.DS_Store
2929
.lock-wscript
3030
.service-credentials
31+
32+
bower_components

Gruntfile.js

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
module.exports = function(grunt) {
2+
3+
grunt.loadNpmTasks('grunt-svgstore');
4+
5+
grunt.initConfig({
6+
7+
svgstore: {
8+
'default': {
9+
options: {
10+
cleanup: ['fill'],
11+
includeTitleElement: false
12+
},
13+
files: {
14+
'public/images/icons/icons.svg': ['public/images/icons/icon-*.svg']
15+
}
16+
}
17+
}
18+
19+
});
20+
21+
grunt.registerTask('default', ['svgstore']);
22+
23+
};

README.md

Lines changed: 18 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,18 +4,27 @@ This is the repo for the JavaScript.com website.
44

55
## Installing NVM
66

7-
- Install NVM (`$ brew install nvm` and follow instructions)
8-
- `$ nvm install iojs-v1.2.0`
9-
- `$ nvm use iojs-v1.2.0`
7+
Install NVM (`$ brew install nvm` and follow instructions)
8+
9+
```bash
10+
nvm install iojs-v1.2.0
11+
nvm use iojs-v1.2.0
12+
npm install -g gulp
13+
npm install
14+
```
15+
16+
If you set the `BOWER` ENV the setup script will download the bower components and compile cs_console (requires ruby!)
17+
18+
This app authenticates with GitHub, so you'll need to create a GitHub Application and set ENVs for `GH_CLIENT_ID` and `GH_CLIENT_SECRET`.
1019

1120
## Running
1221

13-
* Install dependencies with `$ npm install`.
14-
* Create the local PostgreSQL database with `$ createdb javascriptcom`.
15-
* Load schema with `$ psql javascriptcom < db/schema.sql`
16-
* This app authenticates with GitHub, so you'll need to create a GitHub Application and set ENVs for `GH_CLIENT_ID` and `GH_CLIENT_SECRET`.
17-
* Run the application with `$ npm start`.
18-
* Compile and watch Sass with `$ gulp`.
22+
Run the application with `$ npm start`. You can also set the environment variables at start time. Here's an example:
23+
24+
```bash
25+
$ GH_CLIENT_ID=myid GH_CLIENT_SECRET=mysecret npm start
26+
```
27+
Compile and watch Sass with `$ gulp`.
1928

2029
For debugging all the things, run `DEBUG=* npm start`.
2130

app.js

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@ var routes = require('./routes/index');
99
var users = require('./routes/users');
1010
var news = require('./routes/news');
1111
var flow = require('./routes/flow');
12+
var styleguide = require('./routes/styleguide');
13+
var courses = require('./routes/courses');
14+
var learn = require('./routes/learn');
1215

1316
var app = express();
1417

@@ -28,10 +31,15 @@ app.set('view engine', 'jade');
2831
app.use(logger('dev'));
2932
app.use(express.static(path.join(__dirname, 'public')));
3033

34+
// routes
3135
app.use('/', routes);
36+
app.use('/learn', learn)
3237
app.use('/users', users);
3338
app.use('/news', news);
3439
app.use('/flow', flow);
40+
app.use('/styleguide', styleguide);
41+
app.use('/courses.json', courses);
42+
app.use('/courses', courses)
3543

3644
// catch 404 and forward to error handler
3745
app.use(function(req, res, next) {
@@ -64,5 +72,7 @@ app.use(function(err, req, res, next) {
6472
});
6573
});
6674

67-
6875
module.exports = app;
76+
77+
// Set absolute paths for partials
78+
app.locals.basedir = path.join(__dirname, '');

bower.json

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
{
2+
"name": "JavaScript.com",
3+
"version": "0.0.0",
4+
"homepage": "https://github.com/codeschool/JavaScript.com",
5+
"authors": [
6+
"Code School"
7+
],
8+
"license": "MIT",
9+
"private": true,
10+
"ignore": [
11+
"**/.*",
12+
"node_modules",
13+
"bower_components",
14+
"test",
15+
"tests"
16+
],
17+
"dependencies": {
18+
"angular": "1.4.0-beta.6",
19+
"jquery": "~2.1.3",
20+
"cs_console": "*",
21+
"codemirror": "~3.16.0",
22+
"abecedary": "~0.0.5",
23+
"mocha": "~2.2.1",
24+
"lodash": "~3.5.0",
25+
"angular-resource": "~1.3.15",
26+
"marked": "~0.3.3",
27+
"angular-animate": "~1.3.15"
28+
}
29+
}

client/application.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
$(function() {
2+
// Hide sponsor links
3+
$('tr[style="background-color: #faf9dc;"]').hide();
4+
});

client/javascriptcom/app.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
angular.module('javascriptcom', ['ngResource', 'ngAnimate'])
2+
.config(['$httpProvider', function config($httpProvider) {
3+
$httpProvider.defaults.cache = true;
4+
}]);
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
angular.module('javascriptcom').directive('jsChallenge', ['jsChallengeProgress', function(jsChallengeProgress) {
2+
return {
3+
templateUrl: 'javascripts/javascriptcom/templates/challenge.html',
4+
replace: true,
5+
scope: {
6+
challenge: '='
7+
},
8+
bindToController: true,
9+
controllerAs: 'ctrl',
10+
controller: function jsChallengeController(jsChallengeProgress) {
11+
this.onSuccess = function onSuccess(challenge) {
12+
challenge.completed = true;
13+
jsChallengeProgress.next();
14+
}
15+
16+
this.onFailure = function onFailure(challenge) {
17+
console.log('challenge failure');
18+
}
19+
20+
this.activate = function(challenge) {
21+
jsChallengeProgress.activate(challenge);
22+
}
23+
}
24+
};
25+
}]);
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
angular.module('javascriptcom').directive('jsConsole', ['CSConsole', 'jsCommand', function(CSConsole, jsCommand) {
2+
return {
3+
templateUrl: 'javascripts/javascriptcom/templates/console.html',
4+
replace: true,
5+
scope: true,
6+
bindToController: true,
7+
controllerAs: 'ctrl',
8+
require: '^jsChallenge',
9+
link: function(scope, element, attrs, ctrl) {
10+
var el = $(element).find('.console-ui')[0];
11+
var command = new jsCommand(ctrl.challenge, ctrl.onSuccess, ctrl.onFailure);
12+
13+
ctrl.csConsole = new CSConsole(el, {
14+
prompt: '> ',
15+
syntax: 'javascript',
16+
autoFocus: true,
17+
welcomeMessage: $('<p>Type <code>help</code> to see the help menu</p>')[0],
18+
commandValidate: command.validate,
19+
commandHandle: command.handler
20+
});
21+
}
22+
};
23+
}]);
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
angular.module('javascriptcom').directive('jsCourse', ['_', 'jsCourseChallengeResource', 'jsChallengeProgress', function(_, jsCourseChallengeResource, jsChallengeProgress) {
2+
return {
3+
replace: true,
4+
templateUrl: 'javascripts/javascriptcom/templates/course.html',
5+
scope: {
6+
course: '@'
7+
},
8+
bindToController: true,
9+
controllerAs: 'ctrl',
10+
controller: function jsChallengeResourceController(jsCourseChallengeResource) {
11+
this.challenges = jsCourseChallengeResource.query({ course: this.course });
12+
jsChallengeProgress.setChallenges(this.challenges);
13+
14+
this.activateChallenge = function(challenge) {
15+
jsChallengeProgress.activate(challenge)
16+
}
17+
}
18+
};
19+
}]);

0 commit comments

Comments
 (0)