Ruby on Rails 3.1和jQuery UI图像 [英] Ruby on Rails 3.1 and jQuery UI images

查看:75
本文介绍了Ruby on Rails 3.1和jQuery UI图像的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用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中的自动填充字段 我应该将jQuery UI主题放在vendor/assets/stylesheets文件夹中.这听起来像是一个聪明的地方,但是我没有让它起作用:-(.

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文件夹中来加载CSS,但是我没有设法加载图像.

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中,但是想成为一个现代人,我宁愿使用这种新的方式:-).

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:

我将包含主题(在CSS和images文件夹中均未更改)的jQuery文件夹放置在asset/stylesheets文件夹中,然后在app/views/layouts/application.html.erb文件中放置:<%= stylesheet_link_tag "jquery/ui-lightness/jquery-ui-1.8.13.custom" %>.当我稍后更新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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