0
0
Fork 0
mirror of https://github.com/discourse/discourse.git synced 2026-08-08 17:53:55 +08:00
discourse/spec/system/page_objects/modals/bookmark.rb
chapoi 6c7c08178a
UX: Always show options in bookmark modal (#40075)
Previously, the bookmark modal hid the auto-delete preference behind a
gear-icon toggle, even though that toggle revealed only that one
control.

This change removes the toggle and renders the auto-delete preference
inline alongside the name and reminder fields.

| BC | AC |
|--------|--------|
| <img width="1234" height="1134" alt="CleanShot 2026-05-15 at 17 12
49@2x"
src="https://github.com/user-attachments/assets/9deeb527-6ae6-429c-93c5-355b445df279"
/> | <img width="1234" height="1134" alt="CleanShot 2026-05-15 at 17 11
13@2x"
src="https://github.com/user-attachments/assets/eaa65188-aead-4be3-8d7d-8b5d6ca032f6"
/> |


[Meta](https://meta.discourse.org/t/superfluous-button-in-edit-bookmark-dialog/403018?u=chapoi)
2026-05-26 09:08:17 +02:00

96 lines
2.6 KiB
Ruby
Vendored

# frozen_string_literal: true
module PageObjects
module Modals
class Bookmark < PageObjects::Modals::Base
def fill_name(name)
fill_in("bookmark-name", with: name)
end
def name
find("#bookmark-name")
end
def select_preset_reminder(identifier)
find("#tap_tile_#{identifier}").click
closed?
end
def has_active_preset?(identifier)
has_css?("#tap_tile_#{identifier}.tap-tile.active")
end
def has_preset?(identifier)
has_css?("#tap_tile_#{identifier}")
end
def has_no_preset?(identifier)
has_no_css?("#tap_tile_#{identifier}")
end
def editing_id?(bookmark_id)
has_css?(".bookmark-reminder-modal[data-bookmark-id='#{bookmark_id}']")
end
def select_relative_time_duration(duration)
find("#bookmark-relative-time-picker").fill_in(with: duration)
end
def select_relative_time_interval(interval)
select_kit = PageObjects::Components::SelectKit.new(".relative-time-intervals")
select_kit.expand
select_kit.select_row_by_value(interval)
end
def select_auto_delete_preference(preference)
select_kit = PageObjects::Components::SelectKit.new("#bookmark-auto-delete-preference")
select_kit.expand
select_kit.select_row_by_value(preference)
end
def has_auto_delete_preference?(preference)
select_kit = PageObjects::Components::SelectKit.new("#bookmark-auto-delete-preference")
select_kit.has_selected_value?(preference)
end
def custom_date_picker
find(".tap-tile-date-input #custom-date .date-picker")
end
def custom_time_picker
find(".tap-tile-time-input #custom-time")
end
def save
find("#save-bookmark").click
end
def delete
find("#delete-bookmark").click
end
def confirm_delete
find(".dialog-footer .btn-danger").click
end
def existing_reminder_alert
find(".existing-reminder-at-alert")
end
def existing_reminder_alert_message(bookmark)
I18n.t(
"js.bookmarks.reminders.existing_reminder",
at_date_time:
I18n.t(
"js.bookmarks.reminders.at_time",
date_time:
bookmark
.reminder_at_in_zone(bookmark.user.user_option&.timezone || "UTC")
.strftime("%b %-d, %Y %l:%M %P")
.gsub(" ", " "), # have to do this because %l adds padding before the hour but not in JS
),
)
end
end
end
end