From 479a4bd0d7f9e3ece258634475fdc47f863c5c19 Mon Sep 17 00:00:00 2001 From: Herve Saint-Amand Date: Fri, 6 Jan 2017 22:37:28 +0000 Subject: [PATCH] First steps towards using layouts Since all HTML mails will presumably share the same overall layout, and the markup is fairly dense, it makes sense to use Rails layouts to share the structure across mail templates. This commit moves the core structure of the HTML mail to a layout. It will need to be further refined so that notifications that involve a text message sent by another user can share the avatar-and-message-text structure. --- app/views/layouts/notifier.html.erb | 47 ++++++++ .../changeset_comment_notification.html.erb | 106 ++++++------------ 2 files changed, 80 insertions(+), 73 deletions(-) create mode 100644 app/views/layouts/notifier.html.erb diff --git a/app/views/layouts/notifier.html.erb b/app/views/layouts/notifier.html.erb new file mode 100644 index 000000000..fb001d7c1 --- /dev/null +++ b/app/views/layouts/notifier.html.erb @@ -0,0 +1,47 @@ + + + + + + + + + + + + + +
+ + + + + + + + +
+ + <%= image_tag attachments["logo.png"].url, alt: "OpenStreetMap logo", title: "OpenStreetMap", height: "30", width: "30", border: "0" %> + + + +

OpenStreetMap

+
+
+ + + + +
+ <%= yield :body %> +
+
+
+ <%= yield :footer %> +

+ OpenStreetMap +

+
+ + diff --git a/app/views/notifier/changeset_comment_notification.html.erb b/app/views/notifier/changeset_comment_notification.html.erb index 6bb1b6811..344a4e33d 100644 --- a/app/views/notifier/changeset_comment_notification.html.erb +++ b/app/views/notifier/changeset_comment_notification.html.erb @@ -1,73 +1,33 @@ - - - - - - - - - - - - - -
- - - - - - - - -
- - <%= image_tag attachments["logo.png"].url, alt: "OpenStreetMap logo", title: "OpenStreetMap", height: "30", width: "30", border: "0" %> - - - -

OpenStreetMap

-
-
- - - - -
-

- <% if @owner %> - <%= raw t "notifier.changeset_comment_notification.commented.your_changeset", :commenter => link_to_user(@commenter), :time => @time %> - <% else %> - <%= raw t "notifier.changeset_comment_notification.commented.commented_changeset", :commenter => link_to_user(@commenter), :time => @time, :changeset_author => @changeset_author %> - <% end %> - <% if @changeset_comment %> - <%= raw t "notifier.changeset_comment_notification.commented.partial_changeset_with_comment", :changeset_comment => content_tag("em", @changeset_comment) %> - <% else %> - <%= t "notifier.changeset_comment_notification.commented.partial_changeset_without_comment" %> - <% end %> -

- - - - - -
- <%= image_tag attachments["avatar.png"].url, alt: @commenter %> - - <%= @comment.to_html %> -
-

- <%= raw t 'notifier.changeset_comment_notification.details', :url => content_tag("nobr", link_to(@changeset_url, @changeset_url)) %> -

-
-
-
-

- <%= raw t 'notifier.changeset_comment_notification.unsubscribe', :url => content_tag("nobr", link_to(@changeset_url, @changeset_url, :style => "color: #222")) %> -

-

- OpenStreetMap -

-
- - +<% content_for :body do %> +

+ <% if @owner %> + <%= raw t "notifier.changeset_comment_notification.commented.your_changeset", :commenter => link_to_user(@commenter), :time => @time %> + <% else %> + <%= raw t "notifier.changeset_comment_notification.commented.commented_changeset", :commenter => link_to_user(@commenter), :time => @time, :changeset_author => @changeset_author %> + <% end %> + <% if @changeset_comment %> + <%= raw t "notifier.changeset_comment_notification.commented.partial_changeset_with_comment", :changeset_comment => content_tag("em", @changeset_comment) %> + <% else %> + <%= t "notifier.changeset_comment_notification.commented.partial_changeset_without_comment" %> + <% end %> +

+ + + + + +
+ <%= image_tag attachments["avatar.png"].url, alt: @commenter %> + + <%= @comment.to_html %> +
+

+ <%= raw t 'notifier.changeset_comment_notification.details', :url => content_tag("nobr", link_to(@changeset_url, @changeset_url)) %> +

+<% end %> + +<% content_for :footer do %> +

+ <%= raw t 'notifier.changeset_comment_notification.unsubscribe', :url => content_tag("nobr", link_to(@changeset_url, @changeset_url, :style => "color: #222")) %> +

+<% end %> -- 2.39.5