2012-02-14 74 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导致资源的非摘要版本。