This is an automated email from the ASF dual-hosted git repository.
rubys pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/whimsy.git
The following commit(s) were added to refs/heads/master by this push:
new 6f6210f convert to a template
6f6210f is described below
commit 6f6210f73887955b92b3c22d1a7a91a1db5c77b5
Author: Sam Ruby <[email protected]>
AuthorDate: Wed Jan 15 12:57:20 2020 -0500
convert to a template
---
www/board/agenda/templates/remind-action.txt | 10 ++++++++++
www/board/agenda/views/actions/remind-actions.json.rb | 10 +++-------
2 files changed, 13 insertions(+), 7 deletions(-)
diff --git a/www/board/agenda/templates/remind-action.txt
b/www/board/agenda/templates/remind-action.txt
new file mode 100644
index 0000000..661c034
--- /dev/null
+++ b/www/board/agenda/templates/remind-action.txt
@@ -0,0 +1,10 @@
+<% if actions.length == 1 %>
+The following action needs your attention:
+<% else %>
+The following actions need your attention:
+<% end %>
+<% for action in actions %>
+
+* <%= action['text'] %>
+ <%= "[ #{action['pmc']} #{action['date']} ]" %>
+<% end %>
diff --git a/www/board/agenda/views/actions/remind-actions.json.rb
b/www/board/agenda/views/actions/remind-actions.json.rb
index 6690300..115ff7f 100644
--- a/www/board/agenda/views/actions/remind-actions.json.rb
+++ b/www/board/agenda/views/actions/remind-actions.json.rb
@@ -25,6 +25,8 @@ unless from
from = "#{sender.public_name.inspect} <#{sender.id}@apache.org>".untaint
end
+template = File.read("templates/remind-action.txt")
+
# iterate over the action items
@actions.group_by {|action| action['owner']}.each do |owner, actions|
person = ASF::Person[name_map[owner]]
@@ -35,12 +37,6 @@ end
next
end
- body = "The following action items need your attention:\n"
- body.sub!('items need', 'item needs') if actions.length == 1
- body += actions.map do |action|
- "\n* #{action['text']}\n [ #{action['pmc']} #{action['date']} ]\n"
- end.join
-
# construct email
mail = Mail.new do
from from
@@ -48,7 +44,7 @@ end
cc "[email protected]"
subject 'Action Item reminder'
- body body
+ body Erubis::Eruby.new(template).result(binding)
end
# deliver mail