Sha256: 6692a6724fcebddff2726eafb4be44da003094852896f331ed51ad04fb769e9a

Contents?: true

Size: 731 Bytes

Versions: 5

Compression:

Stored size: 731 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

5 entries across 5 versions & 1 rubygems

Version Path
mail_engine-0.1.8 app/helpers/mail_engine/mail_engine_helper.rb
mail_engine-0.1.7 app/helpers/mail_engine/mail_engine_helper.rb
mail_engine-0.1.6 app/helpers/mail_engine/mail_engine_helper.rb
mail_engine-0.1.5 app/helpers/mail_engine/mail_engine_helper.rb
mail_engine-0.1.4 app/helpers/mail_engine/mail_engine_helper.rb