Ruby on Rails 3.1 和 jQuery UI 图像 [英] Ruby on Rails 3.1 and jQuery UI images
问题描述
我使用的是 Ruby on Rails(Edge,开发版)和 Ruby rvm 1.9.2.
I'm using Ruby on Rails (Edge, the development version), and Ruby rvm 1.9.2.
application.js
如下.
//= require jquery
//= require jquery-ui
//= require jquery_ujs
//= require_tree
Ruby on Rails 3.1 中放置 jQuery UI 主题的正确位置在哪里?
Where is the right place in Ruby on Rails 3.1 to put the jQuery UI theme?
根据使用 jQuery UI 在 Ruby on Rails 3.1 中自动完成字段 我应该在 vendor/assets/stylesheets 文件夹中放置一个 jQuery UI 主题.这听起来像是一个聪明的地方,但我没有让它工作:-(.
According to Autocomplete fields in Ruby on Rails 3.1 with jQuery UI I should put a jQuery UI theme in vendor/assets/stylesheets folder. That sounds like a smart place to have it, but I don't get it to work :-(.
我设法通过将 CSS 放在 assets/stylesheets 文件夹中来加载它,但是我没有设法加载图像.
I managed to get the CSS loaded by putting it in the assets/stylesheets folder, but the images I havn't managed to get loaded.
我当然可以使用旧方法,只需将主题放在 public/stylesheets/文件夹中,然后使用:
I could of course be using the old way with just putting the theme in the public/stylesheets/ folder, and using:
<%= stylesheet_link_tag "jquery/ui-lightness/jquery-ui-1.8.11.custom" %>
在 application.html.erb 中,但想成为一个现代人,我宁愿使用新的方式来做 tings :-).
in application.html.erb, but trying to be a modern man, I would rather use the new way of doing tings :-).
推荐答案
我已经堕落到了老办法:
I've fallen down to doing it the old way:
我将包含主题的 jQuery 文件夹(CSS 和图像文件夹都保持不变)放在 assets/stylesheets 文件夹中,然后放入: <%= stylesheet_link_tag "jquery/ui-lightness/jquery-ui-1.8.13.custom" %>
在 app/views/layouts/application.html.erb
文件中.这个解决方案是我稍后更新 jQuery 时淡褐色较少的解决方案.
I put the jQuery folder, containing the theme (unchanged with both CSS and images folder) in the assets/stylesheets folder, and putting in: <%= stylesheet_link_tag "jquery/ui-lightness/jquery-ui-1.8.13.custom" %>
in app/views/layouts/application.html.erb
file. This solution is the one with less hazel when I will update jQuery later.
(感谢您对解决方案提出的所有建议.是时候结束了.)
(Thanks for all suggestions on the solution. It is time to conclude.)
这篇关于Ruby on Rails 3.1 和 jQuery UI 图像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!