FEATURE: Add keywords support for site_settings search (#24146)

* FEATURE: Add keywords support for site_settings search

This change allows for a new `keywords` field that can be added to site
settings in order to help with searching. Keywords are not visible in
the UI, but site settings matching one of the contained keywords will
appear when searching for that keyword.

Keywords can be added for site settings inside of the
`config/locales/server.en.yml` file under the new `keywords` key.

```
site_settings
  example_1: "fancy description"
  example_2: "another description"

  keywords:
    example_1: "capybara"
```

* Add keywords entry for a recently changed site setting and add system specs

* Use page.visit now that we have our own visit
This commit is contained in:
Blake Erickson
2023-10-27 15:42:57 -06:00
committed by GitHub
parent e7ed18fdfc
commit 1a78e8ec1b
6 changed files with 58 additions and 1 deletions

View File

@ -199,6 +199,7 @@ module SiteSettingExtension
opts = {
setting: s,
description: description(s),
keywords: keywords(s),
default: default,
value: value.to_s,
category: categories[s],
@ -218,6 +219,10 @@ module SiteSettingExtension
I18n.t("site_settings.#{setting}", base_path: Discourse.base_path)
end
def keywords(setting)
I18n.t("site_settings.keywords.#{setting}", default: "")
end
def placeholder(setting)
if !I18n.t("site_settings.placeholder.#{setting}", default: "").empty?
I18n.t("site_settings.placeholder.#{setting}")