Skip to content

Commit

Permalink
Merge pull request #340 from absoludity/update-derby-version
Browse files Browse the repository at this point in the history
Update to lenfire's more recent derby and work around ref issue.
  • Loading branch information
sindresorhus committed Dec 5, 2012
2 parents 8d11ff5 + b2c11f5 commit d3d4381
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 6 deletions.
2 changes: 1 addition & 1 deletion labs/architecture-examples/derby/package.json
Expand Up @@ -4,7 +4,7 @@
"version": "0.1.0",
"main": "server.js",
"dependencies": {
"derby": "~0.3.13",
"derby": "git://github.com/lefnire/derby#master",
"express": "~3.0.1",
"gzippo": "~0.2.0"
},
Expand Down
15 changes: 10 additions & 5 deletions labs/architecture-examples/derby/src/todos/index.coffee
Expand Up @@ -30,21 +30,26 @@ get '/:groupName', (page, model, {groupName}) ->
.where('group').equals(groupName)
.where('completed').notEquals(true)

model.set '_filter', 'all'
model.ref '_list.shown', '_list', '_filter'
# model.set '_filter', 'all'
# model.ref '_list.shown', '_list', '_filter'
# XXX 2012-12-04 Calling .get on keyed ref returns getter fn.
# We used to use the above keyed ref on _list, but when
# using derby master, it results in
# https://github.com/codeparty/derby/issues/179
model.ref '_list.shown', '_list.all'

page.render()

# Transitional route for enabling a filter
get from: '/:groupName', to: '/:groupName/:filterName',
forward: (model, {filterName}) ->
model.set '_filter', filterName
model.ref '_list.shown', "_list.#{filterName}"
back: (model, params) ->
model.set '_filter', 'all'
model.ref '_list.shown', "_list.all"

get from: '/:groupName/:filterName', to: '/:groupName/:filterName',
forward: (model, {filterName}) ->
model.set '_filter', filterName
model.ref '_list.shown', "_list.#{filterName}"

ready (model) ->
todos = model.at 'todos'
Expand Down

0 comments on commit d3d4381

Please sign in to comment.