40 Commits

Author SHA1 Message Date
Christophe Bliard eae369ec1f [68402] Correctly recompute duration for automatic work packages with children
https://community.openproject.org/wp/68402

There was a bug where when switching to manual mode and clearing the
dates, the controller would also clear the duration and consider it as
being done by the user (touched field). Then when switching to automatic
mode, before calling the SetAttributesService, start date and finish
date would be discarded because the work package is in automatic mode.

The SetAttributesService would then think that the duration being empty
was done by the user, and would then also unset the finish date. That
lead to the incorrect display of the dates and duration in the date
picker: they would appear as empty instead of having the dates inherited
from the child.

Fix is to also discard the duration if the work package is automatically
scheduled and has children.
2025-10-17 15:57:40 +02:00
Dombi Attila 2bb3002748 Use a preview action for the work package datepicker.
This helps differentiating the form when it is initially rendered, or
due to a modification. This distinction is important to decide whether
the live_messages should be rendered or not. Initial rendering of the
dialog should not display live messages, as nothing has changed.
2025-07-02 01:21:19 +03:00
Dombi Attila ef35ec7ca9 Remove unecessary refresh attribute and turbo stream module from date picker controller. 2025-07-02 01:21:14 +03:00
Dombi Attila 8d786d86a7 Replace angular tags instead of ignoring them during the morphing process of the work package dialog. 2025-07-02 01:21:12 +03:00
Dombi Attila d9d1f4f4b1 Move live region message to the dialog component, use translations instead of hardcoded keys. 2025-07-02 01:21:10 +03:00
Dombi Attila 06c993d6a9 Use turbo frames for the create and update actions too. 2025-07-02 01:21:09 +03:00
Dombi Attila 5cb479cae6 Use turbo frames only to load wp datepicker responses. 2025-07-02 01:21:08 +03:00
Dombi Attila f87bbbb254 [#62523] Work package datepicker incorrectly renders turbo frame response
https://community.openproject.org/work_packages/62523
2025-07-02 01:21:07 +03:00
Christophe Bliard 775a0dc4a6 [64603] Fix milestone handling when switching from manual to automatic
https://community.openproject.org/wp/64603

When it's a milestone being updated, the due date was copied from the
start date. This works when the milestone is in manual scheduling mode,
but when it's in automatic scheduling mode, or when it's switched to
automatic scheduling mode, this copy gives a nil value to the due date,
and due date cannot be set because it's readonly in automatic
scheduling. This lead to the 422 error.

Now the copy of due date from start date is only done if the start date
parameter is present too.
2025-06-13 18:03:17 +02:00
Behrokh Satarnejad f1be1dadfe [60708] Implementing ARIA live regions to communicate contextual changes, (check for ignore-non-working-day value) (#18983)
check if ignore none working day is not nil
2025-05-22 08:45:29 +02:00
Behrokh Satarnejad 9b5fedb1ce [62708] Implementing ARIA live regions to communicate contextual changes (#17920)
* check if there is a screen reader active on page load

* hide the flat picker for screen readers

* make the banner focusable

* change the focus color in banner

* change disabled to readonly input fields

* change replace_via_turbo_stream to add a message to it

* add live region of github to out project

* add a method to send the aria message

* make it possible to pass the attributes

* pass type of aria live region to front-end based on the action

* remove focused field from date picker

* focus on tabs when there is no banner

* Revert "remove focused field from date picker"

This reverts commit ab5e3060343860e9c34514818f6d9eee59e91ee1.

* focus on the first element when opening the dialog

* remove auto-focus

* undo changes for adding a message

* add a new input method for adding a date and select today as a date

* remove label and name from form input

* change readonly to disabled

* undo changes for date-form

* delete dateform file

* add aria-live for fields in date pickr

* add a turbo stream to the component to load the messages for aria live regions

* undo changes for check f there is an active screen reader

* use settimeout instead of add event listener, so turbo frame also can be used hare

* undo changes for text with link form input

* remove text with link form input

* add documentation for aria-live region

* add an example for using current method in relation creation

* add aria live region in date-pickr dialog

* add some delay for polite messages to make sure it is caught

* send a message to be gotten by screen reader in date picker while changing inputs

* remove aria-live form inputs in date pickr

* show update message after any change in inputs of date picker

* fix rubocup errors in relation controller

* fix rubocup errors in datepicker controller

* fix eslint error

* update docs

* add some details to the aria live doc

* remove test for aria-live on inputs of date pickr

* remove unnecessary live region polite for date picker

* Update lookbook/docs/patterns/18-aria-live.md.erb

Co-authored-by: Henriette Darge <h.darge@openproject.com>

* Update lookbook/docs/patterns/18-aria-live.md.erb

Co-authored-by: Henriette Darge <h.darge@openproject.com>

* fix comment in preview controller

* remove role: alert

* set correct value for target

* move aria turbo stream below live region

* add missing spaces and a better headline for js handling turbo aria action

* move the exception of modals and dialogs to the end of doc file

* Update lookbook/docs/patterns/accessibility/18-aria-live.md.erb

Co-authored-by: Alexander Brandon Coles <a.coles@openproject.com>

* Update frontend/src/turbo/aria-stream-action.ts

Co-authored-by: Alexander Brandon Coles <a.coles@openproject.com>

* Update lookbook/docs/patterns/accessibility/18-aria-live.md.erb

Co-authored-by: Alexander Brandon Coles <a.coles@openproject.com>

* Update app/controllers/work_packages/date_picker_controller.rb

Co-authored-by: Alexander Brandon Coles <a.coles@openproject.com>

* Update lookbook/docs/patterns/accessibility/18-aria-live.md.erb

Co-authored-by: Alexander Brandon Coles <a.coles@openproject.com>

* Update app/controllers/concerns/op_turbo/component_stream.rb

Co-authored-by: Alexander Brandon Coles <a.coles@openproject.com>

* Update app/controllers/work_packages/date_picker_controller.rb

Co-authored-by: Alexander Brandon Coles <a.coles@openproject.com>

* Update app/controllers/work_packages/date_picker_controller.rb

Co-authored-by: Alexander Brandon Coles <a.coles@openproject.com>

* Update lookbook/docs/patterns/accessibility/18-aria-live.md.erb

Co-authored-by: Alexander Brandon Coles <a.coles@openproject.com>

* Update lookbook/docs/patterns/accessibility/18-aria-live.md.erb

Co-authored-by: Alexander Brandon Coles <a.coles@openproject.com>

* Update lookbook/docs/patterns/accessibility/18-aria-live.md.erb

Co-authored-by: Alexander Brandon Coles <a.coles@openproject.com>

* Update lookbook/docs/patterns/accessibility/18-aria-live.md.erb

Co-authored-by: Alexander Brandon Coles <a.coles@openproject.com>

* change parameter in update_inputs_aria_live_message string

* change type to politeness

* Update lookbook/docs/patterns/accessibility/18-aria-live.md.erb

Co-authored-by: Alexander Brandon Coles <a.coles@openproject.com>

* set delay for polite updates

* use delay in relations tab update and date pickr update

* remove the usage of aria live region update message in relations tab, since we should handle update message here in another way

* use assistive technology instead of screen reader only

* change the stream action to live region

* change the aria action to live region

* remove alert role

* change the string in away that if there is no value for start date, finish date or duration, it shouldn't be part of the string

* remove aria-live from input text fields

* test for updated message in date pickr

* undo changes for relations updates

* check if message is null then return

* add more delay for updating data in date picker

* fix test for adding more delay for updating data in date picker

---------

Co-authored-by: Henriette Darge <h.darge@openproject.com>
Co-authored-by: Alexander Brandon Coles <a.coles@openproject.com>
2025-05-21 13:08:21 +02:00
Christophe Bliard 9fc6f78c5d [63434] Fix read-only error displayed when editing progress values
https://community.openproject.org/wp/63434

The contract class being used was always `WorkPackages::CreateContract`.
It needs to be `WorkPackages::UpdateContract` when the user edits fields
so that the correct permissions are checked.

Also added a spec for the date picker controller.
2025-04-17 11:44:42 +02:00
Christophe Bliard 8c857fcaa1 refactor: make rubocop happier 2025-04-16 09:16:03 +02:00
Henriette Darge 50a169e986 Catch nil case 2025-04-14 12:47:55 +02:00
Henriette Darge f0c723ae43 Allow editing the finish date in automatic scheduling mode 2025-03-31 08:27:17 +02:00
Christophe Bliard c8f1454bb7 [62261] Fix error displayed when switching parent to automatic
https://community.openproject.org/wp/62261

When switching a parent to automatic scheduling mode, the date picker
displayed an error because the dates set in manual mode are reused.

Fix is to dismiss dates from `params` when the scheduling mode is
automatic, so that the dates are always computed.
2025-03-20 13:02:53 +01:00
Henriette Darge 61060f380f Preserve the triggering_field parameter through the updates of the datepicker 2025-03-14 11:44:49 +01:00
Henriette Darge b639c37d7a Implement special logic for clicking in a table date field which should enforce that field to be opended even if there would normally be a single-date mode (see #62058) 2025-03-14 11:44:48 +01:00
Christophe Bliard 8089679229 [62012] Avoid resetting calendar when enabling a date field
https://community.openproject.org/wp/62012

When clicking on a date field in single date mode, it used to
reinitialize the flatpickr instance. This happens because it was using a
turbo-stream to update the dialog. When doing so, the node where the
flatpickr is attached is replaced.

We have some logic to avoid this replacement in the preview controller:
it listens to turbo:before-frame-render events and avoids morphing for
tags starting with "opce".

As the logic is already there, this commit uses a turbo-frame instead of
a turbo-stream. This way the flatpickr instance is not replaced and the
calendar view is kept.

The controller had to be updated to alter the work package attributes
with the given params.
2025-03-13 12:17:12 +01:00
Henriette Darge 851415730f Always preserve the range mode once it is entered 2025-03-03 15:22:03 +01:00
Henriette Darge d5c370e74e Handle special cases that two fields have been cleared in which we assume that the user wants to delete all three values 2025-02-27 08:31:23 +01:00
Henriette Darge eba1dd57ce Keep focus on the active field when deleting it's value 2025-02-26 09:30:13 +01:00
Henriette Darge 1c0e72f275 Show a different path when we are in the create case 2025-02-26 08:36:13 +01:00
Henriette Darge fc9f48c8d5 Set focus when activating a date field and expect that in a test 2025-02-26 08:36:12 +01:00
Henriette Darge 7773a24677 Pass the "date_mode" param correctly 2025-02-26 08:36:12 +01:00
Henriette Darge 360b205791 Move toggling of date mode to the backend instead of trying to remember the sate in the frontend 2025-02-26 08:36:11 +01:00
Henriette Darge 9a9ce90583 Correctly focus the next date in single date mode 2025-02-26 08:36:09 +01:00
Christophe Bliard 6a23e115bc Fix "Insecure Mass Assignment" warning of CodeQL 2025-02-25 09:18:27 +01:00
Henriette Darge e71770fede Define the currently active field correctly and respect that when selecting a date from the datepicker 2025-02-25 09:18:07 +01:00
Henriette Darge 8eb752c275 Datepicker for WorkPackage Create case 2025-02-25 09:18:02 +01:00
Henriette Darge 5745e78b36 Handle Milestones in new datepicker modal 2025-02-25 09:18:01 +01:00
Henriette Darge 524347b4ff Please rubocop and eslint 2025-02-25 09:18:01 +01:00
Henriette Darge 2655b594c7 Correctly parese the duration 2025-02-25 09:17:57 +01:00
Henriette Darge fdc66f856b Correctly save the sheduling mode and duration 2025-02-25 09:17:55 +01:00
Henriette Darge 724901e230 First try on updating the datepicker when the fields above change 2025-02-25 09:17:55 +01:00
Henriette Darge e6fd54191b Update the dialog content when chaning the scheduling mode 2025-02-25 09:17:54 +01:00
Henriette Darge 1f291f0021 Update the dialog when the "ignore_non_working_days" checkbox is checked 2025-02-25 09:17:54 +01:00
Henriette Darge c597e9155a Extract logic of the progress modal to be reused for the datepicker modal as well 2025-02-25 09:17:54 +01:00
Henriette Darge df351f02ce Extract logic to update the edit field after the turboFrame was submitted into a directive so that it can be used for the datepicker as well 2025-02-25 09:17:53 +01:00
Henriette Darge 68dcf6c147 Render the form from rails and only the actual datepicker in angular. 2025-02-25 09:17:48 +01:00