Bit of cleanup and improving mailer

This commit is contained in:
Dmitriy Zaporozhets 2012-12-31 19:46:40 +02:00
parent cf3f22cc99
commit ffe064a2c1
7 changed files with 16 additions and 13 deletions

View file

@ -148,12 +148,15 @@ class Notify < ActionMailer::Base
# >> @project = Project.last
# => #<Project id: 1, name: "Ruby on Rails", path: "ruby_on_rails", ...>
# >> subject('Lorem ipsum')
# => "GitLab | Lorem ipsum | Ruby on Rails"
# => "GitLab | Ruby on Rails | Lorem ipsum "
#
# # Accepts multiple arguments
# >> subject('Lorem ipsum', 'Dolor sit amet')
# => "GitLab | Lorem ipsum | Dolor sit amet"
def subject(*extra)
"GitLab | " << extra.join(' | ') << (@project ? " | #{@project.name_with_namespace}" : "")
subject = "GitLab"
subject << (@project ? " | #{@project.name_with_namespace}" : "")
subject << " | " + extra.join(' | ') if extra.present?
subject
end
end

View file

@ -13,10 +13,10 @@
%td{style: "font-size: 0px;", width: "20"}
\ 
%td{align: "left", style: "padding: 10px 0", width: "580"}
%h1{style: "font-size: 24px; color: #BBBBBB; font: normal 22px Helvetica, Arial, sans-serif; margin: 0; padding: 0; line-height: 32px;"}
%h1{style: "color: #BBBBBB; font: normal 20px Helvetica, Arial, sans-serif; margin: 0; padding: 0; line-height: 32px;"}
GITLAB
- if @project
&rarr; #{@project.name_with_namespace}
\/ #{@project.name_with_namespace}
%table{align: "center", bgcolor: "#fff", border: "0", cellpadding: "0", cellspacing: "0", style: "font-family: Helvetica, Arial, sans-serif; background: #fff;", width: "600"}
%tr= yield
%tr

View file

@ -1,8 +1,8 @@
%td.content{align: "left", style: "font-family: Helvetica, Arial, sans-serif; padding: 20px 0 0;", valign: "top", width: "600"}
%table{border: "0", cellpadding: "0", cellspacing: "0", style: "color: #717171; font: normal 11px Helvetica, Arial, sans-serif; margin: 0; padding: 0;", width: "600"}
%tr
%td{style: "font-size: 1px; line-height: 1px;", width: "21"}
%td{align: "left", style: "padding: 20px 0 0;"}
%td{width: "21"}
%td
%h2{style: "color:#646464; font-weight: bold; margin: 0; padding: 0; line-height: 26px; font-size: 18px; font-family: Helvetica, Arial, sans-serif; "}
= "Issue was #{@issue_status} by #{@updated_by.name}"
%td{style: "font-size: 1px; line-height: 1px;", width: "21"}

View file

@ -1,13 +1,13 @@
%td.content{align: "left", style: "font-family: Helvetica, Arial, sans-serif; padding: 20px 0 0;", valign: "top", width: "600"}
%table{border: "0", cellpadding: "0", cellspacing: "0", style: "color: #717171; font: normal 11px Helvetica, Arial, sans-serif; margin: 0; padding: 0;", width: "600"}
%tr
%td{style: "font-size: 1px; line-height: 1px;", width: "21"}
%td{align: "left", style: "padding: 20px 0 0;"}
%td{width: "21"}
%td
%h2{style: "color:#646464; font-weight: bold; margin: 0; padding: 0; line-height: 26px; font-size: 18px; font-family: Helvetica, Arial, sans-serif; "}
New Issue was created and assigned to you.
%td{style: "font-size: 1px; line-height: 1px;", width: "21"}
%td{width: "21"}
%tr
%td{style: "font-size: 1px; line-height: 1px;", width: "21"}
%td{width: "21"}
%td{align: "left", style: "padding: 20px 0 0;"}
%p{style: "color:#646464 !important; line-height: 26px; font-size: 16px; font-family: Helvetica, Arial, sans-serif; "}
= "Issue ##{@issue.id}"

View file

@ -2,7 +2,7 @@
%table{border: "0", cellpadding: "0", cellspacing: "0", style: "color: #717171; font: normal 11px Helvetica, Arial, sans-serif; margin: 0; padding: 0;", width: "600"}
%tr
%td{width: "21"}
%td{align: "left", style: "padding: 20px 0 0;"}
%td
%h2{style: "color:#646464; font-weight: normal;"}
- if @note.for_diff_line?
= link_to "New comment on diff", diffs_project_merge_request_url(@merge_request.project, @merge_request, anchor: "note_#{@note.id}")

View file

@ -2,7 +2,7 @@
%table{border: "0", cellpadding: "0", cellspacing: "0", style: "color: #717171; font: normal 11px Helvetica, Arial, sans-serif; margin: 0; padding: 0;", width: "600"}
%tr
%td{style: "font-size: 1px; line-height: 1px;", width: "21"}
%td{align: "left", style: "padding: 20px 0 0;"}
%td
%h2{style: "color:#646464; font-weight: bold; margin: 0; padding: 0; line-height: 26px; font-size: 18px; font-family: Helvetica, Arial, sans-serif; "}
= "Reassigned Issue ##{@issue.id}"
= link_to_gfm truncate(@issue.title, length: 30), project_issue_url(@issue.project, @issue)

View file

@ -60,7 +60,7 @@ describe Notify do
it_behaves_like 'an assignee email'
it 'has the correct subject' do
should have_subject /new issue ##{issue.id} \| #{issue.title} \| #{project.name}/
should have_subject /#{project.name} \| new issue ##{issue.id} \| #{issue.title}/
end
it 'contains a link to the new issue' do