无法使用带有 Rails 的 Facebox 渲染部分内容
我正在使用 Facebox 在弹出窗口中获取一些信息。
我的资产文件夹中有facebox.js 和facebox.css 文件。我已将此代码包含在我的 application.js 文件中,
jQuery(document).ready(function($) {
$('a[rel*=facebox]').facebox()
});
我有 link_to ,看起来像这样 <%=link_to "Create",new_activities_path, :rel =>; "facebox" %>
当我单击创建链接时,我会看到一个空弹出窗口,并且不会呈现部分中的表单。
我可以在没有 Facebox 的情况下渲染这个部分。我查遍了整个网络,但似乎facebox的文档不太好。
有人可以指导我吗?
谢谢,
I am using facebox to get some information in a popup window.
I have got facebox.js and facebox.css file in my assets folder. I have included this code in my application.js file
jQuery(document).ready(function($) {
$('a[rel*=facebox]').facebox()
});
I have link_to which looks like this <%=link_to "Create",new_activities_path, :rel => "facebox" %>
When I click on the create link I get a popup which is empty and does not render the form which is in the partial.
I am able to render this partial without facebox. I have been looking all over the net but it seems the documentation of facebox is not that good.
Can anyone guide me?
Thanks,
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
能够通过稍微调整代码来做到这一点:-
现在我的 link_to 看起来像这样
<%=link_to "Create",new_activity_path, :remote => true %>
我在控制器中还有一个新操作以及相应的 new.js.erb 文件,该文件具有下面提到的代码:-
application.js 中的代码保持不变。我能够在一个漂亮的弹出窗口中渲染 _new.html.erb 中的部分。
希望它对其他人有用,因为 Facebox 的文档非常差。
谢谢,
Was able to do it by tweaking the code little bit :-
now my link_to looks like this
<%=link_to "Create",new_activity_path, :remote => true %>
I also have a new action in the controller and a corresponding new.js.erb file which has got the below mentioned code:-
the code in the application.js remains the same. I am able to render the partial in _new.html.erb in a nice popup.
Hope it will be useful to others as the documentation of facebox is very poor.
Thanks,