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

Allow resizing from start

Oliver Günther4cb5e0731f01
diff --git a/frontend/src/app/features/calendar/wp-calendar/wp-calendar.component.ts b/frontend/src/app/features/calendar/wp-calendar/wp-calendar.component.ts
index fcf06c132f8..e716d4e950a 100644
--- a/frontend/src/app/features/calendar/wp-calendar/wp-calendar.component.ts
+++ b/frontend/src/app/features/calendar/wp-calendar/wp-calendar.component.ts
@@ -138,6 +138,7 @@ export class WorkPackagesCalendarComponent extends UntilDestroyedMixin implement
// DnD configuration
selectable: true,
select: this.handleDateClicked.bind(this) as unknown,
+ eventResizableFromStart: true,
editable: true,
eventResize: (resizeInfo:EventResizeDoneArg) => this.updateEvent(resizeInfo),
eventDrop: (dropInfo:EventDropArg) => this.updateEvent(dropInfo),
diff --git a/modules/calendar/spec/features/calendar_user_interaction_spec.rb b/modules/calendar/spec/features/calendar_user_interaction_spec.rb
index 8017d714beb..685ea3c36c5 100644
--- a/modules/calendar/spec/features/calendar_user_interaction_spec.rb
+++ b/modules/calendar/spec/features/calendar_user_interaction_spec.rb
@@ -59,14 +59,31 @@ describe 'Calendar drag&dop and resizing', type: :feature, js: true do
context 'with full permissions' do
it 'allows to resize to change the dates of a wp' do
target = work_package.due_date + 1.day
+ current_start = work_package.start_date
retry_block do
- calendar.resize_end_date(work_package, target)
+ calendar.resize_date(work_package, target)
end
calendar.expect_and_dismiss_toaster(message: I18n.t('js.notice_successful_update'))
work_package.reload
expect(work_package.due_date).to eq target
+ expect(work_package.start_date).to eq current_start
+ end
+
+ it 'allows to resize from the start' do
+ target = work_package.start_date - 1.day
+ current_end = work_package.due_date
+
+ retry_block do
+ calendar.resize_date(work_package, target, end_date: false)
+ end
+
+ calendar.expect_and_dismiss_toaster(message: I18n.t('js.notice_successful_update'))
+
+ work_package.reload
+ expect(work_package.start_date).to eq target
+ expect(work_package.due_date).to eq current_end
end
it 'allows to drag the work package to another date' do
diff --git a/modules/calendar/spec/support/pages/calendar.rb b/modules/calendar/spec/support/pages/calendar.rb
index 09cd52d8bf2..e68ee34078e 100644
--- a/modules/calendar/spec/support/pages/calendar.rb
+++ b/modules/calendar/spec/support/pages/calendar.rb
@@ -53,7 +53,7 @@ module Pages
::Pages::SplitWorkPackageCreate.new project: project
end
- def resize_end_date(work_package, end_date)
+ def resize_date(work_package, date, end_date: true)
wp_strip = event(work_package)
page
@@ -63,8 +63,9 @@ module Pages
.move_to(wp_strip.native)
.perform
- resizer = wp_strip.find('.fc-event-resizer-end')
- end_container = date_container end_date
+ selector = end_date ? '.fc-event-resizer-end' : '.fc-event-resizer-start'
+ resizer = wp_strip.find(selector)
+ end_container = date_container date
drag_n_drop_element(from: resizer, to: end_container)
end