mirror of
https://github.com/discourse/discourse.git
synced 2025-06-30 01:11:37 +08:00

Adds a search field to the page header on desktop that is controlled by a site setting (within Search). The search field toggles back to the search icon (magnifying class) when the header is minimized (ie. scrolling in topics) and restores to the field again when header is no longer minimized. On mobile the search experience is still the same.
19 lines
400 B
Ruby
19 lines
400 B
Ruby
# frozen_string_literal: true
|
|
|
|
class SearchExperienceSiteSetting < EnumSiteSetting
|
|
def self.valid_value?(val)
|
|
values.any? { |v| v[:value] == val }
|
|
end
|
|
|
|
def self.values
|
|
@values ||= [
|
|
{ name: "search.experience.search_field", value: "search_field" },
|
|
{ name: "search.experience.search_icon", value: "search_icon" },
|
|
]
|
|
end
|
|
|
|
def self.translate_names?
|
|
true
|
|
end
|
|
end
|