mirror of
https://github.com/discourse/discourse.git
synced 2025-01-16 13:52:46 +08:00
47c8197ea1
This change adds a new dropdown trigger next to the "New Topic" button. When clicked a menu will display a list of topic/post drafts that can be clicked to resume the draft within the composer. The "New Topic" button will no longer change text to show "Open Draft" when a draft topic exists, it will still attempt to load the existing draft if one exists (this will change later when we support multiple drafts in a separate PR). The "My Posts" link in desktop sidebar will now be "My Drafts" and only appear when the current user has existing drafts.
38 lines
801 B
Ruby
38 lines
801 B
Ruby
# frozen_string_literal: true
|
|
|
|
module PageObjects
|
|
module Components
|
|
class DraftsMenu < PageObjects::Components::Base
|
|
MENU_SELECTOR = ".topic-drafts-menu"
|
|
|
|
def visible?
|
|
has_css?(MENU_SELECTOR + "-trigger")
|
|
end
|
|
|
|
def hidden?
|
|
has_no_css?(MENU_SELECTOR + "-trigger")
|
|
end
|
|
|
|
def open?
|
|
has_css?(MENU_SELECTOR + "-content")
|
|
end
|
|
|
|
def closed?
|
|
has_no_css?(MENU_SELECTOR + "-content")
|
|
end
|
|
|
|
def open
|
|
find(MENU_SELECTOR + "-trigger").click
|
|
end
|
|
|
|
def draft_item_count
|
|
all(MENU_SELECTOR + "-content .topic-drafts-item").size
|
|
end
|
|
|
|
def other_drafts_count
|
|
find(MENU_SELECTOR + "-content .view-all-drafts span:first-child")["data-other-drafts"].to_i
|
|
end
|
|
end
|
|
end
|
|
end
|