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

This is a stripped-back version of the Search Banner component https://meta.discourse.org/t/search-banner/122939, which will be renamed to Advanced Search Banner, see https://github.com/discourse/discourse-search-banner/pull/84. This welcome banner interacts with the header search. When `search_experience` is set to `search_field`, we only show the header search after the welcome banner scrolls out of view, and vice-versa. Only new sites will get this feature turned on by default, existing sites have a migration to disable it. --------- Co-authored-by: Joffrey JAFFEUX <j.jaffeux@gmail.com> Co-authored-by: Jordan Vidrine <jordan@jordanvidrine.com>
35 lines
831 B
Ruby
35 lines
831 B
Ruby
# frozen_string_literal: true
|
|
|
|
module PageObjects
|
|
module Components
|
|
class WelcomeBanner < PageObjects::Components::Base
|
|
def visible?
|
|
has_css?(".welcome-banner")
|
|
end
|
|
|
|
def hidden?
|
|
has_no_css?(".welcome-banner")
|
|
end
|
|
|
|
def invisible?
|
|
has_css?(".welcome-banner", visible: false)
|
|
end
|
|
|
|
def has_anonymous_title?
|
|
has_css?(
|
|
".welcome-banner .welcome-banner__title",
|
|
text: I18n.t("js.welcome_banner.header.anonymous_members", site_name: SiteSetting.title),
|
|
)
|
|
end
|
|
|
|
def has_logged_in_title?(username)
|
|
has_css?(
|
|
".welcome-banner .welcome-banner__title",
|
|
text:
|
|
I18n.t("js.welcome_banner.header.logged_in_members", preferred_display_name: username),
|
|
)
|
|
end
|
|
end
|
|
end
|
|
end
|