2013-04-04 26 views
0

我使用Scalatra創建應用程序,我使用Scalate/Jade進行模板化。我嘗試將Flash支持添加到我的應用程序中。我將FlashMapSupport混合到我的Servlet中,我可以訪問flash幫助程序。無論如何,如果我試圖從佈局得到它,我收到以下錯誤:從Scalatra中的Jade模板訪問Flash地圖

[error] /home/ytaras/projects/scala/scalatra-shopping-cart/target/scala-2.10/src_managed/main/scalate/templates/layouts/default_jade.scala:27: not found: value flash 
[error]       flash.get("alert").foreach 
[error]      ^
[error] one error found 

我可以做些什麼來避免這種情況是使用垂頭喪氣的渲染下,最佳的:

- context.asInstanceOf[org.scalatra.scalate.ScalatraRenderContext].flash.get("alert").foreach 
    - alert => 
    .alert 
     .button(type="button" class="close" data-dismiss="alert") × 
     = alert 

無論如何,這是絕對不是最漂亮的解決方案。有什麼我可以做的,以解決它或這是一個問題在Scalate/Jade代碼?

回答

1

我剛剛完成了一個使用Jade的非常簡單的Scalatra應用程序,它似乎按照文檔工作。

編輯:我一直在使用早期版本的Scalatra生成的應用程序。

在Scalatra 2.2.0中,我們在g8骨架中添加了預編譯的Scalate模板,以提高默認生產速度。在那裏有一個錯誤project/build.scala導致閃存上下文丟失。

添加到您的project/build.scalahttps://gist.github.com/anonymous/ff40cdde1a1105970f50#file-build-scala-L37-L39

我們會暫時解決G8模板。抱歉,添麻煩了。

+0

你能否澄清哪些類型的信息可能有幫助?謝謝 – 2013-04-05 12:01:26

+0

Hi Yura,你能像我做的那樣展示行動和觀點嗎?另外,如果您需要實時幫助,Freenode上的#scalatra irc頻道上有一個非常活躍的社區。 – futurechimp 2013-04-05 12:40:53

+0

當然 - 這裏是我說的git倉庫 - https://github.com/ytaras/scalate_shopping_cart – 2013-04-05 13:08:24