Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Nested Template #52

Open
frankcheong opened this issue Oct 24, 2015 · 4 comments
Open

Nested Template #52

frankcheong opened this issue Oct 24, 2015 · 4 comments

Comments

@frankcheong
Copy link

Hello,

I am working on a project and need to proper split the template based on function unit. To achieve that I would need to nest the template and would like to know the proper way in doing that.

I have a base layout template below

baseLayout.html

<template name="baseLayout">
{{> navigation}}
{{> notifications}}
{{> Template.dynamic template=Body}}
</template>

Both navigation and notifications don' t have anything special. While for the Body it need to further nest as:-

Body.html

<template name="Body">
{{> Template.dynamic template=SearchTemplate}}
{{> Template.dynamic template=ResponseTemplate}}
</template>

For the route, I only know how to pass the body dynamic template while is there a way I can pass the Search Template and ResponseTemplate?
Route.js

FlowRouter.route('/', {
  name: 'baseLayout',
  action: function(params, queryParams) {
    BlazeLayout.render('baseLayout', {Body: "Body"});
})
@jiku
Copy link

jiku commented Oct 31, 2015

See #24. :)

@frankcheong
Copy link
Author

It is different case. They are referring to a master template with more than one child template. I am referring to child template have child template.

@arunoda
Copy link
Contributor

arunoda commented Oct 31, 2015

There are no built in ways. But you can do like this.

  • Think search template is also a kind of layout. Pass some data into that, which contains the nested layout names.

Try this:

FlowRouter.route('/', {
  name: 'baseLayout',
  action: function(params, queryParams) {
    var options = {SearchTemplate: 'aa', ResponseTemplate: 'bb'};
    BlazeLayout.render('baseLayout', {Body: "Body", options: options});
})

<template name="baseLayout">
{{> navigation}}
{{> notifications}}
{{> Template.dynamic template=Body data=options}}
</template>

I didn't check the code. But this should be working.

@vladshcherbin
Copy link

@frankcheong no, you are asking the same thing from #24, I also used master with 1 dynamic and nested with 2 dynamic. Just add

BlazeLayout.render('baseLayout', {
  Body: "Body",
  SearchTemplate: "**title**",
  ResponseTemplate: "**title**"
});

Check the demo repository / demo app, it works great.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants