Closed farias-r7 closed 11 years ago
Looks like an alternative is to use partials. Let me know if this is the suggested approach. I will close the issue if it is.
notification_item_view.hamlbars
{{#if true}}
.notification-message.message-read
{{> notification_center/item_views/_notification}}
{{else}}
.notification-message
{{> notification_center/item_views/_notification}}
{{/if}}
_notification.hamlbars
.header
.title
{{title}}
.close
x
.content
{{content}}
%span
2 Days Ago
.details
44 Hosts Found
Hi @farias-r7,
Using partials works. Another alternative would be to add a property to your context to set the appropriate classes:
%div(class='{{notificationClass}}')
Set the notificationClass
property to either notification-message
or notification-message message-read
.
Sounds good! Closing issue,
Not sure if this is a bug, or a limitation of how Hamlbars and Slimbars are compiled
My understanding is that file extensions .hamlbars and .slimbars first go through the HAML and SLIM templating engine, then that generated HTML w/ Handlebars markup is passed to Handlebars for precompilation.
The issue is this:
The Handlebars helpers don't work on a Haml element tag. Probably because the if logic isn't run until the template is compiled by handlebars. Since HAML compilation happens first it breaks.
Not sure on a fix.
Hamlbars template