Permalink
Browse files

DerbyJS: Don't error on undefined list, ensure num active count is re…

…active fn.
  • Loading branch information...
1 parent d23c0c3 commit e3d2ddc2b884cc9f4a5696069a69b62b1e1c2d37 @absoludity absoludity committed with sindresorhus Aug 27, 2012
@@ -4,9 +4,12 @@ derby = require 'derby'
derby.use(require '../../ui')
view.fn 'noItems',
- get: (list) -> !list.length
+ get: (list) -> !list.length unless list is undefined
set: ->
+view.fn 'oneItem',
+ get: (list) -> list.length == 1 unless list is undefined
+
# Redirect the visitor to a random todo list
get '/', (page) ->
page.redirect '/' + parseInt(Math.random() * 1e9).toString(36)
@@ -40,7 +40,7 @@
<todoFooter:>
<footer id="footer" class="{#unless _list.all}empty-list{/}">
- <span id="todo-count"><strong>{_list.active.length}</strong> item{#unless equal(_list.active.length, 1)}s{/} left</span>
+ <span id="todo-count"><strong>{_list.active.length}</strong> item{#unless oneItem(_list.active)}s{/} left</span>
<ul id="filters">
<li class="all">
<a href="/{{_groupName}}" class="{#if equal(_filter, 'all')}selected{/}">All</a>

0 comments on commit e3d2ddc

Please sign in to comment.