batmanjs/batman-rails — pull request #60 by vassilevsky (2014-09-14 19:34:06+00:00)
Title: Cut out any template file extensions when inlining

Hello :)

I wanted to understand how to use Batman. I don't have a big projector with a contour of a bat, so I simply scaffolded a **product** model. The generator has generated templates for common actions in **.html** format.

It did not include the `batman_define_views` helper in the layout. I looked at the Network panel in Chrome Developer Tools and saw that Batman fetches the current template (**products/index.html**) from the server. Then I inserted the `batman_define_views` helper in the layout, and refreshed the page. I saw the huge chunk of JavaScript code that defines all the templates. That was cool. But then I looked at the Network panel and saw that Batman still requested the template! WTF?!

I started digging into this. Long story short, this solution was born.

The only problem with it could theoretically be if someone uses a dot in the middle of a template file name. But I doubt that ever happens. Nevertheless, please let me know if a better solution is required.