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

Meteor/Blade not rendering #98

Closed
PastorBones opened this issue Nov 3, 2012 · 6 comments
Closed

Meteor/Blade not rendering #98

PastorBones opened this issue Nov 3, 2012 · 6 comments
Assignees

Comments

@PastorBones
Copy link

I've got blade working with Meteor and it's rendering static html fine. However, I'm getting a bundle error when trying to use template variables.

Client.js

    Template.info.player = function(){
        var data = Session.get( 'data' );
        return data.player;
    };

info.blade

.player-name.large= player.name
.alliance-name= alliance.name
.world-name= world.name

Error

Errors prevented startup:
Exception while bundling application:
ReferenceError: player is not defined
    at /home/pastorbones/meteor/loutell/views/info.blade:1:1

1 > .player-name.large= player.name
@ghost ghost assigned bminer Nov 5, 2012
@bminer
Copy link
Owner

bminer commented Nov 5, 2012

Good point. Helpers don't work yet in Blade. Thanks for pointing out this issue. This will be addressed shortly.

@bminer
Copy link
Owner

bminer commented Nov 5, 2012

Actually... on second thought... why would that show up as a bundle error? Is your info.blade template included in your body.blade template? Do you even have a body.blade template? If so, could you post it here?

@PastorBones
Copy link
Author

Here's pretty much everything besides the Meteor.method that gathers data from the server (through an additional api call of a external MMO). The Session variables are being set properly within that method call...

client.js

{project}/client/client.js

if( Meteor.is_client) {
    // Session('data') is being set in a Module.call

    Template.info.alliance = function(){
        var data = Session.get( 'data' );
        return data.alliance;
    };
    Template.info.player = function(){
        var data = Session.get( 'data' );
        return data.player;
    };
}

Templates

{project}/views/body.blade

body
    .navbar.navbar-inverse.navbar-fixed-top
        .navbar-inner
            .container-fluid
                .brand MySite
    .container-fluid
        .row-fluid
            .span3
                include 'sidebar'

{project}/views/sidebar.blade

#sidebar.well.sidebar-nav
    include 'info'

{project}/views/info.blade

.player-name.large= player.name
.alliance-name= alliance.name
.world-name= world.name

@bminer
Copy link
Owner

bminer commented Nov 9, 2012

EDIT: Ignore this comment. As of Blade 3.0.0 stable, you can use helpers in body.blade templates.

Helpers do not work in body.blade templates. If your body.blade file includes another file that uses helpers, it will also not work.

This is by design. body.blade files are for rendering initial static page content only. Handlebars uses another approach, which allows for dynamic content; however, I believe that it's a bit confusing, since Handlebars does not allow for dynamic content in <head> tags.

Thoughts on this?

See this wiki page for more information.

@bminer bminer closed this as completed Nov 9, 2012
@VanCoding
Copy link

I've asked the following question previously on SO: http://stackoverflow.com/questions/13438793/meteor-blade-included-templates-still-use-the-context-of-the-parent

Could it be that it is related to this?

@bminer
Copy link
Owner

bminer commented Nov 19, 2012

@VanCoding - probably not. The link you posted above is a separate bug. :-/

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

No branches or pull requests

3 participants