【发布时间】:2016-03-07 06:27:21
【问题描述】:
我正在尝试格式化此列表,以便每个单独的部分(名称、饮食、运行 # 和所有者)分开并具有相同的边距。我想我必须在_patient.html.erb 中更改一些内容,但我不确定如何。
我现在的_patient.html.erb
<li>
<%= link_to patient.name + " #{patient.owner.last_name} ", patient %>
<%= link_to patient.diet, patient, style: "color:red;" %>
<% if patient.stays.length > 0 %>
<%= Runn.find_by_id(patient.stays.last.runn_id).ident %>
<% end %>
(Owned by <%= link_to "#{patient.owner.first_name} #{patient.owner.last_name}", patient.owner %>)
</li>
这是index.html.erb
<h1>Patients</h1>
<div>
<%= link_to "Generate Feed List", new_feed_list_path, class: "btn btn-lg btn-primary"%>
</div>
<% provide(:title, 'All patients') %>
<%= will_paginate %>
<ul class="patients">
<%= render @patients %>
</ul>
<%= will_paginate %>
【问题讨论】:
-
你不使用桌子有什么原因吗?
-
这是我的第一个 Rails 项目,所以我边走边学
-
我现在看看表格
-
@Yang 表格如何让响应变得更加困难? OP 似乎正在使用 Bootstrap,其中包括 responsive tables。即使你没有使用 Bootstrap,it's quite easy to make a table responsive
-
@JoeKennedy 响应式表格的原理是在屏幕太小无法显示所有列时隐藏其中的一些。不能像使用
<div>、<span>那样将它们向下移动。
标签: html css ruby-on-rails