Rails link_to for destroy action: 如何传递参数,数据确认动作和instyle css
Rails link_to for destroy action: How to pass parameters, data confirmation action and instyle css
<%= link_to "[Delete]", customer_path(customer.id, :customer_delete => true), :method => :delete, :data => {:confirm => "Are You Sure?"} %>
我上面的代码工作正常,
但是如何给我的 link_to 一种颜色,在我看来是红色的? 尝试了很多堆栈溢出线程,但找不到解决方案,因为我的 link_to 包含组合功能,例如带传递参数的数据确认操作
将颜色属性赋予Link
1.新 link 和 css class
<%= link_to "[Delete]", customer_path(customer.id, :customer_delete => true), :method => :delete, :data => {:confirm => "Are You Sure?"}, :class => 'link' %>
application.css
.link {
color: red;
}
2。具有内联 css 样式的新 link
<%= link_to "[Delete]", customer_path(customer.id, :customer_delete => true), :method => :delete, :data => {:confirm => "Are You Sure?"}, :style => 'color: red;' %>
<%= link_to "[Delete]", customer_path(customer.id, :customer_delete => true), :method => :delete, :data => {:confirm => "Are You Sure?"} %>
我上面的代码工作正常,
但是如何给我的 link_to 一种颜色,在我看来是红色的? 尝试了很多堆栈溢出线程,但找不到解决方案,因为我的 link_to 包含组合功能,例如带传递参数的数据确认操作
将颜色属性赋予Link
1.新 link 和 css class
<%= link_to "[Delete]", customer_path(customer.id, :customer_delete => true), :method => :delete, :data => {:confirm => "Are You Sure?"}, :class => 'link' %>
application.css
.link {
color: red;
}
2。具有内联 css 样式的新 link
<%= link_to "[Delete]", customer_path(customer.id, :customer_delete => true), :method => :delete, :data => {:confirm => "Are You Sure?"}, :style => 'color: red;' %>