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 Forked from https://github.com/kmalakoff/knockback-todos
## Getting started ## Getting started
You need [CoffeScript](http://coffeescript.org) to compile if you make changes to the files in the `src` folder. 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. Open Terminal in this folder.
......
...@@ -5,6 +5,9 @@ ...@@ -5,6 +5,9 @@
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<title>Knockback.js • TodoMVC</title> <title>Knockback.js • TodoMVC</title>
<link rel="stylesheet" href="../../assets/base.css"> <link rel="stylesheet" href="../../assets/base.css">
<!--[if IE]>
<script src="../../assets/ie.js"></script>
<![endif]-->
</head> </head>
<body> <body>
<section id="todoapp"> <section id="todoapp">
...@@ -47,27 +50,23 @@ ...@@ -47,27 +50,23 @@
</section> </section>
<footer id="info"> <footer id="info">
<p>Double-click to edit a todo</p> <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/> <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/> Please try out the <a href="http://kmalakoff.github.com/knockback-todos/">enhanced version</a> <br/>
with localization, priority colors, and lazy loading <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> 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> <p>Part of <a href="http://todomvc.com">TodoMVC</a></p>
</footer> </footer>
<!-- Demo Dependencies --> <!-- Demo Dependencies -->
<script src="js/lib/json2.js"></script> <script src="../../assets/base.js"></script>
<script src="../../assets/jquery.min.js"></script> <script src="../../assets/jquery.min.js"></script>
<!-- Knockback Dependencies --> <!-- Knockback Dependencies -->
<script src="js/lib/underscore-min.js"></script> <script src="js/lib/underscore-min.js"></script>
<script src="js/lib/backbone-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/knockout-2.0.0.js"></script>
<script src="js/lib/knockback.min.js"></script> <script src="js/lib/knockback.min.js"></script>
<!-- More Demo Dependencies --> <!-- More Demo Dependencies -->
<script src="js/lib/backbone-localstorage.js"></script> <script src="js/lib/backbone-localstorage.js"></script>
<!-- Demo Components --> <!-- Demo Components -->
<script src="js/models/todo.js"></script> <script src="js/models/todo.js"></script>
<script src="js/models/todo_collection.js"></script> <script src="js/models/todo_collection.js"></script>
...@@ -76,7 +75,6 @@ ...@@ -76,7 +75,6 @@
<script src="js/viewmodels/todos.js"></script> <script src="js/viewmodels/todos.js"></script>
<script src="js/viewmodels/footer.js"></script> <script src="js/viewmodels/footer.js"></script>
<script src="js/routers/app.js"></script> <script src="js/routers/app.js"></script>
<!-- The Demo --> <!-- The Demo -->
<script src="../../assets/base.js"></script> <script src="../../assets/base.js"></script>
<script src="js/app.js"></script> <script src="js/app.js"></script>
......
This diff is collapsed.
...@@ -28,4 +28,4 @@ $ -> ...@@ -28,4 +28,4 @@ $ ->
# Load the todos # Load the todos
todos.fetch() 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 class window.Todo extends Backbone.Model
completed: (completed) -> completed: (completed) ->
return !!@get('completed') if arguments.length == 0 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 ...@@ -9,5 +9,4 @@ class window.TodosCollection extends Backbone.Collection
destroyCompleted: -> destroyCompleted: ->
completed_tasks = @filter((todo) -> return todo.completed()) 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 class window.AppRouter extends Backbone.Router
routes: routes:
"": "all" "": "all"
"active": "active" "active": "active"
"completed": "completed" "completed": "completed"
all: -> app.viewmodels.settings.list_filter_mode('') all: -> app.viewmodels.settings.list_filter_mode('')
active: -> app.viewmodels.settings.list_filter_mode('active') active: -> app.viewmodels.settings.list_filter_mode('active')
......
window.SettingsViewModel = -> window.SettingsViewModel = ->
@list_filter_mode = ko.observable('') @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