Commit 54ba802e authored by Sindre Sorhus's avatar Sindre Sorhus

Add analytics to the Knockback app + small cleanup

parent 38b6a009
# Knockback.js TodoMVC app
# Knockback.js • [TodoMVC](http://todomvc.com)
Forked from https://github.com/kmalakoff/knockback-todos
## Getting started
You need [CoffeScript](http://coffeescript.org) to compile if you make changes to the files in the `src` folder.
### Compile
## Compile
Open Terminal in this folder.
......
......@@ -5,6 +5,9 @@
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<title>Knockback.js • TodoMVC</title>
<link rel="stylesheet" href="../../assets/base.css">
<!--[if IE]>
<script src="../../assets/ie.js"></script>
<![endif]-->
</head>
<body>
<section id="todoapp">
......@@ -47,27 +50,23 @@
</section>
<footer id="info">
<p>Double-click to edit a todo</p>
<p>Template by <a href="http://sindresorhus.com">Sindre Sorhus</a></p>
<p>Template by <a href="http://github.com/sindresorhus">Sindre Sorhus</a></p>
<p>Created by <a href="https://github.com/kmalakoff">Kevin Malakoff</a>. <br/>
Please try out the <a href="http://kmalakoff.github.com/knockback-todos/">enhanced version</a> <br/>
with localization, priority colors, and lazy loading <br/>
to see just how dynamic <a href="https://github.com/kmalakoff/knockback">Knockback.js</a> can be!</p>
<p>Part of <a href="http://todomvc.com">TodoMVC</a></p>
</footer>
<!-- Demo Dependencies -->
<script src="js/lib/json2.js"></script>
<script src="../../assets/base.js"></script>
<script src="../../assets/jquery.min.js"></script>
<!-- Knockback Dependencies -->
<script src="js/lib/underscore-min.js"></script>
<script src="js/lib/backbone-min.js"></script>
<script src="js/lib/knockout-2.0.0.js"></script>
<script src="js/lib/knockback.min.js"></script>
<!-- More Demo Dependencies -->
<script src="js/lib/backbone-localstorage.js"></script>
<!-- Demo Components -->
<script src="js/models/todo.js"></script>
<script src="js/models/todo_collection.js"></script>
......@@ -76,7 +75,6 @@
<script src="js/viewmodels/todos.js"></script>
<script src="js/viewmodels/footer.js"></script>
<script src="js/routers/app.js"></script>
<!-- The Demo -->
<script src="../../assets/base.js"></script>
<script src="js/app.js"></script>
......
This diff is collapsed.
......@@ -28,4 +28,4 @@ $ ->
# Load the todos
todos.fetch()
# kb.vmRelease(app.viewmodels) # Destroy when finished with the view model
# kb.vmRelease(app.viewmodels) # Destroy when finished with the view model
\ No newline at end of file
class window.Todo extends Backbone.Model
completed: (completed) ->
return !!@get('completed') if arguments.length == 0
@save({completed: if completed then new Date() else null})
@save({completed: if completed then new Date() else null})
\ No newline at end of file
......@@ -9,5 +9,4 @@ class window.TodosCollection extends Backbone.Collection
destroyCompleted: ->
completed_tasks = @filter((todo) -> return todo.completed())
model.destroy() for model in completed_tasks
model.destroy() for model in completed_tasks
\ No newline at end of file
class window.AppRouter extends Backbone.Router
routes:
"": "all"
"active": "active"
"completed": "completed"
"": "all"
"active": "active"
"completed": "completed"
all: -> app.viewmodels.settings.list_filter_mode('')
active: -> app.viewmodels.settings.list_filter_mode('active')
......
window.SettingsViewModel = ->
@list_filter_mode = ko.observable('')
@
@
\ No newline at end of file
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment