Sha256: 0d4f9e9001d5b368422daba767ea5868800bdedb75ebca0b86f34610d68b83c8

Contents?: true

Size: 725 Bytes

Versions: 1

Compression:

Stored size: 725 Bytes

Contents

module MailEngine
  module MailEngineHelper

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

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

    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
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
mail_engine-0.1.3 app/helpers/mail_engine/mail_engine_helper.rb