I created this view
{{#view Q.FlashView id="flash-view"}}
<div class="row">
<div class="small-11 small-centered columns">
<div id="message" {{bindAttr class=":alert-box :radius"}} data-alert>
{{view.content.message}}
<a href="#" class="close">×</a>
</div>
</div>
</div>
{{/view}}
with this definition
Q.FlashMessage = Ember.Object.extend({
type: "notice",
message: null,
isNotice: (function() {
return this.get("type") === "notice";
}).property("type").cacheable(),
isWarning: (function() {
return this.get("type") === "warning";
}).property("type").cacheable(),
isError: (function() {
return this.get("type") === "error";
}).property("type").cacheable(),
isSuccess: (function() {
return this.get("type") === "success";
}).property("type").cacheable()
});
Q.FlashView = Ember.View.extend({
contentBinding: "Q.FlashController.content",
classNameBindings: ["isNotice: secondary", "isWarning: alert", "isError: alert", "isSuccess: success"],
isNoticeBinding: "content.isNotice",
isWarningBinding: "content.isWarning",
isErrorBinding: "content.isError",
isSuccessBinding: "content.isSuccess",
What I am trying to do is to make the view display the following css class depending on the type if notice for example to have class="alert-box radius notice".
I can't figure out how is this done, as it seems this classNameBindings is not working out with static content.
I already asked this question to the original author in which I took the code from, coderberry.me/blog/2013/06/20/using-flash-messages-with-emberjs/
you can see the original code there.
Thanks in advance