【发布时间】:2012-06-13 08:29:04
【问题描述】:
我找到了这个链接Link to another page using Twitter Bootstrap jquery modal in rails,这完全是我需要的——注册和其他使用 Bootstrap modal 和 Devise。
我做了这些步骤,但它没有弹出,而是将我重定向到另一个页面并显示不正确的页面。
它的行为真的很奇怪,它打开了 NOT MINE 表单。
_new.html.erb
<div class="modal hide fade in" id="sign_up">
<%= form_for resource, :as => resource_name, :url => registration_path(resource_name),do |f| %>
<%= devise_error_messages! %>
....
<% end %>
创建新的.js.erb:
$("#main").before("<%= escape_javascript(render "new", :formats => [:html]) %>");
$("#sign_up").modal();
和链接到:
<%= link_to "Sign up", new_user_registration_path, :remote => true %>
在 application.html.erb 中:
<%= stylesheet_link_tag "application", media: "all" %>
<%= javascript_include_tag 'http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js' %>
<%= csrf_meta_tags %>
已编辑。 在我的日志中: 由 Devise::RegistrationsController#new as JS 处理 渲染设计/注册/new.js.erb (15.6ms) 在 31 毫秒内完成 500 个内部服务器错误
ActionView::Template::Error (Missing partial devise/new with {:locale=>[:en], :f
ormats=>[:js, :html], :handlers=>[:erb, :builder, :coffee, :rabl]}. Searched in:
* "D:/print_it_green/app/views"
* "C:/Ruby192/lib/ruby/gems/1.9.1/gems/devise-2.1.0/app/views"
):
1: $("#sign_up").before("<%= escape_javascript(render "devise/new", :formats
=> [:html]) %>");
2: $("#sign_up").modal();
app/views/devise/registrations/new.js.erb:1:in `_app_views_devise_registration
s_new_js_erb___312569811_25856784'
问题出在哪里?
【问题讨论】:
标签: ruby-on-rails ajax twitter-bootstrap modal-dialog