0

我不确定为什么在我的 Rails 应用程序上调用灯箱时我的关闭和加载图像没有加载。我已经正确地复制了这些文件,并且 js 和 css 工作正常,但我得到了用于关闭和加载的损坏图像。

这是application.js

//= require jquery
//= require jquery-ui
//= require jquery_ujs
//= require jquery.ui.datepicker
//= require justgage
//= require raphael.min
//= require jquery.purr
//= require best_in_place
//= require lightbox
//= require_tree .

我的application.css

 *
 *= require jquery.ui.datepicker
 *= require_self
 *= require_tree .
 *= bootstrap
 *= lightbox
 */

在我的图像文件夹中,我close.pngloading.gif

这是请求的输出

Started GET "/images/close.png" for IP at 2013-01-01 12:39:19 -0800
ActionController::RoutingError (No route matches [GET] "/images/close.png"):
  actionpack (3.2.8) lib/action_dispatch/middleware/debug_exceptions.rb:21:in `call'
  actionpack (3.2.8) lib/action_dispatch/middleware/show_exceptions.rb:56:in `call'
  railties (3.2.8) lib/rails/rack/logger.rb:26:in `call_app'
  railties (3.2.8) lib/rails/rack/logger.rb:16:in `call'
  actionpack (3.2.8) lib/action_dispatch/middleware/request_id.rb:22:in `call'
  rack (1.4.1) lib/rack/methodoverride.rb:21:in `call'
  rack (1.4.1) lib/rack/runtime.rb:17:in `call'
  activesupport (3.2.8) lib/active_support/cache/strategy/local_cache.rb:72:in `call'
  rack (1.4.1) lib/rack/lock.rb:15:in `call'
  actionpack (3.2.8) lib/action_dispatch/middleware/static.rb:62:in `call'
  railties (3.2.8) lib/rails/engine.rb:479:in `call'
  railties (3.2.8) lib/rails/application.rb:223:in `call'
  rack (1.4.1) lib/rack/content_length.rb:14:in `call'
  railties (3.2.8) lib/rails/rack/log_tailer.rb:17:in `call'
  rack (1.4.1) lib/rack/handler/webrick.rb:59:in `service'
  /Users/tony/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/webrick/httpserver.rb:138:in `service'
  /Users/tony/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/webrick/httpserver.rb:94:in `run'
  /Users/tony/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/webrick/server.rb:191:in `block in start_thread'

并且显示了类似的错误loading.gif

我需要更改路线文件中的某些内容吗?我在这里俯瞰什么?如果我正确地包含了 js 和 css,图像是否也应该包含在内?感谢您的关注和查看。

- - - 更新 - - - -

更新 application.css

 *= require jquery.ui.datepicker
 *= require_self
 *= require bootstrap
 *= require lightbox
 *= require_tree .
 */

同样破碎的图像仍然出现。

4

1 回答 1

1

看看这个 :

*= require_tree .
*= bootstrap
*= lightbox
*/

如果它真的在你的application.css,它应该是:

*= require bootstrap
*= require lightbox
*= require_tree .
*/

编辑:您可以查看lightbox.css文件并检查图像是如何引用的。然后你应该选择如何改变它——硬编码,比如images/image.png使用普通.css文件前缀,或者通过<% asset_path %>/image.pngand .css.erb

于 2013-01-01T21:04:31.073 回答