2012-02-14 91 views
1

我正在使用Rails 3.1應用程序,它包含第三方JS日曆選取器(jsDatePick)。 jsDatePick有一大堆圖像在images/calendar/img /中。Rails 3.1資產管道和第三方JS日曆

運行rake資源:預編譯預編譯所有內容,但該庫仍然在images/calendar/img(不是assets/calendar/img)中查找圖像。我可以將目錄更改爲assets/calendar/img,但它不會附加指紋哈希。

有關如何解決此類問題的想法?

下面是一些與此伴隨而來的CSS樣本JS LIB:

.JsDatePickBox .boxLeftWall .leftTopCorner{ margin:0; padding:0; width:7px; height:8px; background:url(/assets/calendar/img/boxTopLeftCorner.png) left top no-repeat; overflow:hidden; } 
.JsDatePickBox .boxLeftWall .leftBottomCorner{ margin:0; padding:0; width:7px; height:8px; background:url(/assets/calendar/img/boxBottomLeftCorner.png) left top no-repeat; overflow:hidden; } 
.JsDatePickBox .boxLeftWall .leftWall{ margin:0; padding:0; width:7px; background:url(/assets/calendar/img/boxSideWallPx.gif) #ffffff left top repeat-y; overflow:hidden; } 

雖然我確實看到這裏有一個問題(資產標籤應該使用,因爲這些圖像不存在沒有指紋哈希的資產文件夾),我特別尋找的一些圖像不在應用程序中的任何CSS文件中。我現在正在尋找,以確定他們被調用的地方。

它看起來像其他圖像通過JavaScript應用。這裏有一個例子:

if (parseInt(aDayDiv.getAttribute("isToday")) == 1){ 
      this.setC(aDayDiv, "dayDownToday"); 
      aDayDiv.style.background = "url(" + this.oConfiguration.imgPath + this.oConfiguration.cellColorScheme + "_dayDown.gif) left top no-repeat"; 
     } else { 
      this.setC(aDayDiv, "dayDown"); 
      aDayDiv.style.background = "url(" + this.oConfiguration.imgPath + this.oConfiguration.cellColorScheme + "_dayDown.gif) left top no-repeat"; 
     } 

的oConfiguration.imgPath的定義是這樣的:

g_jsDatePickImagePath = "/assets/calendar/img/"; 

this.oConfiguration.imgPath = (g_jsDatePickImagePath.length != null) ? g_jsDatePickImagePath : "/images/calendar/img/"; 

謝謝您的幫助。

+0

是否有任何CSS呈現這些圖像?粘貼在這裏 – 2012-02-15 12:48:43

回答

0

答案是升級到Rails 3.1.1+(我升級到了rails 3.1.2),Rails運行rake資產解決了問題:預編譯:nondigest導致資源的非摘要版本。