mirror of
https://github.com/discourse/discourse.git
synced 2026-03-05 15:27:34 +08:00
Enhances customizability of the core welcome banner by adding an Interface setting: *page visibility* to the core welcome banner. This allows us to replace [advanced search banner](https://meta.discourse.org/t/advanced-search-banner/122939). --------- Co-authored-by: Martin Brennan <martin@discourse.org>
22 lines
623 B
Ruby
22 lines
623 B
Ruby
# frozen_string_literal: true
|
|
|
|
require "enum_site_setting"
|
|
|
|
class WelcomeBannerPageVisibility < EnumSiteSetting
|
|
def self.valid_value?(val)
|
|
values.any? { |v| v[:value].to_s == val.to_s }
|
|
end
|
|
|
|
def self.values
|
|
@values ||= [
|
|
{ name: "welcome_banner_page_visibility.top_menu_pages", value: "top_menu_pages" },
|
|
{ name: "welcome_banner_page_visibility.homepage", value: "homepage" },
|
|
{ name: "welcome_banner_page_visibility.discovery", value: "discovery" },
|
|
{ name: "welcome_banner_page_visibility.all_pages", value: "all_pages" },
|
|
]
|
|
end
|
|
|
|
def self.translate_names?
|
|
true
|
|
end
|
|
end
|