【问题标题】:Mailboxer rails 4 Custom ViewsMailboxer rails 4 自定义视图
【发布时间】:2013-11-14 05:41:11
【问题描述】:

大家好,我目前正在使用mailboxer gem,并且想要自定义这些渲染的视图

%h2 Inbox
%ul= render mailbox.inbox
%hr 
%h2 Sentbox
%ul= render mailbox.sentbox
%hr 
%h2 Trash
%ul= render mailbox.trash

我想在电子邮件标题中添加发件人和链接,但不知道视图在哪里编辑或在哪里生成。谢谢。

【问题讨论】:

    标签: ruby-on-rails ruby-on-rails-4 mailboxer


    【解决方案1】:

    检查您的服务器日志。它们应该放在 app/views/message_mailer/new_message_email.html.erb

    【讨论】:

    • 这仅适用于通过电子邮件发送给用户的模板。
    【解决方案2】:

    您可以查看本教程以获取自定义views

    控制器

    def index
      @inbox ||= current_user.mailbox.inbox
    end 
    

    查看

    <% @inbox.each do |conversation| %>
      <%= conversation.originator.username%>
      <%= link_to  raw(truncate(strip_tags(conversation.subject), :length => 15)), conversation_path(conversation) %> 
      <%= link_to "", {:controller => "conversations", :action => "trash", :id => conversation.id}, :title=> "Move to Trash", :method=>'post', data: { confirm: '¿Estas seguro?' }, :class=> "btn btn btn-danger icon-remove" %>
      <%= conversation.updated_at%>
    <% end %>
    

    然后创建一个 show.html.erb 以查看完整消息。

    这是另一个sample app

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-12-13
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多