Class: Nuntius::DailyMessagesPerTemplateReportlet

Inherits:
ApplicationReportlet show all
Defined in:
app/reportlets/nuntius/daily_messages_per_template_reportlet.rb

Instance Attribute Summary

Attributes inherited from ApplicationReportlet

#template_ids

Instance Method Summary collapse

Methods inherited from ApplicationReportlet

#initialize

Constructor Details

This class inherits a constructor from Nuntius::ApplicationReportlet

Instance Method Details

#table_dataObject



10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'app/reportlets/nuntius/daily_messages_per_template_reportlet.rb', line 10

def table_data
  data = [[''] + ymds(true)]

  matrix = all_templates.map do |template|
    tmpl = Nuntius::Template.find(template)
    if tmpl
      template_ymd_totals = ymds.map { |ymd| h.link_to(ymd_template_id(ymd, template, :count), Nuntius::Engine.routes.url_helpers.admin_messages_path(template_id: template)) }
      [h.link_to(tmpl.description, Nuntius::Engine.routes.url_helpers.edit_admin_template_path(tmpl))] + template_ymd_totals
    end
  end

  if matrix.present?
    data += matrix
  else
    data = []
  end
  data
end