parent
09fd243901
commit
eeb3be2fe1
@ -0,0 +1,11 @@
|
||||
class ReporterMailer < ActionMailer::Base
|
||||
default from: "cartodb.com <support@cartodb.com>"
|
||||
layout 'mail'
|
||||
|
||||
def trending_maps_report(mail_to, trending_visualizations)
|
||||
@subject = "Daily report for trending maps"
|
||||
@trending_visualizations = trending_visualizations
|
||||
|
||||
mail to: mail_to, subject: @subject
|
||||
end
|
||||
end
|
@ -0,0 +1,48 @@
|
||||
<% content_for(:subject) { @subject } %>
|
||||
|
||||
<% content_for :body do %>
|
||||
<tr>
|
||||
<td>
|
||||
<!-- HEADER -->
|
||||
<table width="100%" border="0" cellspacing="0" cellpadding="0" style="background-color: #ffffff; border: 1px solid #dddddd; border-bottom: 0; border-collapse: separate !important; border-top-left-radius: 4px; border-top-right-radius: 4px; width: 100% !important;">
|
||||
<tr>
|
||||
<td align="left" style="padding: 40px 50px 40px 50px; font-weight: bold; font-size: 25px; font-family: Helvetica, Arial, sans-serif; color: #333333;">Trending Maps Report</td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<!-- CONTENT -->
|
||||
<table cellspacing="0" cellpadding="0" border="0" width="100%" style="background-color: #ffffff; border: 1px solid #dddddd; border-top: 1px solid #dddddd; border-bottom: 1px solid #cccccc; border-bottom-left-radius: 4px; border-bottom-right-radius: 4px; width: 100% !important;">
|
||||
<tr>
|
||||
<td valign="top" style="padding: 0;">
|
||||
<table cellspacing="0" cellpadding="0" border="0" width="100%" style="background-color: #F2FAE8 border-bottom: 1px solid #dddddd; width: 100% !important;">
|
||||
<% @trending_visualizations.each do |vis_id, map_data| %>
|
||||
<tr>
|
||||
<td align="left" style="padding: 10px 50px 10px 50px; font-family: Helvetica, Arial, sans-serif;">
|
||||
<p style="margin: 0; font-size: 16px; line-height: 25px; color: #666666;">Trending map <a href="<%= "#{map_data['user_public_url']}#{CartoDB.path(self, 'public_visualizations_public_map', { id: vis_id })}" %>" ><%= map_data["visualization_name"] %></a> by <a href="mailto:<%= map_data["user_mail"] %>"><%= map_data["user"] %></a> with <strong><%= map_data["mapviews"] %> mapviews</strong></p>
|
||||
</td>
|
||||
</tr>
|
||||
<% end %>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
<% end %>
|
||||
|
||||
<% content_for :footer do %>
|
||||
<tr>
|
||||
<td style="padding: 20px 0px 20px 0px;">
|
||||
<table border="0" cellpadding="0" cellspacing="0" width="100%">
|
||||
<tr>
|
||||
<td align="center" valign="middle" style="font-size: 12px; line-height: 18px; font-family: Helvetica, Arial, sans-serif; color:#999;">
|
||||
© <%= Time.now.year %> CartoDB
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
<% end %>
|
@ -0,0 +1,16 @@
|
||||
# encoding: utf-8
|
||||
require_relative './base_job'
|
||||
|
||||
module Resque
|
||||
module Reporter
|
||||
module Mail
|
||||
module TrendingMapsReport
|
||||
@queue = :users
|
||||
|
||||
def self.perform(mail_to, trending_visualizations)
|
||||
ReporterMailer.trending_maps_report(mail_to, trending_visualizations).deliver
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
Loading…
Reference in new issue