lundi 20 avril 2015

dynamic bootstrap tabs with rails

I am trying to get rails to generate dynamic navigation tabs that refer to groups user is enrolled at. Basically, what I want to achieve is to dynamically have tabs named after groups that user is enrolled at (which is working fine) and then showing the content of each group by clicking on its tab (which is not working properly for some reason). The page loads data correctly but toggling between tabs doesn't work

Here is the code in the view

<div class="tabbable tabs-left">
  <div class="row">
    <div class="col-md-4">
      <ul class="nav nav-pills nav-stacked">
        <% current_user.group.each do |group| %>
            <li><a href="#<%= group.name %>" data-toggle="tab">
            <%=group.name %></a></li>
        <% end %>
      </ul>
    </div>
    <div class="col-md-8">
      <div class="tab-content">
        <% current_user.group.each do |group| %>
            <div class="tab-pane fade <%= 'in active' if current_user.group.first == group %>" id="<%=group.name%>">
              <% if current_user.group_feed(group.id).any? %>
                  <ol class="microposts">
                    <%= render current_user.group_feed(group.id) %>
                    <%= group.name %>
                  </ol>
              <% end %>
            </div>
        <% end %>
      </div>
    </div>
  </div>
</div>

Is there something that I am missing?

Aucun commentaire:

Enregistrer un commentaire