我正在使用rails的content_for标签,但我想知道是否有办法模拟这个:
- content_for (:modal) do
= render 'agreements/edit'
关于javascript,因为我现在有这个:
- @agreements.each do |agreement|
%tr{id: agreement.id}
%td
%p.agreement-discount= agreement.amount
%td
%p.agreement-name= agreement.name
%td
%p.agreement-size= agreement.total_students
%td
%p.agreement-size= agreement.agreement_service_students.active.size
%td
%a.button-assign{value: "#{agreement.id}"}
%p.blue-text= t('service.button_assign')
%td.table-options-icons
- if agreement.is_assigned?
.col-xs-12
%p.icon-full-info-full{ title: t("message.fail_edit_destroy_agreement")}
- else
.col-xs-6
%a.icon-full-pen-full.js-edit-agreement{href: "#", id: "#{agreement.id}"}
.col-xs-6
= link_to agreement, method: :delete, id: "agreement-destroy-#{agreement.id}",
data: { confirm: t('confirm_delete.agreement', agreement: agreement.name) } do
.icon-full-trash-full.small-profile
- content_for (:modal) do
= render 'agreements/edit'
如果我删除了content_for标记,则模态将无法打开。
谢谢!