2014-12-08 159 views
1

我有AJAX模式窗口的問題。它只顯示灰色背景,但不顯示視圖。Ruby on Rails AJAX模式不顯示

鏈接模式窗口:

<%= link_to "Create Message", messages_path, remote: true, data: { toggle: "modal", target: "#ajax-modal" } %> 

<%= render 'messages/create' %> 

模態窗口(_create.html.erb):

<div id="ajax-modal" class="modal hide fade" tabindex="-1"> 

    <div class='modal-header'> 
    <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button> 
    <h3 class="modal-title">Žinutės siuntimas</h3> 
    </div> 

    <div class='modal-body'> 
    <div class="modal-body-content"></div> 
    <div class="ajax-loader"></div> 
    </div> 

    <div class='modal-footer'> 
    <button type="button" data-dismiss="modal" class="btn">Atšaukti</button> 
    </div> 
</div> 

我點擊鏈接,顯示爲灰色透明背景後,但不顯示模式窗...

有誰知道爲什麼?

+1

嘗試[Bootlint(https://github.com/twbs/bootlint)-ing您的頁面下一次;它會發現這個錯誤。 – cvrebert 2014-12-08 18:13:37

回答

0

您的模態的HTML格式錯誤,您缺少模態內容和模態對話框。

<div class="modal fade"> 
    <div class="modal-dialog"> 
    <div class="modal-content"> 
     <div class="modal-header"> 
     <button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">&times;</span><span class="sr-only">Close</span></button> 
     <h4 class="modal-title">Modal title</h4> 
     </div> 
     <div class="modal-body"> 
     <p>One fine body&hellip;</p> 
     </div> 
     <div class="modal-footer"> 
     <button type="button" class="btn btn-default" data-dismiss="modal">Close</button> 
     <button type="button" class="btn btn-primary">Save changes</button> 
     </div> 
    </div><!-- /.modal-content --> 
    </div><!-- /.modal-dialog --> 
</div><!-- /.modal --> 

Check this out for more information.