From c94213847b8e5b71864b34748ba9fadaefbfddfe Mon Sep 17 00:00:00 2001 From: Herve Saint-Amand Date: Fri, 13 Jan 2017 22:43:23 +0000 Subject: [PATCH] Simplified the partial layout Rather than wrap the body in a :body block, just make it the default, unnamed block, which keeps the markup more lightweight. --- app/views/layouts/notifier.html.erb | 2 +- .../changeset_comment_notification.html.erb | 44 +++++++++---------- .../diary_comment_notification.html.erb | 20 ++++----- app/views/notifier/email_confirm.html.erb | 10 ++--- .../notifier/friend_notification.html.erb | 16 +++---- app/views/notifier/gpx_failure.html.erb | 28 ++++++------ app/views/notifier/gpx_success.html.erb | 12 +++-- app/views/notifier/lost_password.html.erb | 10 ++--- .../notifier/message_notification.html.erb | 26 +++++------ .../note_comment_notification.html.erb | 22 +++++----- app/views/notifier/signup_confirm.html.erb | 12 +++-- 11 files changed, 91 insertions(+), 111 deletions(-) diff --git a/app/views/layouts/notifier.html.erb b/app/views/layouts/notifier.html.erb index fb001d7c1..3b8ce6657 100644 --- a/app/views/layouts/notifier.html.erb +++ b/app/views/layouts/notifier.html.erb @@ -25,7 +25,7 @@
- <%= yield :body %> + <%= yield %>
diff --git a/app/views/notifier/changeset_comment_notification.html.erb b/app/views/notifier/changeset_comment_notification.html.erb index 0ebacf40e..0d97b402a 100644 --- a/app/views/notifier/changeset_comment_notification.html.erb +++ b/app/views/notifier/changeset_comment_notification.html.erb @@ -1,29 +1,27 @@ -<% content_for :body do %> -

- <%= t'notifier.changeset_comment_notification.hi', :to_user => @to_user %> -

+

+ <%= t'notifier.changeset_comment_notification.hi', :to_user => @to_user %> +

-

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

+

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

- <%= render "notifier/user_message_table", :captured => capture { %> - <%= @comment.to_html %> - <% } %> +<%= render "notifier/user_message_table", :captured => capture { %> + <%= @comment.to_html %> +<% } %> -

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

-<% end %> +

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

<% content_for :footer do %>

diff --git a/app/views/notifier/diary_comment_notification.html.erb b/app/views/notifier/diary_comment_notification.html.erb index ea9a65591..e37f682a3 100644 --- a/app/views/notifier/diary_comment_notification.html.erb +++ b/app/views/notifier/diary_comment_notification.html.erb @@ -1,15 +1,13 @@ -<% content_for :body do %> -

- <%= t'notifier.diary_comment_notification.hi', :to_user => @to_user %> -

-

- <%= raw t'notifier.diary_comment_notification.header', :from_user => link_to_user(@from_user), :subject => content_tag("em", @title) %> -

+

+ <%= t'notifier.diary_comment_notification.hi', :to_user => @to_user %> +

+

+ <%= raw t'notifier.diary_comment_notification.header', :from_user => link_to_user(@from_user), :subject => content_tag("em", @title) %> +

- <%= render "notifier/user_message_table", :captured => capture { %> - <%= @text.to_html %> - <% } %> -<% end %> +<%= render "notifier/user_message_table", :captured => capture { %> + <%= @text.to_html %> +<% } %> <% content_for :footer do %>

<%= raw t'notifier.diary_comment_notification.footer', diff --git a/app/views/notifier/email_confirm.html.erb b/app/views/notifier/email_confirm.html.erb index 5c639d57f..2afbfcbf6 100644 --- a/app/views/notifier/email_confirm.html.erb +++ b/app/views/notifier/email_confirm.html.erb @@ -1,9 +1,7 @@ -<% content_for :body do %> -

<%= t 'notifier.email_confirm_html.greeting' %>

+

<%= t 'notifier.email_confirm_html.greeting' %>

-

<%= t 'notifier.email_confirm_html.hopefully_you', :server_url => SERVER_URL, :new_address => @address %>

+

