Module: Card::Set::Self::AdminInfo::HtmlFormat

Extended by:
AbstractFormat
Defined in:
card/tmpsets/set/mod001-admin/self/admin_info.rb,
card/tmpsets/set/mod034-card-mod-recaptcha/self/admin_info.rb,
card/tmpsets/set/mod035-card-mod-recaptcha/self/admin_info.rb

Instance Method Summary collapse

Instance Method Details



35
36
37
38
# File 'card/tmpsets/set/mod034-card-mod-recaptcha/self/admin_info.rb', line 35

def add_recaptcha_keys_link
  link_text = I18n.t :recaptcha_keys, scope: "mod.admin.set.self.admin_info"
  Card[:recaptcha_settings]&.format&.edit_link link_text: link_text
end

#no_email_delivery_messageObject



42
43
44
45
46
47
48
# File 'card/tmpsets/set/mod001-admin/self/admin_info.rb', line 42

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

#recaptcha_config_issues_messageObject



15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
# File 'card/tmpsets/set/mod034-card-mod-recaptcha/self/admin_info.rb', line 15

def recaptcha_config_issues_message
  warning =
    if Card::Env.localhost?
      # %(Your captcha is currently working with temporary settings.
      #   This is fine for a local installation, but you will need new
      #   recaptcha keys if you want to make this site public.)
      I18n.t(:captcha_temp, scope: "mod.admin.set.self.admin_info",
                            recaptcha_link: add_recaptcha_keys_link)
    else
      # %(You are configured to use [[*captcha]], but for that to work
      #   you need new recaptcha keys.)
      I18n.t(:captcha_keys, scope: "mod.admin.set.self.admin_info",
                            recaptcha_link: add_recaptcha_keys_link,
                            captcha_link: link_to_card(:captcha))
    end
  <<-HTML
      <p>#{warning}</p>
  HTML
end

#view: coreObject



26
27
28
29
30
31
32
# File 'card/tmpsets/set/mod001-admin/self/admin_info.rb', line 26

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

#warning_alert(warnings) ⇒ Object



34
35
36
37
38
39
40
# File 'card/tmpsets/set/mod001-admin/self/admin_info.rb', line 34

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

#warning_list_with_auto_scope(warnings) ⇒ Object



50
51
52
53
54
# File 'card/tmpsets/set/mod001-admin/self/admin_info.rb', line 50

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