UX: Link categories in digest emails

This commit is contained in:
Robin Ward 2014-11-28 13:44:40 -05:00
parent a85a3da167
commit 37a3e956b6
2 changed files with 7 additions and 5 deletions

View File

@ -69,14 +69,16 @@ module UserNotificationsHelper
result = ""
category_url = "#{Discourse.base_url}#{category.url}"
if opts[:only_stripe]
result << "<span style='background-color: ##{category.color}; font-size: 12px; padding: 4px 2px; font-weight: bold; margin: 0; width: 2px; white-space:nowrap;'>&nbsp;</span>"
result << "<span style='font-size: 12px; font-weight: bold; margin-left: 3px;'>#{category.name}</span>"
result << "<a href='#{category_url}' style='background-color: ##{category.color}; font-size: 12px; padding: 4px 2px; font-weight: bold; margin: 0; width: 2px; white-space:nowrap;'>&nbsp;</a>"
result << "<a href='#{category_url}' style='font-size: 12px; font-weight: bold; margin-left: 3px;'>#{category.name}</a>"
else
if category.parent_category.present?
result << "<span style='background-color: ##{category.parent_category.color}; font-size: 12px; padding: 4px 2px; font-weight: bold; margin: 0; width: 2px; white-space:nowrap;'>&nbsp;</span>"
result << "<a href='#{category_url}' style='background-color: ##{category.parent_category.color}; font-size: 12px; padding: 4px 2px; font-weight: bold; margin: 0; width: 2px; white-space:nowrap;'>&nbsp;</a>"
end
result << "<span style='background-color: ##{category.color}; color: ##{category.text_color}; font-size: 12px; padding: 4px 6px; font-weight: bold; margin: 0; white-space:nowrap;'>#{category.name}</span>"
result << "<a href='#{category_url}' style='background-color: ##{category.color}; color: ##{category.text_color}; font-size: 12px; padding: 4px 6px; font-weight: bold; margin: 0; white-space:nowrap;'>#{category.name}</a>"
end
result.html_safe

View File

@ -58,7 +58,7 @@
<div>
<%- @new_by_category.each do |c| %>
<span style='white-space: nowrap'>
<b><%= c[0].name %></b> <span style='color: #777; margin: 0 10px 0 5px; font-size: 0.9em;'> <%= c[1] %></span>
<a href='<%= Discourse.base_url %><%= c[0].url %>' style='color: #333'><%= c[0].name %></b> <span style='color: #777; margin: 0 10px 0 5px; font-size: 0.9em;'> <%= c[1] %></span>
</span>
<%- end %>
</div>