<%= t 'notifier.email_confirm_html.hopefully_you', :server_url => SERVER_URL, :new_address => @address %>

-

<%= t 'notifier.email_confirm_html.click_the_link' %>

+

<%= t 'notifier.email_confirm_html.click_the_link' %>

-

<%= @url %>

-<% end %> +

<%= @url %>

diff --git a/app/views/notifier/friend_notification.html.erb b/app/views/notifier/friend_notification.html.erb index 3f260dc92..91de4b732 100644 --- a/app/views/notifier/friend_notification.html.erb +++ b/app/views/notifier/friend_notification.html.erb @@ -1,11 +1,9 @@ -<% content_for :body do %> -

<%= t 'notifier.friend_notification.had_added_you', :user => @friend.befriender.display_name %>

+

<%= t 'notifier.friend_notification.had_added_you', :user => @friend.befriender.display_name %>

- <%= render "notifier/user_message_table", :captured => capture { %> -

<%= raw t 'notifier.friend_notification.see_their_profile', :userurl => link_to(@viewurl, @viewurl) %>

+<%= render "notifier/user_message_table", :captured => capture { %> +

<%= raw t 'notifier.friend_notification.see_their_profile', :userurl => link_to(@viewurl, @viewurl) %>

- <% unless @friend.befriendee.is_friends_with?(@friend.befriender) -%> -

<%= raw t 'notifier.friend_notification.befriend_them', :befriendurl => link_to(@friendurl, @friendurl) %>

- <% end -%> - <% } %> -<% end %> + <% unless @friend.befriendee.is_friends_with?(@friend.befriender) -%> +

<%= raw t 'notifier.friend_notification.befriend_them', :befriendurl => link_to(@friendurl, @friendurl) %>

+ <% end -%> +<% } %> diff --git a/app/views/notifier/gpx_failure.html.erb b/app/views/notifier/gpx_failure.html.erb index d1319acbd..cc43905b2 100644 --- a/app/views/notifier/gpx_failure.html.erb +++ b/app/views/notifier/gpx_failure.html.erb @@ -1,18 +1,16 @@ -<% content_for :body do %> -

<%= t'notifier.gpx_notification.greeting' %>

+

<%= t'notifier.gpx_notification.greeting' %>

-

- <%= render :partial => "gpx_description" %> - <%= t'notifier.gpx_notification.failure.failed_to_import' %> -

+

+ <%= render :partial => "gpx_description" %> + <%= t'notifier.gpx_notification.failure.failed_to_import' %> +

-
- <%= @error %> -
+
+ <%= @error %> +
-

- <%= t'notifier.gpx_notification.failure.more_info_1' %> - <%= t'notifier.gpx_notification.failure.more_info_2' %> - <%= t'notifier.gpx_notification.failure.import_failures_url' %> -

-<% end %> +

+ <%= t'notifier.gpx_notification.failure.more_info_1' %> + <%= t'notifier.gpx_notification.failure.more_info_2' %> + <%= t'notifier.gpx_notification.failure.import_failures_url' %> +

diff --git a/app/views/notifier/gpx_success.html.erb b/app/views/notifier/gpx_success.html.erb index 97267944e..8e2408845 100644 --- a/app/views/notifier/gpx_success.html.erb +++ b/app/views/notifier/gpx_success.html.erb @@ -1,8 +1,6 @@ -<% content_for :body do %> -

<%= t'notifier.gpx_notification.greeting' %>

+

<%= t'notifier.gpx_notification.greeting' %>

-

- <%= render :partial => "gpx_description" %> - <%= t'notifier.gpx_notification.success.loaded_successfully', :trace_points => @trace_points, :possible_points => @possible_points %> -

-<% end %> +

+ <%= render :partial => "gpx_description" %> + <%= t'notifier.gpx_notification.success.loaded_successfully', :trace_points => @trace_points, :possible_points => @possible_points %> +

diff --git a/app/views/notifier/lost_password.html.erb b/app/views/notifier/lost_password.html.erb index 17862df67..520d1097a 100644 --- a/app/views/notifier/lost_password.html.erb +++ b/app/views/notifier/lost_password.html.erb @@ -1,9 +1,7 @@ -<% content_for :body do %> -

<%= t 'notifier.lost_password_html.greeting' %>

