FIX: box style category badges in emails, and shrink text and some spacing in summary email

This commit is contained in:
Neil Lalonde 2016-12-09 16:59:54 -05:00
parent 24d2973108
commit 17bc42fe85
2 changed files with 28 additions and 21 deletions

View File

@ -6,7 +6,7 @@
<title></title>
</head>
<body style="-moz-box-sizing:border-box;-ms-text-size-adjust:100%;-webkit-box-sizing:border-box;-webkit-text-size-adjust:100%;box-sizing:border-box;color:#0a0a0a;font-family:Helvetica,Arial,sans-serif;font-size:16px;font-weight:400;line-height:1.3;margin:0;min-width:100%;padding:0;text-align:left;width:100%">
<body style="-moz-box-sizing:border-box;-ms-text-size-adjust:100%;-webkit-box-sizing:border-box;-webkit-text-size-adjust:100%;box-sizing:border-box;color:#0a0a0a;font-family:Helvetica,Arial,sans-serif;font-size:14px;font-weight:400;line-height:1.3;margin:0;min-width:100%;padding:0;text-align:left;width:100%">
<!--[if mso]>
<style type="text/css">
@ -31,7 +31,7 @@ body, table, td, th, h1, h2, h3 {font-family: Helvetica, Arial, sans-serif !impo
<tr>
<td align="center" style="text-align: center;padding: 20px 0; font-family:Helvetica,Arial,sans-serif;">
<a href="<%= Discourse.base_url %>" style="color:#<%= @header_color -%>;font-size:28px;text-decoration:none;">
<a href="<%= Discourse.base_url %>" style="color:#<%= @header_color -%>;font-size:22px;text-decoration:none;">
<%- if logo_url.blank? %>
<%= SiteSetting.title %>
<%- else %>
@ -44,7 +44,7 @@ body, table, td, th, h1, h2, h3 {font-family: Helvetica, Arial, sans-serif !impo
</table>
<%- end %>
<table class="body" style="width:100%;background:#f3f3f3;padding:0;border-spacing:0;font-family:Helvetica,Arial,sans-serif;font-size:16px;font-weight:200;line-height:1.3;vertical-align:top;">
<table class="body" style="width:100%;background:#f3f3f3;padding:0;border-spacing:0;font-family:Helvetica,Arial,sans-serif;font-size:14px;font-weight:200;line-height:1.3;vertical-align:top;">
<tr>
<td class="side-spacer" style="width:5%;vertical-align:top;padding:0;">
<div style="background-color:#2F70AC;">
@ -64,22 +64,22 @@ body, table, td, th, h1, h2, h3 {font-family: Helvetica, Arial, sans-serif !impo
<td style="border-collapse:collapse!important;color:#0a0a0a;line-height:1.3;margin:0;padding:0;text-align:left;vertical-align:top;word-wrap:normal">
<br/>
<center style="color:#fff;font-size:28px;font-weight:400;"><%=t 'user_notifications.digest.since_last_visit' %></center>
<center style="color:#fff;font-size:22px;font-weight:400;"><%=t 'user_notifications.digest.since_last_visit' %></center>
<table style="table-layout:fixed;margin-bottom:20px;padding:0;vertical-align:top;width:100%">
<table style="table-layout:fixed;margin:10px 0 20px 0;padding:0;vertical-align:top;width:100%">
<tbody>
<tr>
<%- @counts.each do |count| -%>
<td style="text-align:center;color:#fff;font-size:3em;font-weight:400;">
<td style="text-align:center;color:#fff;font-size:36px;font-weight:400;">
<a style="color:#fff;" href="<%= count[:href] -%>"><strong><%= count[:value] -%></strong></a>
</td>
<%- end -%>
</tr>
<tr>
<%- @counts.each do |count| -%>
<td style="color:#fff;font-size:16px;font-weight:400;text-align:center;">
<td style="color:#fff;font-size:14px;font-weight:400;text-align:center;">
<a style="color:#fff;" href="<%= count[:href] -%>"><strong><%=t count[:label_key] -%></strong></a>
</td>
<%- end -%>
@ -87,7 +87,7 @@ body, table, td, th, h1, h2, h3 {font-family: Helvetica, Arial, sans-serif !impo
</tbody>
</table>
<center style="color:#fff;font-size:28px;font-weight:400;margin-bottom: 8px;"><%=t 'user_notifications.digest.popular_topics' %></center>
<center style="color:#fff;font-size:22px;font-weight:400;margin-bottom: 8px;"><%=t 'user_notifications.digest.popular_topics' %></center>
</td>
@ -121,8 +121,8 @@ body, table, td, th, h1, h2, h3 {font-family: Helvetica, Arial, sans-serif !impo
<table style="vertical-align:top;width:100%">
<tbody>
<tr>
<td style="padding: 0 8px 8px 16px; text-align:left; width:100%;">
<h2 style="font-size:24px;font-weight:400;line-height:1.3;margin:0 0 10px 0;padding:0;word-wrap:normal">
<td style="padding: 0 8px 0 16px; text-align:left; width:100%;">
<h2 style="font-size:18px;font-weight:400;line-height:1.3;margin:0;padding:0;word-wrap:normal">
<a href="<%= Discourse.base_url_no_prefix + t.relative_url %>" style="color:#2F70AC;font-weight:400;line-height:1.3;margin:0;padding:0;text-decoration:none">
<strong><%= t.title -%></strong>
</a>
@ -143,7 +143,7 @@ body, table, td, th, h1, h2, h3 {font-family: Helvetica, Arial, sans-serif !impo
</td>
<td style="color:#0a0a0a;padding:0 16px 0 8px;text-align:left;">
<% if t.user %>
<h6 style="color:inherit;font-size:18px;font-weight:400;line-height:1.3;margin:0;padding:0;word-wrap:normal;"><%= t.user.username -%></h6>
<h6 style="color:inherit;font-size:16px;font-weight:400;line-height:1.3;margin:0;padding:0;word-wrap:normal;"><%= t.user.username -%></h6>
<% if SiteSetting.enable_names? && t.user.name.present? && t.user.name.downcase != t.user.username.downcase %>
<p style="color:#8f8f8f;line-height:1.3;margin:0 0 16px 0;padding:0;"><%= t.user.name -%></p>
<% end %>
@ -162,7 +162,7 @@ body, table, td, th, h1, h2, h3 {font-family: Helvetica, Arial, sans-serif !impo
<table style="border-bottom:1px solid #f3f3f3;padding:0;text-align:left;vertical-align:top;width:100%">
<tbody>
<tr>
<td style="color:#0a0a0a;line-height:1.3;padding:0 16px 0 16px;text-align:left;width:100%;font-weight:normal;">
<td style="color:#0a0a0a;font-size:14px;padding:0 16px 0 16px;text-align:left;width:100%;font-weight:normal;">
<%= email_excerpt(t.first_post.cooked) %>
</td>
</tr>
@ -234,14 +234,14 @@ body, table, td, th, h1, h2, h3 {font-family: Helvetica, Arial, sans-serif !impo
<table style="background-color: #f3f3f3; width: 100%;">
<tr>
<td>
<h1 style="color:#0a0a0a;font-size:28px;line-height:1.3;text-align:center;font-family:Helvetica,Arial,sans-serif;">
<h1 style="color:#0a0a0a;font-size:22px;line-height:1.3;text-align:center;font-family:Helvetica,Arial,sans-serif;">
<%=t 'user_notifications.digest.popular_posts' %>
</h1>
</td>
</tr>
</table>
<table class="body" style="width:100%;background:#f3f3f3;border-spacing:0;border-collapse:collapse!important;font-family:Helvetica,Arial,sans-serif;font-size:16px;font-weight:200;line-height:1.3;padding:0;text-align:left;vertical-align:top;">
<table class="body" style="width:100%;background:#f3f3f3;border-spacing:0;border-collapse:collapse!important;font-family:Helvetica,Arial,sans-serif;font-size:14px;font-weight:200;line-height:1.3;padding:0;text-align:left;vertical-align:top;">
<tr>
<td class="side-spacer" style="width:5%;padding:0;">&nbsp;</td>
<td align="center" valign="top" style="width:90%;border-collapse:collapse!important;line-height:1.3;margin:0;padding:0;text-align:left;vertical-align:top;">
@ -252,7 +252,7 @@ body, table, td, th, h1, h2, h3 {font-family: Helvetica, Arial, sans-serif !impo
<table style="width:100%;background:#fefefe;border-spacing:0;padding:0;text-align:left;vertical-align:top;">
<tbody>
<tr>
<td style="color:#0a0a0a;line-height:1.3;font-weight:200;padding:16px;text-align:left;width:100%;">
<td style="color:#0a0a0a;font-size:14px;font-weight:200;padding:16px;text-align:left;width:100%;">
<%= email_excerpt(post.cooked) %>
</td>
</tr>
@ -277,9 +277,9 @@ body, table, td, th, h1, h2, h3 {font-family: Helvetica, Arial, sans-serif !impo
</td>
<td style="color:#0a0a0a;line-height:1.3;padding:0 8px 8px 8px;vertical-align:top;">
<% if post.user %>
<h6 style="color:inherit;font-size:16px;font-weight:400;margin:0;padding:0;text-align:left;word-wrap:normal;"><%= post.user.username -%></h6>
<h6 style="color:inherit;font-size:14px;font-weight:400;margin:0;padding:0;text-align:left;word-wrap:normal;"><%= post.user.username -%></h6>
<% if SiteSetting.enable_names? && post.user.name && post.user.name.downcase != post.user.username.downcase %>
<p style="color:#8f8f8f;font-size:16px;line-height:1.3;margin:0;padding:0;text-align:left;"><%= post.user.name -%></p>
<p style="color:#8f8f8f;font-size:14px;line-height:1.3;margin:0;padding:0;text-align:left;"><%= post.user.name -%></p>
<% end %>
<% end %>
</td>
@ -316,9 +316,9 @@ body, table, td, th, h1, h2, h3 {font-family: Helvetica, Arial, sans-serif !impo
<%= digest_custom_html("above_popular_topics") %>
<% if @other_new_for_you.present? %>
<center style="color:#0a0a0a;background:#f3f3f3;font-size:28px;font-weight:400;padding-bottom: 8px;font-family:Helvetica,Arial,sans-serif;"><%=t 'user_notifications.digest.more_new' %></center>
<center style="color:#0a0a0a;background:#f3f3f3;font-size:22px;font-weight:400;padding-bottom: 8px;font-family:Helvetica,Arial,sans-serif;"><%=t 'user_notifications.digest.more_new' %></center>
<table class="body" style="width:100%;background:#f3f3f3;border-spacing:0;border-collapse:collapse!important;font-family:Helvetica,Arial,sans-serif;font-size:16px;font-weight:200;line-height:1.3;padding:0;text-align:left;vertical-align:top;">
<table class="body" style="width:100%;background:#f3f3f3;border-spacing:0;border-collapse:collapse!important;font-family:Helvetica,Arial,sans-serif;font-size:14px;font-weight:200;line-height:1.3;padding:0;text-align:left;vertical-align:top;">
<tr>
<td class="side-spacer" style="width:5%;padding:0;">&nbsp;</td>
<td align="center" valign="top" style="width:90%;border-collapse:collapse!important;margin:0;padding:0;">

View File

@ -45,11 +45,18 @@ module CategoryBadge
end
end
show_parent = category.parent_category_id && !opts[:hide_parent]
# sub parent or main category span
result << if opts[:inline_style]
case (SiteSetting.category_style || :box).to_sym
when :bar then inline_category_stripe(category.color, 'display: inline-block; padding: 1px;', true)
when :box then inline_category_stripe(category.color, 'left: 5px; display: block; position: absolute; width: calc(100% - 5px); height: 100%;')
when :box
unless show_parent
inline_category_stripe(category.color, 'display: block; position: absolute; width: 100%; height: 100%;')
else
inline_category_stripe(category.color, 'left: 5px; display: block; position: absolute; width: calc(100% - 5px); height: 100%;')
end
when :bullet then inline_category_stripe(category.color, "display: inline-block; width: #{category.parent_category_id.nil? ? 10 : 5}px; height: 10px;")
end
else
@ -65,7 +72,7 @@ module CategoryBadge
extra_span_classes = if opts[:inline_style]
case (SiteSetting.category_style || :box).to_sym
when :bar then 'padding: 3px; color: #222222 !important; vertical-align: text-top; margin-top: -3px; display: inline-block;'
when :box then 'margin-left: 5px; position: relative; padding: 0 5px; margin-top: 2px;'
when :box then "#{show_parent ? 'margin-left: 5px; ' : ''} position: relative; padding: 0 5px; margin-top: 2px;"
when :bullet then 'color: #222222 !important; vertical-align: text-top; line-height: 1; margin-left: 4px; padding-left: 2px; display: inline;'
end + 'max-width: 150px; overflow: hidden; text-overflow: ellipsis;'
else