简体   繁体   English

将CSS类添加到mail_to ruby​​ on rails helper

[英]Add CSS class to mail_to ruby on rails helper

I know that you can add HTML classes to link_to helpers like this: 我知道您可以像这样将HTML类添加到link_to帮助器:

<%= link_to 'Logout', logout_path, class: 'primary-link-style' %>

But what about the mail_to helper? 但是mail_to助手呢? There doesn't seem to be a way to add a HTML/CSS class like you can with the link_to helper. 似乎没有办法像使用link_to帮助程序那样添加HTML / CSS类。

The docs only talk about examples of inline styling which I want to avoid. 这些文档仅讨论我想避免的内联样式示例。

The method signature from the docs you linked to: 您链接到的文档的方法签名:

 mail_to(email_address, name = nil, html_options = {}, &block) 

That third argument, html_options , works just like the same argument of link_to : 第三个参数html_options就像link_to的相同参数一样工作:

<%= mail_to "foo@example.com", "Email me", class: "primary-link-style" %>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM