Sha256: 14214506996979f095a43061e57c8231c7b031453c7845f5fb6fa9b4298c08cc

Contents?: true

Size: 732 Bytes

Versions: 7

Compression:

Stored size: 732 Bytes

Contents

module MailEngine
  module MailEngineHelper

    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

    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

7 entries across 7 versions & 1 rubygems

Version Path
mail_engine-0.1.15 app/helpers/mail_engine/mail_engine_helper.rb
mail_engine-0.1.14 app/helpers/mail_engine/mail_engine_helper.rb
mail_engine-0.1.13 app/helpers/mail_engine/mail_engine_helper.rb
mail_engine-0.1.12 app/helpers/mail_engine/mail_engine_helper.rb
mail_engine-0.1.11 app/helpers/mail_engine/mail_engine_helper.rb
mail_engine-0.1.10 app/helpers/mail_engine/mail_engine_helper.rb
mail_engine-0.1.9 app/helpers/mail_engine/mail_engine_helper.rb