Permalink
Browse files

Basic mechanics

  • Loading branch information...
0 parents commit dd9687082e218ec69868015dd978fea69ce32f19 @spraints committed Apr 19, 2012
Showing with 57 additions and 0 deletions.
  1. +9 −0 package.json
  2. +15 −0 public/app.css
  3. +10 −0 views/index.coffee
  4. +7 −0 views/layout.coffee
  5. +4 −0 views/worksheet.coffee
  6. +12 −0 worksheet.coffee
@@ -0,0 +1,9 @@
+{
+ "name": "math-worksheets",
+ "version": "0.0.1",
+ "dependencies": {
+ "coffee-script": "1.3.1",
+ "coffeekup": "0.3.1",
+ "express": "2.5.9"
+ }
+}
@@ -0,0 +1,15 @@
+body {
+ font-family: Helvetica, sans-serif;
+}
+
+.problem {
+ float: left;
+ border-bottom: solid 1px black;
+ font-size: 50px;
+ margin: 20px;
+ margin-bottom: 50px;
+ width: 100px;
+}
+.problem > div {
+ text-align: right;
+}
@@ -0,0 +1,10 @@
+h1 'Make a math worksheet'
+form action: 'worksheet', method: 'get', ->
+ div ->
+ label 'Number of problems', for: 'count'
+ input id: 'count', name: 'count', value: 10
+ div ->
+ label 'Highest term', for: 'max'
+ input id: 'max', name: 'max', value: 5
+ div ->
+ input type: 'submit', value: 'Make the worksheet'
@@ -0,0 +1,7 @@
+doctype 5
+html ->
+ head ->
+ title 'Make a math worksheet'
+ link rel: 'stylesheet', href: 'app.css'
+ body ->
+ @body
@@ -0,0 +1,4 @@
+for problem in @problems
+ div class: 'problem', ->
+ div class: 'term-a', -> "#{problem.a}"
+ div class: 'term-b', -> "+ #{problem.b}"
@@ -0,0 +1,12 @@
+express = require('express')
+
+app = express.createServer()
+app.set 'view engine', 'coffee'
+app.register '.coffee', require('coffeekup').adapters.express
+
+app.use express.static(__dirname + '/public')
+app.get '/', (req, res) -> res.render('index')
+app.get '/worksheet', (req, res) ->
+ res.render('worksheet', {problems: [{a:1,b:1}, {a:2, b:2}]})
+
+app.listen(process.env.PORT || 3000)

0 comments on commit dd96870

Please sign in to comment.