Skip to content

OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub

[40801] Updates to the two-week view (#10164)

Behrokh Satarnejadec35c9eb3f70
diff --git a/frontend/src/app/features/team-planner/team-planner/planner/team-planner.component.ts b/frontend/src/app/features/team-planner/team-planner/planner/team-planner.component.ts
index 5c6a0e4282a..2342d30c6ea 100644
--- a/frontend/src/app/features/team-planner/team-planner/planner/team-planner.component.ts
+++ b/frontend/src/app/features/team-planner/team-planner/planner/team-planner.component.ts
@@ -157,6 +157,8 @@ export class TeamPlannerComponent extends UntilDestroyedMixin implements OnInit,
remove_assignee: this.I18n.t('js.team_planner.remove_assignee'),
noData: this.I18n.t('js.team_planner.no_data'),
two_weeks: this.I18n.t('js.team_planner.two_weeks'),
+ one_week: this.I18n.t('js.team_planner.one_week'),
+ today: this.I18n.t('js.team_planner.today'),
drag_here_to_remove: this.I18n.t('js.team_planner.drag_here_to_remove'),
cannot_drag_here: this.I18n.t('js.team_planner.cannot_drag_here'),
};
@@ -284,6 +286,9 @@ export class TeamPlannerComponent extends UntilDestroyedMixin implements OnInit,
month: 'long',
day: 'numeric',
},
+ buttonText: {
+ today: this.text.today,
+ },
initialView: this.calendar.initialView || 'resourceTimelineWeek',
headerToolbar: {
left: '',
@@ -293,6 +298,7 @@ export class TeamPlannerComponent extends UntilDestroyedMixin implements OnInit,
views: {
resourceTimelineWeek: {
type: 'resourceTimeline',
+ buttonText: this.text.one_week,
duration: { weeks: 1 },
slotDuration: { days: 1 },
slotLabelFormat: [
@@ -311,11 +317,12 @@ export class TeamPlannerComponent extends UntilDestroyedMixin implements OnInit,
resourceTimelineTwoWeeks: {
type: 'resourceTimeline',
buttonText: this.text.two_weeks,
- duration: { weeks: 2 },
slotDuration: { days: 1 },
+ duration: { weeks: 2 },
+ dateIncrement: { weeks: 1 },
slotLabelFormat: [
{
- weekday: 'long',
+ weekday: 'short',
day: '2-digit',
},
],
diff --git a/modules/team_planner/config/locales/js-en.yml b/modules/team_planner/config/locales/js-en.yml
index 05765203dba..31d00ca9f5f 100644
--- a/modules/team_planner/config/locales/js-en.yml
+++ b/modules/team_planner/config/locales/js-en.yml
@@ -2,7 +2,7 @@
en:
js:
team_planner:
- add_existing: 'Add existing'
+ add_existing: 'Add Existing'
create_new: 'Create new planner'
title: 'Team planner'
unsaved_title: 'Unnamed team planner'
@@ -10,7 +10,9 @@ en:
no_data: 'Add assignees to set up your team planner.'
add_assignee: 'Add assignee'
remove_assignee: 'Remove assignee'
- two_weeks: '2 weeks'
+ two_weeks: '2-week'
+ one_week: '1-week'
+ today: 'Today'
drag_here_to_remove: 'Drag here to remove assignee and start and end dates.'
cannot_drag_here: 'Cannot remove the work package due to permissions or editing restrictions.'
diff --git a/modules/team_planner/spec/features/team_planner_view_modes_spec.rb b/modules/team_planner/spec/features/team_planner_view_modes_spec.rb
index 46d4993421a..372cbb1d65f 100644
--- a/modules/team_planner/spec/features/team_planner_view_modes_spec.rb
+++ b/modules/team_planner/spec/features/team_planner_view_modes_spec.rb
@@ -49,11 +49,28 @@ describe 'Team planner', type: :feature, js: true do
end
# weekly: Expect 7 slots
- team_planner.expect_view_mode 'week'
+ team_planner.expect_view_mode '1-week'
expect(page).to have_selector('.fc-timeline-slot-frame', count: 7)
# 2 weeks: expect 14 slots
- team_planner.switch_view_mode '2 weeks'
+ team_planner.switch_view_mode '2-week'
expect(page).to have_selector('.fc-timeline-slot-frame', count: 14)
+
+ start_of_week = Time.zone.today.beginning_of_week(:sunday)
+ start_date = start_of_week.strftime('%d %a')
+ end_date = (start_of_week + 13.days).strftime('%d %a')
+
+ expect(page).to have_selector('.fc-timeline-slot', text: start_date)
+ expect(page).to have_selector('.fc-timeline-slot', text: end_date)
+
+ # Click next button, advance one week
+ find('.fc-next-button').click
+
+ start_of_week = (Time.zone.today + 1.week).beginning_of_week(:sunday)
+ start_date = start_of_week.strftime('%d %a')
+ end_date = (start_of_week + 13.days).strftime('%d %a')
+
+ expect(page).to have_selector('.fc-timeline-slot', text: start_date)
+ expect(page).to have_selector('.fc-timeline-slot', text: end_date)
end
end
diff --git a/modules/team_planner/spec/support/pages/team_planner.rb b/modules/team_planner/spec/support/pages/team_planner.rb
index 4bb39161d1a..88dbfbef075 100644
--- a/modules/team_planner/spec/support/pages/team_planner.rb
+++ b/modules/team_planner/spec/support/pages/team_planner.rb
@@ -75,8 +75,8 @@ module Pages
expect(page).to have_selector('.fc-button-active', text: text)
param = {
- 'week' => :resourceTimelineWeek,
- '2 weeks' => :resourceTimelineTwoWeeks,
+ '1-week' => :resourceTimelineWeek,
+ '2-week' => :resourceTimelineTwoWeeks
}[text]
expect(page).to have_current_path(/cview=#{param}/)