From: Herve Saint-Amand Date: Wed, 25 Jan 2017 22:50:52 +0000 (+0000) Subject: Apply inline styling to all

tags X-Git-Tag: live~3640^2~5 X-Git-Url: https://git.openstreetmap.org/rails.git/commitdiff_plain/cf11913d586bf9c25f003f4acd3b114367fa4aa9 Apply inline styling to all

tags Solved the problem of

tags being given different padding or color by different clients, without having to copy-paste a string of CSS into every

tag in the templates. --- diff --git a/app/helpers/notifier_helper.rb b/app/helpers/notifier_helper.rb index 5889b6ff8..be01e5391 100644 --- a/app/helpers/notifier_helper.rb +++ b/app/helpers/notifier_helper.rb @@ -18,4 +18,8 @@ module NotifierHelper :locals => { :body => capture(&block) } ) end + + def apply_inline_css(html) + html.gsub /

/, '

' + end end diff --git a/app/views/layouts/notifier.html.erb b/app/views/layouts/notifier.html.erb index 8122125cb..8575424f2 100644 --- a/app/views/layouts/notifier.html.erb +++ b/app/views/layouts/notifier.html.erb @@ -1,6 +1,5 @@ - @@ -25,7 +24,7 @@
- <%= yield %> + <%= raw apply_inline_css(yield) %>
diff --git a/app/views/notifier/_message_body.html.erb b/app/views/notifier/_message_body.html.erb index a108643ce..723bb84e5 100644 --- a/app/views/notifier/_message_body.html.erb +++ b/app/views/notifier/_message_body.html.erb @@ -1,21 +1,17 @@ -
- <%# Some email clients (e.g. Yahoo as of 2017-01) remove the margin - on

tags. Since the body itself always starts with a

, by - wrapping the image here in a

as well, we ensure that they will at - least always be aligned with each other. %> -

- <%= link_to( - image_tag( - attachments["avatar.png"].url, - alt: @author, - title: @author - ), - user_url(@author, :host => SERVER_URL), - :target => "_blank" - ) %> -

+
+ <%= link_to( + image_tag( + attachments["avatar.png"].url, + alt: @author, + title: @author, + width: 50, + height: 50 + ), + user_url(@author, :host => SERVER_URL), + :target => "_blank" + ) %> <%= body %>