mirror of
https://gh.wpcy.net/https://github.com/discourse/discourse.git
synced 2026-05-03 20:07:47 +08:00
Previously, the bulk-select dropdown exposed three separate entries for
tag operations ("Add Tags", "Replace Tags", "Remove Tags"), each opening
its own modal with a single tag chooser.
This commit replaces them with a single "Manage tags" item. The modal
combines Remove, Add, and Replace sections so any mix of the three can
be applied in one submission. The Remove section also has a "Remove all
tags" toggle which clears each topic first, then applies whatever is in
the Add and Replace sections on top.
Co-authored-by: chapoi <101828855+chapoi@users.noreply.github.com>
76 lines
2.1 KiB
Ruby
76 lines
2.1 KiB
Ruby
# frozen_string_literal: true
|
|
module PageObjects
|
|
module Modals
|
|
class TopicBulkActions < PageObjects::Modals::Base
|
|
MODAL_SELECTOR = ".topic-bulk-actions-modal"
|
|
|
|
def category_selector
|
|
PageObjects::Components::SelectKit.new(".category-chooser")
|
|
end
|
|
|
|
def click_bulk_topics_confirm
|
|
find("#bulk-topics-confirm").click
|
|
end
|
|
|
|
def click_dismiss_confirm
|
|
find("#dismiss-read-confirm").click
|
|
end
|
|
|
|
def click_notify
|
|
find("#topic-bulk-action-options__notify").click
|
|
end
|
|
|
|
def fill_in_close_note(message)
|
|
find("#bulk-close-note").set(message)
|
|
end
|
|
|
|
def select_notification_level(level)
|
|
find(".bulk-notification-list input[name='notification_level'][value='#{level}']").click
|
|
end
|
|
|
|
def has_category_badge?(category)
|
|
within(MODAL_SELECTOR) do
|
|
PageObjects::Components::CategoryBadge.new.find_for_category(category)
|
|
end
|
|
end
|
|
|
|
def pin_in_category_date_selector
|
|
PageObjects::Components::SelectKit.new(
|
|
"#{MODAL_SELECTOR} .feature-section:first-of-type .future-date-input-selector",
|
|
)
|
|
end
|
|
|
|
def click_pin_in_category
|
|
find("#{MODAL_SELECTOR} .feature-section:first-of-type .btn-primary").click
|
|
end
|
|
|
|
def pin_globally_date_selector
|
|
PageObjects::Components::SelectKit.new(
|
|
"#{MODAL_SELECTOR} .feature-section:last-of-type .future-date-input-selector",
|
|
)
|
|
end
|
|
|
|
def click_pin_globally
|
|
find("#{MODAL_SELECTOR} .feature-section:last-of-type .btn-primary").click
|
|
end
|
|
|
|
def has_pin_stats_text?(text)
|
|
page.has_css?("#{MODAL_SELECTOR} .feature-section", text: text, normalize_ws: true)
|
|
end
|
|
|
|
def has_no_category_badge?(category)
|
|
within(MODAL_SELECTOR) do
|
|
has_no_css?(PageObjects::Components::CategoryBadge.new.category_selector(category))
|
|
end
|
|
end
|
|
|
|
def has_errors?(text = nil)
|
|
if text
|
|
has_css?("#{MODAL_SELECTOR}__errors", text: text)
|
|
else
|
|
has_css?("#{MODAL_SELECTOR}__errors")
|
|
end
|
|
end
|
|
end
|
|
end
|
|
end
|