如何在 ERB 文件中的 link_to 标签旁边放置一个复选框,当我们选中一个复选框时,我们应该获取 ERB 的 link_to 标签的值?
How to place a checkbox next to a link_to tag in ERB file and when we check a box we should get the values of link_to tag of ERB?
前端看起来像这样,如果我 select 复选框并单击 ClickMe 按钮,它应该只给出 href of only checked ones
<td class='actions actions-1 my-files' data-hook="admin_orders_index_row_actions">
<% doc = Spree::BookkeepingDocument.where(printable: shipment.order).last %>
<% if doc %>
<%= link_to_with_icon "file", "", admin_bookkeeping_document_path(doc, format: :pdf), title: "Download Invoice" %>
<input type="checkbox" name="files" class="check"/>`
<span>
<input type="checkbox" value="<%= admin_bookkeeping_document_path(doc, format: :pdf)%>" name="my-files" style="margin-left: 30%;">
</span>
添加此代码段并在 link_to
标记之后和复选框属性值中给出 link_to
标记值的值。
前端看起来像这样,如果我 select 复选框并单击 ClickMe 按钮,它应该只给出 href of only checked ones
<td class='actions actions-1 my-files' data-hook="admin_orders_index_row_actions">
<% doc = Spree::BookkeepingDocument.where(printable: shipment.order).last %>
<% if doc %>
<%= link_to_with_icon "file", "", admin_bookkeeping_document_path(doc, format: :pdf), title: "Download Invoice" %>
<input type="checkbox" name="files" class="check"/>`
<span>
<input type="checkbox" value="<%= admin_bookkeeping_document_path(doc, format: :pdf)%>" name="my-files" style="margin-left: 30%;">
</span>
添加此代码段并在 link_to
标记之后和复选框属性值中给出 link_to
标记值的值。