CRMを作成中です。
顧客情報の一覧をリスト表示させたいのですが、idや業態などの項目が都度表示されて見栄えが悪いです。
Ruby
1<h1>顧客一覧</h1> 2<div class="main customers-index"> 3 <div class="container"> 4 <% @customers.each.with_index(1) do |customer, i| %> 5 <div class="customers-index-item"> 6 <table border="1"> 7 <thead> 8 <tr> 9 <th>id</th> 10 <th>会社名</th> 11 <th>業態</th> 12 <th>お客様名</th> 13 <th>担当者</th> 14 <th>備考</th> 15 <th></th> 16 </tr> 17 </thead> 18 <tbody> 19 <tr> 20 <td><%= i %></td> 21 <td><%= customer.company %></td> 22 <td><%= customer.category %></td> 23 <td><%= customer.name %></td> 24 <td><%= customer.staff %></td> 25 <td><%= customer.note %></td> 26 <td><%= link_to("詳細", "/customers/#{customer.id}") %></td> 27 </tr> 28 </tbody> 29 </table> 30 31 <% end %> 32 </div> 33 </div> 34</div> 35
こちらを下のスクショのように thead
の項目を最上段にのみ表示させるにはどうすればよいでしょうか?
基礎的な質問で恐縮ですがアドバイスお願いいたします。
何個か試したパターンを追記します
その1. <% @customers.each.with_index(1) do |customer, i| %>
を tbody
の下に入れる
その2. 上段にあった <div class="container">
<% @customers.each.with_index(1) do |customer, i| %>
<div class="customers-index-item">
をtbodyに入れる
回答2件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
2019/06/23 08:38
2019/06/23 08:38
2019/06/23 08:44
2019/06/23 08:57 編集