Recursively assign the individual paths of an inflection so that we can do nested scope inflections.
Showing
1 changed file
with
4 additions
and
2 deletions
... | @@ -181,9 +181,11 @@ class Rivets.ComponentBinding extends Rivets.Binding | ... | @@ -181,9 +181,11 @@ class Rivets.ComponentBinding extends Rivets.Binding |
181 | # Returns an object map using the component's scope inflections. | 181 | # Returns an object map using the component's scope inflections. |
182 | locals: (models = @view.models) => | 182 | locals: (models = @view.models) => |
183 | result = {} | 183 | result = {} |
184 | result[key] = models[inverse] for key, inverse of @inflections | ||
185 | result[key] ?= model for key, model of models | ||
186 | 184 | ||
185 | for key, inverse of @inflections | ||
186 | result[key] = (result[key] or models)[path] for path in inverse.split '.' | ||
187 | |||
188 | result[key] ?= model for key, model of models | ||
187 | result | 189 | result |
188 | 190 | ||
189 | # Intercepts `Rivets.Binding::update` to be called on `@componentView` with a | 191 | # Intercepts `Rivets.Binding::update` to be called on `@componentView` with a | ... | ... |
-
Please register or sign in to post a comment