EventedMind/blaze-layout — pull request #15 by tmeasday (2014-05-01 07:22:58+00:00)
Title: In template scope

Hey Chris,

This branch solves the problems I've seen with helpers + data not correct passing through to the content block of a Layout when used outside of IR.

It's quite a simple change really -- we remove the hacks that pass helper lookups through the Layout Component, and instead us the `UI.InTemplateScope` that already exists in Blaze.

What this does behind the scenes is wires the `__content` block up with the `Layout` component's parent as it's parent. Apparently this is OK, as this is exactly what happens when you use a template as a layout via a block helper inclusion + `{{> UI.contentBlock}}`.

There's only one downside to all this, and it might be a deal-breaker. I'm keen to hear you thoughts.

The problem is that because the content block is now short-circuited around the `Layout`, there doesn't appear to be any way to get `contentFor` to work. That's because it looks like this:

```
{{#with X}} // outer component
{{#Layout}}
// in here, the outer component is the parent
{{#contentFor}} // so when we try to look up the closest ancestor Layout, it blows up.
```

Any ideas how to work around this? Otherwise, it seems like an ideal way to make helpers and data work in a rational, sensible way inside yielded regions.