Skip to content

Commit

Permalink
Fixed view shortcut scopes.
Browse files Browse the repository at this point in the history
  • Loading branch information
sderickson committed Mar 26, 2015
1 parent d09a14a commit a90036e
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 4 deletions.
8 changes: 7 additions & 1 deletion app/templates/home-view.jade
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,10 @@ extends /templates/common/base
block content
.page-header
h1 Hello World!
span.glyphicon.glyphicon-search
span.glyphicon.glyphicon-search

ul.list-group
li.list-group-item
a(href="/test/client") Client Tests
li.list-group-item
a(href="/test/server") Server Tests
11 changes: 10 additions & 1 deletion dist/frimfram.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/frimfram.js.map

Large diffs are not rendered by default.

5 changes: 4 additions & 1 deletion src/BaseClass.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,10 @@ class BaseClass

listenToShortcuts: ->
shortcuts = @superMerge('shortcuts')
@scope = _.uniqueId('class-scope-')
if @scope
@stopListeningToShortcuts()
else
@scope = _.uniqueId('class-scope-')
for shortcut, func of shortcuts
func = @[func] if not _.isFunction(func)
continue unless func
Expand Down
4 changes: 4 additions & 0 deletions src/BaseView.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,10 @@ class BaseView extends Backbone.View

listenToShortcuts: (recurse) ->
shortcuts = @superMerge('shortcuts')
if @scope
@stopListeningToShortcuts()
else
@scope = _.uniqueId('view-scope-')
for shortcut, func of @shortcuts
func = @[func] if not _.isFunction(func)
continue unless func
Expand Down

0 comments on commit a90036e

Please sign in to comment.