在Rails中使用部分视图时不会触发下拉列表

时间:2018-01-19 14:39:41

标签: ruby-on-rails

我的索引中有以下内容:

<div class="btn-group wkt-btn-group">
  <button type="button" class="btn share dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">SHARE
      <span class="fa fa-angle-down" style="font-size:16px;"></span>
      </button>
  <% render partial: 'booksocial',  locals: {book: book} %>
</div>

然后在我的部分:

<ul class="dropdown-menu wk-social">
<li>
    <div class="jssocials-share jssocials-share-email">
        <a href="#" onclick="PrintImage('<%= image_url(book.book_image.to_c)%>'); return false;" class="jssocials-share-link" style="background-color: purple; width: 73px;">Print</a>
        <i class="jssocials-share-logo"></i>
    </div>
</li>
<li>
    <div class="jssocials-share jssocials-share-email">
        <a href="mailto:?Subject=I Like BIg Books&amp;Body=I%20saw%20this%20and%20thought%20of%20you!%20 http://books.com/book/<%= book.book_name %>" class="jssocials-share-link">
            <i class="fa fa-at jssocials-share-logo"></i><span class="jssocials-share-label">E-mail</span>
        </a>
    </div>

</li>

页面使用下拉按钮进行渲染,但实际上并未呈现下拉选项。我的代码中是否存在阻止列表呈现的内容?

1 个答案:

答案 0 :(得分:0)

很容易回答,我很惊讶没有人插话。我此刻并未实际输出部分内容。

<%= render partial: 'booksocial',  locals: {book: book} %>