loginButtons is a template, not a helper

This commit is contained in:
Avital Oliver
2013-10-03 14:55:44 -07:00
parent 072517d788
commit 119682c8ec
3 changed files with 4 additions and 19 deletions

View File

@@ -1,10 +1,4 @@
<!--
NOTE: You shouldn't use these templates directly. Instead, use the global
{{loginButtons}} template. For positioning on the right side of your app,
try {{loginButtons align="right"}}
-->
<template name="_loginButtons">
<template name="loginButtons">
<div id="login-buttons" class="login-buttons-dropdown-align-left">
{{#if currentUser}}
{{#if loggingIn}}

View File

@@ -1,17 +1,8 @@
// for convenience
var loginButtonsSession = Accounts._loginButtonsSession;
Handlebars.registerHelper(
"loginButtons",
function (options) {
if (options.hash.align === "right")
return new Handlebars.SafeString(Template._loginButtons({align: "right"}));
else
return new Handlebars.SafeString(Template._loginButtons({align: "left"}));
});
// shared between dropdown and single mode
Template._loginButtons.events({
Template.loginButtons.events({
'click #login-buttons-logout': function() {
Meteor.logout(function () {
loginButtonsSession.closeDropdown();
@@ -19,7 +10,7 @@ Template._loginButtons.events({
}
});
Template._loginButtons.preserve({
Template.loginButtons.preserve({
'input[id]': Spark._labelFromIdOrName
});

View File

@@ -3,7 +3,7 @@ var loginButtonsSession = Accounts._loginButtonsSession;
// events shared between loginButtonsLoggedOutDropdown and
// loginButtonsLoggedInDropdown
Template._loginButtons.events({
Template.loginButtons.events({
'click #login-name-link, click #login-sign-in-link': function () {
loginButtonsSession.set('dropdownVisible', true);
Deps.flush();