我正在尝试向 Spree admin 添加几行代码。
我想覆盖的文件:
backend/app/views/spree/admin/orders/_shipment.html.erb
我想在这里添加它:
<tr class="show-tracking total">
<td colspan="5" class="tracking-value">
<% if shipment.tracking.present? %>
<strong><%= Spree.t(:tracking) %>:</strong> <%= shipment.tracking %>
<% else %>
<%= Spree.t(:no_tracking_present) %>
<% end %>
</td>
</tr>
我的覆盖是:
<!-- insert_after '.tracking-value' -->
</br>
<strong><%= Spree.t(:is_delivered) %>: </strong><%= shipment.is_delivered %></br>
<% if shipment.date_delivered? %>
<strong><%= Spree.t(:date_delivered) %>: </strong><%= shipment.date_delivered %></br>
<% end %>
位于app/overrides/spree/admin/orders/shipment/add_tracking_info.html.erb.deface
内容:
</br>
<strong><%= Spree.t(:is_delivered) %>: </strong><%= shipment.is_delivered %></br>
<% if shipment.date_delivered? %>
<strong><%= Spree.t(:date_delivered) %>: </strong><%= shipment.date_delivered %></br>
<% end %>
我想渲染:
<tr class="show-tracking total">
<td colspan="5" class="tracking-value">
<% if shipment.tracking.present? %>
<strong><%= Spree.t(:tracking) %>:</strong> <%= shipment.tracking %>
</br>
<strong><%= Spree.t(:is_delivered) %>: </strong><%= shipment.is_delivered %</br>
<% if shipment.date_delivered? %>
<strong><%= Spree.t(:date_delivered) %>: </strong><%= shipment.date_delivered %></br>
<% end %>
<% else %>
<%= Spree.t(:no_tracking_present) %>
<% end %>
</td>
</tr>
任何有关此问题的帮助将不胜感激,非常感谢!