1

This is my layout.htmlcode, and Im wondering how to augment it so that <div class="navbar"> ... </div> only shows if the user is logged in via the {{>loginButtons}} above them. Additionally, how do I route to the route triggered by one of the buttons, upon the user successfully logging in?

        <body>
            {{renderPage}}
        </body>

        <template name='layout'>

            <div class="layout-buttons">

                    {{> loginButtons}}
            </div>

            <div class="navbar">
                <div class='btn' id='left'><a class='button-text' href="{{pathFor 'home'}}">home</a></div>
                <div class='btn' id='right'><a class='button-text' href="{{pathFor 'speakers'}}">myKaleo</a></div>
            </div>

            {{> yield}}

        </template>
redress
  • 1,399
  • 4
  • 20
  • 34
  • `{{#if currentUser}} your code {{/if}}`. We won't write code for you tho, can help with yours – sdooo Feb 10 '15 at 23:13

1 Answers1

5

You can use the currentUser helper like so:

{{#if currentUser}}
  <div class="navbar">
    ...
  </div>
{{/if}}

See this or this for how to automatically redirect the user.

David Weldon
  • 63,632
  • 11
  • 148
  • 146