Sha256: 168a5f9a7a96ecc6b7bbbce2476a61dea63c580f019a38458c9ee7c95e53939e

Contents?: true

Size: 1.5 KB

Versions: 1

Compression:

Stored size: 1.5 KB

Contents

module EffectivePostmarkHelper

  # For use on the regular user alerts and forgot password pages
  def effective_postmark_alert(user, from: nil, html_class: 'alert alert-danger mb-4')
    raise('expected an effective_postmark_user') unless user.class.try(:effective_postmark_user?)
    return unless user.postmark_invalid?

    content_tag(:div, class: html_class) do
      [
        succeed(',') { "IMPORTANT: The email address you use to sign in#{" to #{from}" if from}" },
        succeed(',') { user.email },
        "has been marked as inactive.",
        "You will not receive any emails",
        ("from #{from}" if from),
        "while inactive.",
        "Please contact us to update your email address."
      ].compact.join(' ').html_safe
    end
  end

  # For use on the admin/users#edit page
  def effective_postmark_admin_alert(user, from: nil, html_class: 'alert alert-danger mb-4')
    raise('expected an effective_postmark_user') unless user.class.try(:effective_postmark_user?)
    return unless user.postmark_invalid?

    content_tag(:div, class: html_class) do
      [
        "This user has an inactive email address.",
        "They will not receive any emails",
        ("from #{from}" if from),
        "while inactive.",
        "Please update their email address, or " +
        link_to('reactivate their email', effective_postmark.postmark_reactivate_admin_postmark_path(user), 'data-method': :post),
        "and automatically attempt an email delivery."
      ].compact.join(' ').html_safe
    end
  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
effective_postmark-0.2.0 app/helpers/effective_postmark_helper.rb