0
Im和已經建立了這樣的代碼:更改DIV ID使用引導崩潰項目做環
<% @tasks.each do |task| %>
<div class="panel-group">
<div class="panel panel-default">
<div class="panel-heading">
<h4 class="panel-title">
<a data-toggle="collapse" href="#collapse1"><%= task.title %><p style="text-align:right;"><span class="glyphicon glyphicon-chevron-down"></span></p></a>
<p class="taskdescription"><%= task.description %></p>
</h4>
</div>
<div id="collapse1" class="panel-collapse collapse">
<ul class="list-group">
<% task.subtasks.each do |subtask| %>
<li class="list-group-item"><%= subtask.title %></li>
<% end %>
</ul>
</div>
</div>
</div>
<% end %>
這是輸出正確的名單,但每個項目我需要增加的價值DIV:
<div id="collapse1" class="panel-collapse collapse">
到
<div id="collapse2" class="panel-collapse collapse">
然後
<div id="collapse3" class="panel-collapse collapse">
等等,直到從集合中顯示每個項目。
感謝
'崩潰#{i}'不會做你想做的事,我想...... –