UX: In digest email lists of topics, show striped version of category

badge
This commit is contained in:
Robin Ward 2014-11-07 17:00:09 -05:00
parent 872cfff49b
commit bfe2021859
2 changed files with 11 additions and 4 deletions

View File

@ -68,10 +68,17 @@ module UserNotificationsHelper
return "" if category.uncategorized? && !opts[:show_uncategorized]
result = ""
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>"
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>"
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>"
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>"
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.html_safe
end
end

View File

@ -44,7 +44,7 @@
<li>
<%= link_to t.title, "#{Discourse.base_url}#{t.relative_url}" %>
<span class='post-count'><%= t('user_notifications.digest.posts', count: t.posts_count) %></span>
<%= email_category(t.category) %>
<%= email_category(t.category, only_stripe: true) %>
</li>
</ul>
<%- end -%>