简体   繁体   中英

Mailboxer rails 4 Custom Views

Hi guys I am currently using the mailboxer gem and am wanting to customize the views for these renders

%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. Thanks.

Check your server logs. They should be placed in app/views/message_mailer/new_message_email.html.erb , etc

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.

Here is another sample app

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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