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 ...@@ -28,7 +28,7 @@ class Rivets.Binding
28 28
29 setModel: => 29 setModel: =>
30 interfaces = (k for k, v of @view.adapters) 30 interfaces = (k for k, v of @view.adapters)
31 tokens = Rivets.KeypathParser.parse @keypath, interfaces, '.' 31 tokens = Rivets.KeypathParser.parse @keypath, interfaces, @view.config.rootInterface
32 32
33 @rootKey = tokens.shift() 33 @rootKey = tokens.shift()
34 @key = tokens.pop() 34 @key = tokens.pop()
...@@ -119,7 +119,7 @@ class Rivets.Binding ...@@ -119,7 +119,7 @@ class Rivets.Binding
119 for dependency in @options.dependencies 119 for dependency in @options.dependencies
120 interfaces = (k for k, v of @view.adapters) 120 interfaces = (k for k, v of @view.adapters)
121 prefix = dependency[0] in interfaces 121 prefix = dependency[0] in interfaces
122 root = if prefix then dependency[0] else '.' 122 root = if prefix then dependency[0] else @view.config.rootInterface
123 path = if prefix then dependency.substr(1) else dependency 123 path = if prefix then dependency.substr(1) else dependency
124 tokens = Rivets.KeypathParser.parse path, interfaces, root 124 tokens = Rivets.KeypathParser.parse path, interfaces, root
125 key = tokens.pop() 125 key = tokens.pop()
......
...@@ -20,5 +20,6 @@ Rivets = ...@@ -20,5 +20,6 @@ Rivets =
20 # overridden globally or local to a `Rivets.View` instance. 20 # overridden globally or local to a `Rivets.View` instance.
21 config: 21 config:
22 preloadData: true 22 preloadData: true
23 rootInterface: '.'
23 handler: (context, ev, binding) -> 24 handler: (context, ev, binding) ->
24 @call context, ev, binding.view.models 25 @call context, ev, binding.view.models
......