简体   繁体   English

邮箱滑轨4个自定义视图

[英]Mailboxer rails 4 Custom Views

Hi guys I am currently using the mailboxer gem and am wanting to customize the views for these renders 嗨,大家好,我目前使用的是mailer gem,并且想要自定义这些渲染器的视图

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

I would like to add a from and a link in the title of the email but dont know where the view is to edit it or where to generate it. 我想在电子邮件标题中添加“ from”和“ link”,但是不知道视图在哪里编辑或在哪里生成。 Thanks. 谢谢。

Check your server logs. 检查您的服务器日志。 They should be placed in app/views/message_mailer/new_message_email.html.erb , etc 它们应该放在app/views/message_mailer/new_message_email.html.erb等中

You can check this tutorial for custom views . 您可以在本教程中查看自定义视图

Controller 调节器

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

View 视图

<% @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 %>

then create a show.html.erb to see the full message. 然后创建show.html.erb以查看完整消息。

Here is another sample app 这是另一个示例应用程序

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

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