Sha256: 0314629e53a921fe1955f42857feceeca583fa69eb37d0e71a27057a99fd7f52

Contents?: true

Size: 1.27 KB

Versions: 7

Compression:

Stored size: 1.27 KB

Contents

basket :warnings

# For each warning in the basket (eg :my_warning), the core view
# will run a test by appending a question mark (eg #my_warning?).
# If it fails it will generate a message by appending message
# (eg #my_warning_message).

add_to_basket :warnings, :no_email_delivery

def no_email_delivery?
  Card.config.action_mailer.perform_deliveries == false
end

def clean_html?
  false
end

format :html do
  view :core do
    warnings = card.warnings.map do |warning|
      card.send("#{warning}?") ? send("#{warning}_message") : nil
    end
    warnings.compact!
    warnings.empty? ? "" : warning_alert(warnings)
  end

  def warning_alert warnings
    admin_warn = I18n.t(:admin_warn, scope: "mod.admin.set.self.admin_info")
    # 'ADMINISTRATOR WARNING'
    alert :warning, true do
      "<h5>#{admin_warn}</h5>" + list_tag(warnings)
    end
  end

  def no_email_delivery_message
    # "Email delivery is turned off."
    # "Change settings in config/application.rb to send sign up notifications."
    I18n.t(:email_off,
           scope: "mod.admin.set.self.admin_info",
           path: "config/application.rb")
  end

  def warning_list_with_auto_scope warnings
    # 'ADMINISTRATOR WARNING'
    admin_warn = tr(:admin_warn)
    "<h5>#{admin_warn}</h5>" + warnings.join("\n")
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
card-1.101.1 mod/admin/set/self/admin_info.rb
card-1.101.0 mod/admin/set/self/admin_info.rb
card-1.100.0 mod/admin/set/self/admin_info.rb
card-1.99.6 mod/admin/set/self/admin_info.rb
card-1.99.5 mod/admin/set/self/admin_info.rb
card-1.99.4 mod/admin/set/self/admin_info.rb
card-1.99.3 mod/admin/set/self/admin_info.rb