Module: MailEngine::MailEngineHelper

Defined in:
app/helpers/mail_engine/mail_engine_helper.rb

Instance Method Summary collapse

Instance Method Details

#mail_template_list_title(type) ⇒ Object



19
20
21
22
23
24
25
26
27
28
# File 'app/helpers/mail_engine/mail_engine_helper.rb', line 19

def mail_template_list_title type
  case type
  when "partial"
    "Mail Template Partial"
  when "system", "marketing"
    "#{type.try(:capitalize)} Mail Template"
  else
    "Mail Template"
  end
end

#show_no_record(collection, &block) ⇒ Object



4
5
6
7
8
9
10
11
# File 'app/helpers/mail_engine/mail_engine_helper.rb', line 4

def show_no_record collection, &block
  if collection.is_a?(Array) ? collection.blank? : collection.try(:all).blank?
    return raw("<div class='notice' style='margin-top:10px'>No Record</div>")
  else
    block.call
    return ""
  end
end

#show_percentage(reality, total) ⇒ Object



13
14
15
16
17
# File 'app/helpers/mail_engine/mail_engine_helper.rb', line 13

def show_percentage reality, total
  return "-" if total <= 0
  percentage = (reality / total) * 100
  return "#{percentage.round(2)}%"
end