2016-12-07 50 views
0

_header.html.erb不能點擊註冊下拉某個

 <li><a data-toggle="modal" data-target="#myModal" id="modal-open">LOG IN</a></li> 
 
     <li class="dropdown"> 
 
      <a href='#' class="dropdown-toggle" data-toggle="dropdown" aria-expanded="true"> 
 
      SIGN UP<b class="caret"></b> 
 
      </a> 
 
      <ul class="dropdown-menu"> 
 
      <li><%= link_to "<i class='fa fa-user-plus'></i> Join an existing organization".html_safe, new_user_registration_path %></li> 
 
      <li><%= link_to "Nonprofit Organization Sign Up", signup_path %></li> 
 
      <li><%= link_to "Donor Organization Sign Up" , signup_path(donor: :t) %></li> 
 
      </ul> 
 
     </li>

出於某種原因,之後如果我使用註冊下拉去不同的註冊頁面有時,我無法再點擊註冊下拉菜單。它只是停止點擊。我無法讓我的下拉菜單正常工作。我可以讓導航欄完美顯示,但是當我點擊「Dropdown」(其中任何一個)時,它不會顯示下拉菜單。當我看到使用它進行檢查組詠歎調擴展= 「假」

application.html.erb

<!DOCTYPE html> 
 
<html> 
 
<head> 
 
    <meta name="developers" content="Email [email protected] for an API key or a job offer."> 
 
    <title><%= full_title(yield(:title)) %></title> 
 
    <meta name="viewport" content="width=device-width, initial-scale=1"> 
 

 
    <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.4.0/css/font-awesome.min.css"> 
 
    <script async defer src="https://maps.googleapis.com/maps/api/js?key=AIzaSyBtBviyUbOQ2CeVxhO_eBNKQipiPwDPAs8&callback" 
 
    type="text/javascript"></script> 
 

 
    <%= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track' => true %> 
 
    <%= javascript_include_tag 'application', 'data-turbolinks' => true %> 
 
    <%= javascript_include_tag "https://www.google.com/jsapi", "chartkick" %> 
 
    <%= javascript_include_tag "https://cdnjs.cloudflare.com/ajax/libs/intro.js/2.1.0/intro.min.js", "data-turbolinks-track" => true %> 
 

 
    <%= csrf_meta_tags %> 
 
    <%= render 'layouts/icons' %> 
 
    <%= render 'layouts/shim' %> 
 
    <%= render 'layouts/google_SEO' %> 
 
    <%= render 'layouts/facebook_tags' %> 
 
    <%= render 'layouts/stripe_includes' %> 
 

 
    <%= display_meta_tags :site => 'MEANS Database' %> 
 
    <% if content_for?(:head) %> 
 
    <%= yield(:head) %> 
 
    <% end %> 
 
</head> 
 
<body class='<%= controller.controller_name %>'> 
 

 
<!-- Modal --> 
 
      <div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel"> 
 
       <div class="modal-dialog" role="document"> 
 
       <div class="modal-content"> 
 
        <div class="modal-header"> 
 
        <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button> 
 
        <h4 class="modal-title" id="myModalLabel">Quick Login</h4> 
 
        </div> 
 
        <div class="modal-body"> 
 

 
        <%= form_for(resource, as: resource_name, url: session_path(resource_name)) do |f| %> 
 

 
         <%= f.label :email %> 
 
         <%= f.email_field :email, autofocus: true, class: 'form-control', id:'modal-email' %> 
 

 
         <%= f.label :password %> 
 
         <%= f.password_field :password, autocomplete: "off", class: 'form-control' %> 
 

 
         <% if devise_mapping.rememberable? -%> 
 
         <div class="field"> 
 
          <%= f.check_box :remember_me %> 
 
          <%= f.label :remember_me %> 
 
         </div> 
 
         <% end -%> 
 

 
         <%= f.submit "Log in", class: "btn btn-primary" %> 
 
         <button type="button" class="btn btn-default" data-dismiss="modal">Close</button> 
 
         <% end %> 
 
        Having trouble logging in? Go to the full <%= link_to "LOG IN", new_user_session_path %> page for more options. 
 
        </div> 
 
        <div class="modal-footer"> 
 
        </div> 
 
       </div> 
 
       </div> 
 
      </div> 
 
<%= render 'layouts/messages' %> 
 
<%= render 'layouts/header' %> 
 
<div class="container-fluid"> 
 
    <%= yield %> 
 
    <%= render 'layouts/developer' if (Rails.env.development? || (current_user && current_user.developer == true)) %> 
 
</div> 
 

 
<%= render 'layouts/footer' %> 
 

 
</body> 
 

 
</html>

<a href='#' class="dropdown-toggle" data-toggle="dropdown" aria-expanded="false">

enter image description here

這些是我在控制檯上遇到的錯誤。

enter image description here

+1

分享完整的代碼,因爲你的問題沒有它的時候不清楚。 – Aslam

+1

嘗試使用瀏覽器的控制檯,看看你得到什麼錯誤 – Chiller

+0

對我來說工作得很好。可能是因爲某些其他庫而面臨JQuery衝突,如果是這樣的話...... – zed

回答

0

你的問題可能是由於Turbolinks。你很可能在這裏找到你的答案Bootstrap 3 dropdown doesn't work with Rails 4 & Turbolinks

+0

但是如果設置'data-turbolinks-track'=> false,它將從整個應用程序中刪除。 –

+0

您不需要完全刪除turbolinks,只需檢查它是如何設置的。如果您在整個應用程序中完全禁用turbolink,那麼下拉按預期工作? – petecss

+0

沒有它仍然無法正常工作 –