Skip to content

Instantly share code, notes, and snippets.

@lancscoder
Created May 12, 2012 10:52
Show Gist options
  • Save lancscoder/2665804 to your computer and use it in GitHub Desktop.
Save lancscoder/2665804 to your computer and use it in GitHub Desktop.
Node.js implementation of Backbone.js Todos
#todoapp
header
h1 Todos
input#new-todo(type='text', placeholder='What needs to be done?')
section#main
input#toggle-all(type='checkbox')
label(for='toggle-all') Mark all as complete
ul#todo-list
footer
a#clear-completed Clear completed
#todo-count
#instructions
| Double-click to edit a todo
#credits
| Created by
| <br />
| <a href="http://jgn.me/">J&eacute;r&ocirc;me Gravel-Niquet</a>.
| <br />Rewritten by: <a href="http://addyosmani.github.com/todomvc">TodoMVC</a>
| <br />Rewritten again to implement Node.js by: <a href="">Lancscoder</a>.
script(src='/javascripts/json2.js')
script(src='/javascripts/jquery-1.7.1.js')
script(src='/javascripts/underscore-1.3.1.js')
script(src='/javascripts/backbone.js')
script(src='/javascripts/backbone-localstorage.js')
script(src='/javascripts/todos.js')
// Templates
script(type='text/template', id='item-template')
.view.
<input class="toggle" type="checkbox" <%= done ? 'checked="checked"' : '' %> />
<label><%= title %></label>
<a class="destroy"></a>
input.edit(type='text', value='<%= title %>')
script(type='text/template', id='stats-template')
<% if (done) { %>
a#clear-completed Clear <%= done %> completed <%= done == 1 ? 'item' : 'items' %>
<% } %>
div.todo-count
b <%= remaining %>
<%= remaining == 1 ? 'item' : 'items' %> left
!!! 5
html
head
title Backbone.js Todos With Node Server
link(rel='stylesheet', href='/stylesheets/todos.css')
body(lang='en')
!= body
<div id="credits">
Created by
<br />
<a href="http://jgn.me/">J&eacute;r&ocirc;me Gravel-Niquet</a>. <br />Cleanup, edits: <a href="http://addyosmani.com">Addy Osmani</a>.
</div>
#credits
| Created by
| <br />
| <a href="http://jgn.me/">J&eacute;r&ocirc;me Gravel-Niquet</a>.
| <br />Rewritten by: <a href="http://addyosmani.github.com/todomvc">TodoMVC</a>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment