【问题标题】:HTML slim Email Templates for RailsRails 的 HTML slim 电子邮件模板
【发布时间】:2019-01-14 22:29:48
【问题描述】:

最近刚开始从事一个正在进行的项目,我需要为电子邮件布局集成模板。 我在 app/mailers/admin_mailer.rb 中有 admin_mailer.rb,其中包含以下内容:

class AdminMailer < ApplicationMailer

  before_action { @all_admins = AdminUser.all.pluck(:email) }
  default to: -> { @all_admins }

  def contact(contact_message)
    @message = contact_message.question
    @name = contact_message.name
    @email = contact_message.email
    mail subject: I18n.t('emails.contact_request', name: @name), from: @email
 end
end 

在 app/views/admin_mailer/contact.html.slim 我有

- content_for(:header) do
  title= t('emails.contact_request')


h2 #{@name} some text here
p sender: #{@name}
p email: #{@email}
br
p message: #{@message}

我搜索了 html.slim 电子邮件模板并遇到了这个:https://gist.github.com/mkhairi/7eee8bea87a63171563e 但无法使模板出现

如何将模板用于contact.html.slim 文件,以便更改布局。您是否碰巧知道其他可用于 ruby​​ on rails 的模板?

【问题讨论】:

  • 你找到解决办法了吗?

标签: ruby-on-rails email templates slim-lang


【解决方案1】:

在线有slim to html转换器。将其转换为html并保存在erb文件中。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2010-12-16
    • 1970-01-01
    • 2014-09-17
    • 2015-05-29
    • 2013-09-16
    • 2019-12-02
    • 2013-04-08
    • 2018-04-20
    相关资源
    最近更新 更多