-
Notifications
You must be signed in to change notification settings - Fork 6
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
Add ability to pass variables into isActivePath #6
Comments
@paulmolluzzo I'm not sure if you can call a helper from within a helper like that. Sorry, I haven't been doing a lot of Meteor work lately and this stuff escapes me. Do you know, as an alternative if you can call a helper from within a helper function (not inline, but the actual helper itself)? If so, you could wrap the isActivePath call and build out the regex string manually that includes the current user id. |
@paulmolluzzo Maybe you can create a helper on the template where you use isActivePath and let that helper build the string with currentUser Template.test.helpers({
'currentUserEditPath': function() {
return Meteor.userId() + '/edit'
}
}); <template name='test'>
<li class="{{ isActivePath currentUserEditPath }}">
</template> |
@paulmolluzzo : i have the same issue i did this: created a helper for that template : isActiveUser : function() {
if(Router.current().path.indexOf(this._id) !== -1){
return true;
}
} and i have already an helper UI.registerHelper('isTrue', function(context, option) {
if(context)
return option;
}); usage: <a class="list-group-item {{isTrue isActiveUser 'select'}}" href="{{pathFor 'usersShow'}}"> |
It'd be great to be able to pass in a user- or session-specific variable to test the path. For example, let's say I have the following paths:
And let's say the navigation is:
I'd like to make the "Users" link active for all 3 of the paths, except if I'm editing my own User account, then I want "My Name" to be active.
I tried doing something like this but it didn't work:
<li class="{{ isActivePath '{{ currentUser._id }}/edit' }}">
Is this already possible? Is this a limitation of Blaze/Handlebars?
TIA.
The text was updated successfully, but these errors were encountered: