discourse/spec/system/page_objects/pages/admin_email_templates_index.rb
Osama Sayegh 43013b7b76
UX: Replace dropdown with a dedicated index page for email templates (#35284)
The admin email templates page currently uses a dropdown that lists all
available templates for navigating between the templates. This is an odd
way of navigation and inconsistent with how navigation is implemented in
other admin pages. This commit replaces the dropdown with a dedicated
index page that lists all templates in a table with an edit button for each
row that navigates to the edit page for the respective template.

Internal topic: t/162739.
2025-10-13 13:05:26 +03:00

46 lines
1.1 KiB
Ruby

# frozen_string_literal: true
module PageObjects
module Pages
class AdminEmailTemplatesIndex < PageObjects::Pages::Base
class TemplateRow < PageObjects::Components::Base
def initialize(selector)
@selector = selector
@element = find(selector)
end
def edit_button
@element.find(".admin-email-templates__edit-button")
end
def name_cell
@element.find(".admin-email-templates__name")
end
def overridden?
@element[:class].include?("overridden")
end
end
def visit
page.visit("/admin/email/templates")
end
def template(id)
TemplateRow.new("tr[data-template-id=\"#{id}\"]")
end
def filter_controls
PageObjects::Components::AdminFilterControls.new(".admin-filter-controls")
end
def only_overridden_checkbox
find("#toggle-overridden")
end
def has_exact_count_templates_shown?(count)
has_css?("tr[data-template-id]", count:)
end
end
end
end