Module: Maily::EmailsHelper

Defined in:
app/helpers/maily/emails_helper.rb

Instance Method Summary collapse

Instance Method Details

#email_description(email) ⇒ Object



7
8
9
10
11
12
13
14
# File 'app/helpers/maily/emails_helper.rb', line 7

def email_description(email)
  return unless email.description

  tag.div(class: 'mail_description') do
    concat tag.strong('Description ')
    concat email.description
  end
end

#part_class(part) ⇒ Object



16
17
18
# File 'app/helpers/maily/emails_helper.rb', line 16

def part_class(part)
  'format_selected' if part == params[:part] || (part == 'html' && !params[:part])
end

#total_emails(mailers) ⇒ Object



3
4
5
# File 'app/helpers/maily/emails_helper.rb', line 3

def total_emails(mailers)
  mailers.map { |mailer| mailer.total_emails }.sum
end

#uniq_emails(email_list) ⇒ Object



20
21
22
23
24
25
# File 'app/helpers/maily/emails_helper.rb', line 20

def uniq_emails(email_list)
  email_list.inject([]) do |memo, email|
    memo << email unless memo.map(&:name).include?(email.name)
    memo
  end
end