0
0
Fork 0
mirror of https://github.com/discourse/discourse.git synced 2026-08-14 13:58:53 +08:00
discourse/spec/system/page_objects/pages/admin_welcome_banner_config.rb
Kris 7d47a56492
UX: add locale to welcome banner config, fix variable references (#36962)
This adds a language dropdown to the welcome banner admin config area,
so text from languages beyond the current selection can also be
configured.

I also fixed the issue described here:
https://meta.discourse.org/t/welcome-header-text-site-name-gives-error-the-following-interpolation-key-is-invalid-site-name/392604/,
where we were over-promising which variables were available. These are
now described per field and are accurate to what's available.

I've also added some specs. 

Before:
<img width="600" alt="image"
src="https://github.com/user-attachments/assets/aefe5dc2-d833-4a63-b0d0-ae4a743128ab"
/>



After: 
<img width="450" alt="image"
src="https://github.com/user-attachments/assets/bc3c6556-8b24-47a7-812f-b5050f5f81d6"
/>

---------

Co-authored-by: Martin Brennan <martin@discourse.org>
2026-01-06 09:10:42 -05:00

44 lines
1 KiB
Ruby
Vendored

# frozen_string_literal: true
module PageObjects
module Pages
class AdminWelcomeBannerConfig < PageObjects::Pages::Base
def visit
page.visit("/admin/config/welcome-banner")
end
def form
@form ||= PageObjects::Components::FormKit.new(".admin-welcome-banner-form")
end
def has_locale_selector?
has_css?(".translation-selector")
end
def select_locale(locale_value)
find(".translation-selector").click
find(".select-kit-row[data-value='#{locale_value}']").click
end
def header_new_members_value
form.field("headerNewMembers").value
end
def search_placeholder_value
form.field("searchPlaceholder").value
end
def fill_header_new_members(value)
form.field("headerNewMembers").fill_in(value)
end
def submit
form.submit
end
def has_saved_message?
page.has_content?(I18n.t("admin_js.admin.config.welcome_banner.saved"))
end
end
end
end