【问题标题】:How to use mail_to tag in rails 4 using haml?如何使用haml在rails 4中使用mail_to标签?
【发布时间】:2018-01-30 04:39:10
【问题描述】:

我想在 haml 中将 mailto 与我的 rails 4 一起使用,rails i8n 也是如此。我试过这样做

%a{href: Content.email, mailto: true, target: '_blank'}
= t :footer_email_us

但是,通过这种方式,当我单击链接时,我在收件人字段中附加了错误的电子邮件 ID。

【问题讨论】:

  • 试试这个:= mail_to "#{Content.email}", "#{Content.email}", target: '_blank'
  • 为什么两次Content.email,我的文字来自国际化,
  • 谢谢@Sunny,但我显示的文本来自rails i8n,你知道我怎样才能使用上面的文本给出它。
  • 来自 rails i18n 的文本是什么?

标签: html ruby-on-rails-4 haml mailto


【解决方案1】:

我找到了正确的方法,使用国际化文本。

= mail_to Content.email, t('footer_email_us')

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2010-11-15
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-06-30
    • 2011-10-27
    • 2015-01-15
    • 2020-06-02
    相关资源
    最近更新 更多