+

<%= t 'notifier.lost_password_html.greeting' %>

-

<%= t 'notifier.lost_password_html.hopefully_you' %>

+

<%= t 'notifier.lost_password_html.hopefully_you' %>

-

<%= t 'notifier.lost_password_html.click_the_link' %>

+

<%= t 'notifier.lost_password_html.click_the_link' %>

-

<%= @url %>

-<% end %> +

<%= @url %>

diff --git a/app/views/notifier/message_notification.html.erb b/app/views/notifier/message_notification.html.erb index 823f1487a..7a4ac66a5 100644 --- a/app/views/notifier/message_notification.html.erb +++ b/app/views/notifier/message_notification.html.erb @@ -1,18 +1,16 @@ -<% content_for :body do %> -

- <%= t'notifier.message_notification.hi', :to_user => @to_user %> -

-

- <%= raw t'notifier.message_notification.header', - :from_user => link_to_user(@from_user), - :subject => content_tag("em", @title) - %> -

+

+ <%= t'notifier.message_notification.hi', :to_user => @to_user %> +

+

+ <%= raw t'notifier.message_notification.header', + :from_user => link_to_user(@from_user), + :subject => content_tag("em", @title) + %> +

- <%= render "notifier/user_message_table", :captured => capture { %> - <%= @text.to_html %> - <% } %> -<% end %> +<%= render "notifier/user_message_table", :captured => capture { %> + <%= @text.to_html %> +<% } %> <% content_for :footer do %>

diff --git a/app/views/notifier/note_comment_notification.html.erb b/app/views/notifier/note_comment_notification.html.erb index ab4378fa2..88b8f9603 100644 --- a/app/views/notifier/note_comment_notification.html.erb +++ b/app/views/notifier/note_comment_notification.html.erb @@ -1,15 +1,13 @@ -<% content_for :body do %> -

<%= t 'notifier.note_comment_notification.greeting' %>

+

<%= t 'notifier.note_comment_notification.greeting' %>

- <% if @owner %> -

<%= raw t "notifier.note_comment_notification.#{@event}.your_note", :commenter => link_to_user(@commenter), :place => @place %>

- <% else %> -

<%= raw t "notifier.note_comment_notification.#{@event}.commented_note", :commenter => link_to_user(@commenter), :place => @place %>

- <% end %> +<% if @owner %> +

<%= raw t "notifier.note_comment_notification.#{@event}.your_note", :commenter => link_to_user(@commenter), :place => @place %>

+<% else %> +

<%= raw t "notifier.note_comment_notification.#{@event}.commented_note", :commenter => link_to_user(@commenter), :place => @place %>

+<% end %> - <%= render "notifier/user_message_table", :captured => capture { %> - <%= @comment.to_html %> - <% } %> +<%= render "notifier/user_message_table", :captured => capture { %> + <%= @comment.to_html %> +<% } %> -

<%= raw t 'notifier.note_comment_notification.details', :url => link_to(@noteurl, @noteurl) %>

-<% end %> +

<%= raw t 'notifier.note_comment_notification.details', :url => link_to(@noteurl, @noteurl) %>

diff --git a/app/views/notifier/signup_confirm.html.erb b/app/views/notifier/signup_confirm.html.erb index 6e7f7280e..557fef830 100644 --- a/app/views/notifier/signup_confirm.html.erb +++ b/app/views/notifier/signup_confirm.html.erb @@ -1,11 +1,9 @@ -<% content_for :body do %> -

<%= t("notifier.signup_confirm.greeting") %>

+

<%= t("notifier.signup_confirm.greeting") %>

-

<%= t("notifier.signup_confirm.created", :site_url => SERVER_URL) %>

+

<%= t("notifier.signup_confirm.created", :site_url => SERVER_URL) %>

-

<%= t("notifier.signup_confirm.confirm") %>

+

<%= t("notifier.signup_confirm.confirm") %>

-

<%= link_to @url, @url, :style => "white-space: nowrap" %>

+

<%= link_to @url, @url, :style => "white-space: nowrap" %>

-

<%= t("notifier.signup_confirm.welcome") %>

-<% end %> +

<%= t("notifier.signup_confirm.welcome") %>

-- 2.43.2