mirror of
https://github.com/discourse/discourse.git
synced 2026-08-14 13:58:53 +08:00
The `AdminFilterControls` component isn't really admin specific, and I want to use it in more places. Renaming to `DFilterControls`. No backwards compat needed, it's only used in core + core plugins. Also add `customEmptyState` to `DFilterControls`, which allows caller to show a custom empty state for `DFilterControls` in a yield when the array of result items is empty, for cases where you might want to show e.g. a different message and CTA when the filter is empty. E.g. used in Kanban: <img width="1107" height="439" alt="image" src="https://github.com/user-attachments/assets/1466e4d9-ac4d-4c59-81e5-6e0e3e259c6f" />
46 lines
1 KiB
Ruby
Vendored
46 lines
1 KiB
Ruby
Vendored
# 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::DFilterControls.new(".d-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
|