我需要在Spree的Admin后端添加一个列到表中。每个<tr>上都有一个数据挂钩。
所以从理论上讲,我可以在每一行上插入一个<td> (还可以在<thead>中插入一个<th>,在<colgroup>中插入一个<col> )。
这是最好的方法,还是有更好的方法?
发布于 2013-09-12 13:46:23
在新的.deface DSL中,使用几个小文件就可以相当容易地实现这一点。例如,使用HAML (假设Spree::Order有一个名为distributor的自定义属性)
标题:
/ insert_top "[data-hook='admin_orders_index_headers']"
%th
Distributor行:
/ insert_top "[data-hook='admin_orders_index_rows']"
%td.align-center
= order.distributor.name如果你想改变列宽,覆盖colgroup通常更简单:
/ replace_contents "table#listing_orders colgroup"
%col{style: "width: 10%"}
...etchttps://stackoverflow.com/questions/18755430
复制相似问题