Skip to content

Commit

Permalink
Merge pull request #17812 from opf/feature/60959-separate-meeting-ser…
Browse files Browse the repository at this point in the history
…ies-show-page-into-two-tables-pt-2

[#60959] Fix labels and strings
  • Loading branch information
oliverguenther authored Feb 4, 2025
2 parents e33e003 + f173dca commit daf1a35
Show file tree
Hide file tree
Showing 11 changed files with 69 additions and 35 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ def state
elsif instantiated?
meeting.state
else
"scheduled"
"planned"
end
end

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@

module RecurringMeetings
class TableComponent < ::OpPrimer::BorderBoxTableComponent
options :current_project, :count, :direction, :max_count
options :current_project, :count, :direction, :max_count, :blankslate_title, :blankslate_desc

columns :start_time, :relative_time, :status, :create

Expand Down Expand Up @@ -89,5 +89,25 @@ def recurring_meeting
def count
@count ||= [options[:count], rows.count].max
end

def blankslate?
options[:blankslate_title].present?
end

def render_blank_slate
render(Primer::Beta::Blankslate.new(border: false)) do |component|
component.with_visual_icon(icon: blank_icon, size: :medium) if blank_icon
component.with_heading(tag: :h2) { blank_title }
component.with_description { blank_description }
end
end

def blank_title
blankslate? ? options[:blankslate_title] : I18n.t(:label_nothing_display)
end

def blank_description
blankslate? ? options[:blankslate_desc] : I18n.t(:no_results_title_text)
end
end
end
2 changes: 1 addition & 1 deletion modules/meeting/app/models/meeting.rb
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ class Meeting < ApplicationRecord

enum state: {
open: 0, # 0 -> default, leave values for future states between open and closed
scheduled: 1,
planned: 1,
cancelled: 4,
closed: 5
}
Expand Down
12 changes: 8 additions & 4 deletions modules/meeting/app/views/recurring_meetings/show.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -46,16 +46,18 @@ See COPYRIGHT and LICENSE files for more details.
<% else -%>
<%= render RecurringMeetings::TableHeaderComponent.new(
meeting: @recurring_meeting,
title: I18n.t("recurring_meeting.agenda_opened.title"),
subtitle: I18n.t("recurring_meeting.agenda_opened.subtitle")
title: I18n.t("recurring_meeting.open.title"),
subtitle: I18n.t("recurring_meeting.open.subtitle")
) %>
<%= render RecurringMeetings::TableComponent.new(
rows: @meetings,
current_project: @project,
count: @count,
direction: @direction,
max_count: @max_count,
test_selector: "agenda-opened-table"
test_selector: "agenda-opened-table",
blankslate_title: I18n.t("recurring_meeting.open.blankslate.title"),
blankslate_desc: I18n.t("recurring_meeting.open.blankslate.desc")
) %>
<%= render RecurringMeetings::TableHeaderComponent.new(
meeting: @recurring_meeting,
Expand All @@ -69,7 +71,9 @@ See COPYRIGHT and LICENSE files for more details.
count: @count,
direction: @direction,
max_count: @max_count,
test_selector: "planned-table"
test_selector: "planned-table",
blankslate_title: I18n.t("recurring_meeting.planned.blankslate.title"),
blankslate_desc: I18n.t("recurring_meeting.planned.blankslate.desc")
) %>
<% end -%>
<% end -%>
17 changes: 13 additions & 4 deletions modules/meeting/config/locales/en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ en:
label_recurring_meeting_plural: "Recurring meetings"
label_template: "Template"
label_recurring_meeting_view: "View meeting series"
label_recurring_meeting_create: "Create from template"
label_recurring_meeting_create: "Open"
label_recurring_meeting_copy: "Copy as one-off"
label_recurring_meeting_cancel: "Cancel this occurrence"
label_recurring_meeting_delete: "Delete occurrence"
Expand Down Expand Up @@ -279,17 +279,26 @@ en:
frequency: "%{base} at %{time}"
full: "%{base} at %{time}, ends on %{end_date}"
never_ending: "%{base} at %{time}"
agenda_opened:
title: "Agenda opened"
open:
title: "Open"
subtitle: >
Open meetings have agendas that can be edited and show up in individual users’ ‘My meetings’ section.
Changes to the meeting series template do not affect already-open meeting occurrences.
blankslate:
title: "No open meetings at the moment"
desc: "You can manually open a planned meeting by clicking on the 'Open' button below"
planned:
title: "Planned"
subtitle: >
The following meetings are planned in the recurring meeting schedule but are not open yet.
Every time a planned meeting starts, the next one will automatically be opened for you.
You can also open planned meetings manually to import the template and start editing the agenda.
blankslate:
title: "No more planned meetings"
desc: >
There are no additional meetings planned in this series.
To schedule additional meetings or extend the series,
go to the template and edit meeting details to change the end date, frequency or interval.
delete_dialog:
title: "Delete meeting series"
heading: "Permanently delete this meeting series?"
Expand Down Expand Up @@ -391,7 +400,7 @@ en:
label_meeting_state_closed: "Closed"
label_meeting_state_closed_html: "<i>Closed</i>"
label_meeting_state_agenda_created: "Agenda created"
label_meeting_state_scheduled: "Scheduled"
label_meeting_state_planned: "Planned"
label_meeting_state_cancelled: "Cancelled"
label_meeting_state_skipped: "Skipped"
label_meeting_reopen_action: "Reopen meeting"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@
meetings_page.set_end_after "a specific date"
meetings_page.set_end_date "2025-01-15"

sleep 0.5 # quick fix as wait_for_network_idle isn't working all the time
expect(page).to have_text "Every week on Tuesday at 01:30 PM"

click_on "Create meeting"
Expand Down Expand Up @@ -127,8 +128,8 @@
expect(page).to have_css(".start_time", count: 3)

show_page.expect_open_meeting date: "12/31/2024 01:30 PM"
show_page.expect_scheduled_meeting date: "01/07/2025 01:30 PM"
show_page.expect_scheduled_meeting date: "01/14/2025 01:30 PM"
show_page.expect_planned_meeting date: "01/07/2025 01:30 PM"
show_page.expect_planned_meeting date: "01/14/2025 01:30 PM"

perform_enqueued_jobs
expect(ActionMailer::Base.deliveries.size).to eq 2
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,17 +100,17 @@
show_page.expect_no_meeting date: "12/31/2024 01:30 PM"
end

it "can use the 'Create from template' button" do
it "can use the 'Open' button" do
show_page.visit!

show_page.create_from_template date: "01/07/2025 01:30 PM"
show_page.open date: "01/07/2025 01:30 PM"
wait_for_reload

expect(page).to have_current_path project_meeting_path(project, Meeting.last)

show_page.visit!

show_page.expect_no_scheduled_meeting date: "01/07/2025 01:30 PM"
show_page.expect_no_planned_meeting date: "01/07/2025 01:30 PM"
show_page.expect_open_meeting date: "01/07/2025 01:30 PM"
end

Expand All @@ -132,10 +132,10 @@
show_page.expect_cancelled_meeting date: "12/31/2024 01:30 PM"
end

it "can cancel a scheduled occurrence from the show page" do
it "can cancel a planned occurrence from the show page" do
show_page.visit!

show_page.cancel_scheduled_occurrence date: "01/07/2025 01:30 PM"
show_page.cancel_planned_occurrence date: "01/07/2025 01:30 PM"
show_page.within_modal "Cancel meeting occurrence" do
check "I understand that this deletion cannot be reversed", allow_label_click: true

Expand Down Expand Up @@ -174,8 +174,8 @@
show_page.expect_open_meeting date: "12/31/2024 01:30 PM"
show_page.expect_open_actions date: "12/31/2024 01:30 PM"

show_page.expect_scheduled_meeting date: "01/07/2025 01:30 PM"
show_page.expect_scheduled_actions date: "01/07/2025 01:30 PM"
show_page.expect_planned_meeting date: "01/07/2025 01:30 PM"
show_page.expect_planned_actions date: "01/07/2025 01:30 PM"

show_page.cancel_occurrence date: "12/31/2024 01:30 PM"
show_page.within_modal "Delete meeting occurrence" do
Expand All @@ -198,7 +198,7 @@
it "does not allow to act on the recurring meeting" do
show_page.visit!

expect(page).to have_no_content "Create from template"
expect(page).to have_no_button "Open"
show_page.expect_open_meeting date: "12/31/2024 01:30 PM"

within("li", text: "12/31/2024 01:30 PM") do
Expand All @@ -211,8 +211,8 @@
click_on "more-button"
end

show_page.expect_scheduled_meeting date: "01/07/2025 01:30 PM"
show_page.expect_scheduled_meeting date: "01/14/2025 01:30 PM"
show_page.expect_planned_meeting date: "01/07/2025 01:30 PM"
show_page.expect_planned_meeting date: "01/14/2025 01:30 PM"

expect(page).not_to have_test_selector "recurring-meeting-action-menu"
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@
end

expect(page).to have_current_path recurring_meeting_path(meeting)
expect(page).to have_text("Nothing to display")
expect(page).to have_text("No open meetings at the moment")
end

context "when meeting start time is in the future" do
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -119,10 +119,10 @@
show_page.expect_cancelled_meeting date: "12/31/2024 01:30 PM"
end

it "can cancel a scheduled occurrence from the show page" do
it "can cancel a planned occurrence from the show page" do
show_page.visit!

show_page.cancel_scheduled_occurrence date: "01/07/2025 01:30 PM"
show_page.cancel_planned_occurrence date: "01/07/2025 01:30 PM"
show_page.within_modal "Cancel meeting occurrence" do
check "I understand that this deletion cannot be reversed", allow_label_click: true

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@
get recurring_meeting_path(recurring_meeting)

content = page.find_by_id("content")
expect(content).to have_text "Agenda opened"
expect(content).to have_text "Open"
expect(content).to have_text "Planned"

open_meeting_date = format_time(open_meeting.start_time)
Expand Down
16 changes: 8 additions & 8 deletions modules/meeting/spec/support/pages/recurring_meeting/show.rb
Original file line number Diff line number Diff line change
Expand Up @@ -46,15 +46,15 @@ def path
end
end

def expect_scheduled_meeting(date:)
def expect_planned_meeting(date:)
within("li", text: date) do
expect(page).to have_css(".status", text: "Scheduled")
expect(page).to have_css(".status", text: "Planned")
end
end

def expect_no_scheduled_meeting(date:)
def expect_no_planned_meeting(date:)
within("li", text: date) do
expect(page).to have_no_css(".status", text: "Scheduled")
expect(page).to have_no_css(".status", text: "Planned")
end
end

Expand Down Expand Up @@ -89,9 +89,9 @@ def expect_rescheduled_meeting(old_date:, new_date:)
end
end

def create_from_template(date:)
def open(date:)
within("li", text: date) do
click_on "Create from template"
click_on "Open"
end
end

Expand All @@ -104,7 +104,7 @@ def cancel_occurrence(date:)
expect_modal("Delete meeting occurrence")
end

def cancel_scheduled_occurrence(date:)
def cancel_planned_occurrence(date:)
within("li", text: date) do
click_on "more-button"
click_on "Cancel this occurrence"
Expand Down Expand Up @@ -165,7 +165,7 @@ def expect_open_actions(date:)
end
end

def expect_scheduled_actions(date:)
def expect_planned_actions(date:)
within("li", text: date) do
click_on "more-button"

Expand Down

0 comments on commit daf1a35

Please sign in to comment.