Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/82.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 Rails4+Bootstrap3-模态渲染但不显示_Javascript_Jquery_Ruby On Rails_Twitter Bootstrap_Modal Dialog - Fatal编程技术网

Javascript Rails4+Bootstrap3-模态渲染但不显示

Javascript Rails4+Bootstrap3-模态渲染但不显示,javascript,jquery,ruby-on-rails,twitter-bootstrap,modal-dialog,Javascript,Jquery,Ruby On Rails,Twitter Bootstrap,Modal Dialog,我使用的是Rails 4,Bootstrap 3。讨论中的特定页面由3个haml视图组成。第一个包含大部分页面内容。第二个包含一行按钮-其中一个需要触发模式。第三部分是情态动词 第一个视图的代码是: <...bulk of page content...> = render partial: 'shared/buttons', locals: {diagram: @diagram} #showDetail.modal.fade{"aria-labelledby

我使用的是Rails 4,Bootstrap 3。讨论中的特定页面由3个haml视图组成。第一个包含大部分页面内容。第二个包含一行按钮-其中一个需要触发模式。第三部分是情态动词

第一个视图的代码是:

    <...bulk of page content...>
    = render partial: 'shared/buttons', locals: {diagram: @diagram}
    #showDetail.modal.fade{"aria-labelledby" => "showDetail", :role => dialog, :tabindex => "-1"}
因此,在这个设置中,单击按钮会产生页面淡入淡出,就像模态将要出现一样,但它永远不会出现。再次单击任意位置会使页面淡入淡出状态,就像显示模式一样。rails服务器日志显示模式确实呈现:

2016-02-22 14:49:44-0600开始获取127.0.0.1的GET/items/4/show_详细信息 ItemsControllershow\u细节为JS的处理 参数:{id=>4} 用户加载2.1ms从用户中选择用户。*其中users.id=1 ORDER BY users.id ASC LIMIT 1 Item Load 1.5ms选择items.*从items.type中输入'Item'和items.id=$1限制1[[id,4]] 渲染项/_show_detail.html.haml 1.1ms 在11ms视图中完成200 OK:4.7ms |活动记录:3.6ms


我错过了什么?视图之间的调用是否正确?

通过为第一个视图添加代码来修复此问题:

    <...bulk of page content...>
    = render partial: 'shared/buttons', locals: {diagram: @diagram}
    #showDetail.modal.fade{"aria-labelledby" => "showDetail", :role => dialog, :tabindex => "-1"}
      = render partial 'items/show_detail'
这将调用modal,所有操作都按预期进行

    .modal-dialog{:role => "document}
      .my_popup_contain
        .container-fluid
          <...rest of the code for the page...>
    def show_detail
      render partial: "show_detail"
    end
    <...bulk of page content...>
    = render partial: 'shared/buttons', locals: {diagram: @diagram}
    #showDetail.modal.fade{"aria-labelledby" => "showDetail", :role => dialog, :tabindex => "-1"}
      = render partial 'items/show_detail'