Sha256: b0720fcba3b6431859ccac848a756b35b04bd3e899402c02eddff30e42857187

Contents?: true

Size: 1.08 KB

Versions: 8

Compression:

Stored size: 1.08 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
    # 'ADMINISTRATOR WARNING'
    alert :warning, true do
      "<h5>#{t :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."
    t :admin_email_off, path: "config/application.rb"
  end

  def warning_list_with_auto_scope warnings
    "<h5>#{t :admin_warn}</h5>" + warnings.join("\n")
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
card-1.103.2 mod/admin/set/self/admin_info.rb
card-1.103.1 mod/admin/set/self/admin_info.rb
card-1.103.0 mod/admin/set/self/admin_info.rb
card-1.101.7 mod/admin/set/self/admin_info.rb
card-1.102.0 mod/admin/set/self/admin_info.rb
card-1.101.6 mod/admin/set/self/admin_info.rb
card-1.101.5 mod/admin/set/self/admin_info.rb
card-1.101.4 mod/admin/set/self/admin_info.rb