Commit e3d2ddc2 authored by Michael Nelson's avatar Michael Nelson Committed by Sindre Sorhus

DerbyJS: Don't error on undefined list, ensure num active count is reactive fn.

parent d23c0c33
......@@ -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>
......
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