Sha256: dfbf632fb20b9864dfbf290105c242af97eaf707263c12edd20da0ffa99d30cb

Contents?: true

Size: 679 Bytes

Versions: 3

Compression:

Stored size: 679 Bytes

Contents

module MailEngine
  module MailEngineHelper

    def show_no_record collection, &block
      if 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

3 entries across 3 versions & 1 rubygems

Version Path
mail_engine-0.1.2 app/helpers/mail_engine/mail_engine_helper.rb
mail_engine-0.1.1 app/helpers/mail_engine/mail_engine_helper.rb
mail_engine-0.1.0 app/helpers/mail_engine/mail_engine_helper.rb