简体   繁体   English

如何在Rails上安装和使用基于JavaScript的插件?

[英]how to install and use a javascript based plugin on rails?

I am making a rails app and having a ridiculously hard time trying to get the Redbox plugin to work. 我正在制作一个Rails应用程序,并且很难使Redbox插件正常工作。 I'm pretty sure I installed everything correctly and am using it properly. 我很确定自己安装正确并且正在正确使用。 When I use one of the helper methods, it seems to generate javascript properly. 当我使用一种辅助方法时,似乎可以正确生成javascript。 For example when I type: 例如,当我键入:

<%= link_to_redbox 'hello', 'test' %>

it generates: 它产生:

<a href="#" onclick="RedBox.showInline('test'); return false;">hello</a>

which seems correct if i want to show a non visible ( display:none; ) div called test. 如果我想显示一个不可见的( display:none; )div称为test,这似乎是正确的。

I'm so confused on this one. 我对此很困惑。 I'm pretty sure it is not finding the js or something but don't see why this would be. 我很确定它没有找到js或其他东西,但不知道为什么会这样。 The redbox.js link is generated as: redbox.js链接生成为:

<script src="/javascripts/redbox.js?1239506092" type="text/javascript"></script>

检查javascript文件是否确实存在-应该位于public / javascripts / redbox.js(至少应该在它期望的位置)。

CSS必须是内联的!

Try the version of GitHub. 试用GitHub版本。 The current sourceforge version is pretty creaky. 当前的sourceforge版本非常糟糕。 http://github.com/craigambrose/redbox/tree/master http://github.com/craigambrose/redbox/tree/master

I'm using this one. 我正在用这个。

Stuff has started moving here. 东西已经开始搬到这里了。 There is a few other forks that you might investigate. 您可能还需要研究其他一些分支。 From some somments on the blog in April, it sounded like Craig may start it maintaining again, but oddly, the blog hasn't been update to point to GitHub. 从4月份博客的一些记录来看,听起来Craig可能会再次开始对其进行维护,但是奇怪的是,博客尚未更新以指向GitHub。

There is another one Also, read the comments for patches and other stuff: 还有另外一个,请阅读有关补丁和其他内容的注释:

blog.craigambrose.com/articles/2006/09/22/redbox-release-2 blog.craigambrose.com/articles/2006/09/22/redbox-release-2

The blog comments are an impromptu support forum. 博客评论是即兴支持论坛。 I applied a form within a form patch I found here. 我在这里找到的表单补丁中应用了表单。

There is another blog somewhere that has a large discussion in the comments. 某处的博客在评论中进行了大量讨论。

The other thing- play around with Firebug to analysis the html and find the issue. 另一件事-与Firebug一起玩以分析html并找到问题。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM