Permalink
Browse files

setting up templates

  • Loading branch information...
1 parent 498da33 commit b836af7fceb772841c278fb79d1884a0c6edf818 @tj tj committed Dec 18, 2011
Showing with 25 additions and 3 deletions.
  1. +17 −2 public/javascripts/app.js
  2. +2 −1 views/layout.jade
  3. +2 −0 views/templates/all.jade
  4. +4 −0 views/templates/screenshot.jade
View
@@ -6,5 +6,20 @@ o = $;
// boot
o(function(){
- console.log('whoop');
-})
+ console.log(render('screenshot', { title: 'yay' }));
+})
+
+function render(name, obj) {
+ var tmpl = template(name);
+ return whiskers.render(tmpl, obj);
+}
+
+/**
+ * Grab template `name`.
+ */
+
+function template(name) {
+ return document
+ .getElementById(name + '-template')
+ .innerHTML;
+}
View
@@ -7,4 +7,5 @@ html
block content
script(src='/javascripts/vendor/whiskers.js')
script(src='/javascripts/vendor/jquery.js')
- script(src='/javascripts/app.js')
+ script(src='/javascripts/app.js')
+ include templates/all
View
@@ -0,0 +1,2 @@
+
+include screenshot
@@ -0,0 +1,4 @@
+
+script#screenshot-template(type='text/template')
+ .screenshot
+ h2 {title}

0 comments on commit b836af7

Please sign in to comment.