I use the built-in haml templates in my sinat application. I have @@layout with this section:
#message - if flash[:notice] %section.notice= flash[:notice] - if flash[:error] %section.error= flash[:error]
When I use flash[:notice] = "Hello!" on the route and click on the link, the next page will happily say βHelloβ to the #message div. fine.
So here is the problem, I am using right.js to add some ajax niceness to my application. Flash stand behavior is inconsistent at best.
In most cases, you click on the link ( .linkey ), a little javascript catches it and loads it into the #content div (this part also works), then the div '#message' is reloaded and the flash for the previous action is displayed ... the next time the link is clicked .. In about 80% of cases, the rest of the time nothing is displayed.
This is my js:
"a.linkey".onClick(function(event) { event.stop(); $('content').load( [ "/", this.get('id'), ].join("") ); $('message').load( '/message' ); });
I would like something like this:
1) Click the link
2) the target link (/ foo) is loaded in #content
3) #message reloaded with a message (from the route flash[:notice] = "bar")
4) #content now displays /foo and #message displays "bar"
I also tried this with $('message').load( '/message' ); but didn't load anything into #message or populate #message "/ message" (string, not content).
I would like to know what is happening here? Is it something with a flashstand or right.js? or something different? I can provide more code if necessary, but there really is not much more than the basic structure, since I am just starting this project.
Don graziano
source share