kadirahq / blaze-layout

Layout Manager for Blaze (works well with Meteor FlowRouter)
MIT License
198 stars 61 forks source link

Double rendering? #74

Open Orbyt opened 8 years ago

Orbyt commented 8 years ago

For some reason whenever I render a layout into a template, it just gets rendered below all other content on the page. I've posted this on the Meteor forums as well but here is the code:

<body>
    ...
    {{> layout}}
</body>

<template name="layout">

    <div class="container full-container">
        <div class="row full-row">
            <div class="col-md-2 left-bar" style="background:#800000;">
                <div class="row">
                    <div class="col-md-12">
                        {{> avatar size="large" shape="circle"}}
                    </div>
                </div>
            </div>
            <div class="col-md-10">
                {{>Template.dynamic template=content}}
            </div>
        </div>
    </div>
</template>

<template name="usercard">
    ...
</template>

<template name="home">
    <div class="row">
        {{#each playerslooking}}
            {{> usercard}}
        {{/each}}
    </div>
</template>

<template name="find_page">
    <div style="height:150px;width:150px;background:blue;">hello</div>
</template>

JS:

FlowRouter.route('/', {
  action: function() {
    BlazeLayout.render("layout", {content: "home"});
  }
});

FlowRouter.route('/find/:_id', {
  name: 'postfind.show',
  action: function() {
    BlazeLayout.render('layout', {content: "find_page"});
  }
});

What happens is that it seems to double render my .full-row

for some reason. This puts all content below the page.

I'm guessing this is user error but im not sure what im doing wrong.

Paint skills: What Im going for: http://prntscr.com/br8xh6

whats happening: http://prntscr.com/br8z8p

Related: http://stackoverflow.com/questions/34299849/blazelayout-rendering-content-to-a-dynamic-template-but-the-content-is-appearin

Orbyt commented 8 years ago

So I was just going through some more tutorials trying to debug, and ran the followinng:

<template name="mainLayout">

    {{>Template.dynamic template=content}}

</template>

I did not include the mainLayout template anywhere, yet it still showed up. How? If the dynamic templates just popup by themselves, how are you supposed to structure your layout?

ghost commented 7 years ago

Hey, did you figure it out?? having the same issue with a navbar.