mirror of
https://gh.wpcy.net/https://github.com/discourse/discourse.git
synced 2026-05-02 03:06:46 +08:00
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.
46 lines
1.1 KiB
Ruby
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
|