Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/ruby-on-rails/67.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript Twitter引导模式不起作用_Javascript_Ruby On Rails_Ruby_Twitter Bootstrap_Modal Dialog - Fatal编程技术网

Javascript Twitter引导模式不起作用

Javascript Twitter引导模式不起作用,javascript,ruby-on-rails,ruby,twitter-bootstrap,modal-dialog,Javascript,Ruby On Rails,Ruby,Twitter Bootstrap,Modal Dialog,我一直在尝试为我的Desive和omniauth登录设置twitter引导模式,但没有成功。我也尝试了以下几个教程,但仍然无法打开它们 我的服务器日志中没有错误,只是以下内容: "Processing by Devise::SessionsController#new as JS" 我在application.coffee文件中需要twitter/bootstrap #= require_self #= require twitter/bootstrap #= require ./util #

我一直在尝试为我的Desive和omniauth登录设置twitter引导模式,但没有成功。我也尝试了以下几个教程,但仍然无法打开它们

我的服务器日志中没有错误,只是以下内容:

"Processing by Devise::SessionsController#new as JS"
我在application.coffee文件中需要twitter/bootstrap

#= require_self
#= require twitter/bootstrap
#= require ./util
#= require ./home and so on
在我的application.html.slim中,我在现有链接旁边添加了两个额外的登录链接,以确保在删除旧链接之前这些链接能够正常工作

li
  = link_to "Login", new_user_session_path, :remote => true, 'data-toggle' => 'modal', 'data-target' => '#login_modal', :class => "btn btn-small", :method => 'get'

li
  = link_to "Sign Up Free", new_user_session_path, :remote => true, 'data-toggle' => 'modal', 'data-target' => '#sign_up_modal', :class => "btn btn-small", :method => 'get'
然后我有我的注册模式和登录模式,这两种模式几乎完全相同

<div class="modal hide fade in" id="sign_up_modal">
<div class="modal-header">
<button class="close" data-dismiss="modal">x</button>
<h2>Sign Up</h2>
</div>
<div class="modal-body">
    <%= form_for(resource, :as => resource_name, :url => registration_path(resource_name)) do |f| %>
    <%= devise_error_messages! %>
<div><%= f.label :email %><br />
    <%= f.email_field :email, :autofocus => true %></div>
<div>
    <%= f.label :password %><br />
    <%= f.password_field :password %>
</div>
<div>
<%= f.label :password_confirmation %><br />
<%= f.password_field :password_confirmation %>
</div>
</div>
<div class="modal-footer">
  <p>
    <div>
      <%= f.submit "Sign up", :class => 'btn btn-small btn-success' %>
    </div>
  </p>
  <p>
    <a href="#" class="btn btn-small" data-dismiss="modal">Close</a>
  </p>
   </div>
  <% end %>
  </div>

x
注册
资源名称:url=>注册路径(资源名称))do | f |%>

正确%>

'btn btn小型btn成功'%>

如下图所示的“登录”链接可以正常工作,

li
  = link_to "Login", new_user_session_path, :remote => true, 'data-toggle' => 'modal', 'data-target' => '#login_modal', :class => "btn btn-small", :method => 'get'
li
  = link_to "Sign Up Free", new_user_session_path, :remote => true, 'data-toggle' => 'modal', 'data-target' => '#sign_up_modal', :class => "btn btn-small", :method => 'get'
您需要拥有
div的
id=login\u modal
(随附登录表单) 例如:

<div class="modal hide fade in" id="login_modal">
<div class="modal hide fade in" id="sign_up_modal">
您需要有
div
id=sign\u-up\u-modal
(随附注册表格) 例如:

<div class="modal hide fade in" id="login_modal">
<div class="modal hide fade in" id="sign_up_modal">


我的两个ID都已经正确了,只是不小心把我的旧封面复制了过来,所以,它们是否完全符合我在回答中的建议??注册页面的注意事项
id
应该是
sign\u-up\u-modal
而不是
sign\u-up
。另外,对于登录页面
id
应该是
login\u modal
而不是
login
。另外,我建议用正确的细节更新你的问题,否则回答者会浪费时间,就像我回答你不正确的代码那样。这是我发布的代码中唯一的问题。ID是正确的,我不想浪费你或我的时间:)那么你为什么不相应地更新你的问题呢。否则其他用户会给出与我在查看您的代码时给出的类似的答案。因为他们可能会错过你对我答案的评论。可能重复的