92b2cb08 by Michael Richards

Add the ability to confnigure the root interface (used when there is no prepende…

…d interface token on a keypath).
1 parent 2a5c9d9d
......@@ -28,7 +28,7 @@ class Rivets.Binding
setModel: =>
interfaces = (k for k, v of @view.adapters)
tokens = Rivets.KeypathParser.parse @keypath, interfaces, '.'
tokens = Rivets.KeypathParser.parse @keypath, interfaces, @view.config.rootInterface
@rootKey = tokens.shift()
@key = tokens.pop()
......@@ -119,7 +119,7 @@ class Rivets.Binding
for dependency in @options.dependencies
interfaces = (k for k, v of @view.adapters)
prefix = dependency[0] in interfaces
root = if prefix then dependency[0] else '.'
root = if prefix then dependency[0] else @view.config.rootInterface
path = if prefix then dependency.substr(1) else dependency
tokens = Rivets.KeypathParser.parse path, interfaces, root
key = tokens.pop()
......
......@@ -20,5 +20,6 @@ Rivets =
# overridden globally or local to a `Rivets.View` instance.
config:
preloadData: true
rootInterface: '.'
handler: (context, ev, binding) ->
@call context, ev, binding.view.models
......