37 Commits

Author SHA1 Message Date
Klaus Zanders 1d91460c84 Extract progress modal form glue into a shared ModalParams concern 2026-06-10 15:40:15 +02:00
Christophe Bliard e8bdff0cbc [65303] Display non-progress errors in a top banner
https://community.openproject.org/wp/65303

When there are errors on the work package when saving the progress
tracking values, the modal is rendered again with those errors so that
the invalid fields are highlighted and have a validation error message.

When the error is external to the progress modal, for instance a
mandatory custom field or an invalid project phase, it is displayed in a
top banner with a flash message. Before the error was not displayed at
all, leaving users confused as why the progress values could not be
saved.
2025-07-03 12:15:13 +02:00
Christophe Bliard 029864a859 refactor: use more conventional way to render the progress modal
Render it using our component wrapper and
`update_via_turbo_stream(method: "morph")`. Move `<turbo-frame>` of
progress modal from component to the view to avoid double rendering of
the turbo-frame tag.

Inspired by PR #18152 where a similar was done for date picker modal.
2025-07-03 11:26:20 +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
Kabiru Mwenja b52debb70d Style/ItBlockParameter: Use it block parameter.RuboCopStyle/ItBlockParameter (#19318) 2025-06-26 13:36:49 +03:00
Christophe Bliard be8d290e4c [62580] Fix read-only error displayed when editing progress values
https://community.openproject.org/wp/62580

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.
2025-03-28 11:07:19 +01:00
Christophe Bliard 4ac1b1ca7a Remove :percent_complete_edition feature flag
% complete edition will be released in 14.6
2024-09-25 15:31:11 +02:00
Christophe Bliard 32ec9df11e Merge pull request #16730 from opf/impl/57530-options-for-changing-%-complete-when-closing-work-package
[57530] Add percent_complete_on_status_closed setting
2024-09-18 16:28:29 +02:00
Christophe Bliard b36078654b refactoring: reduce methods to check progress calculation mode 2024-09-18 11:48:42 +02:00
Christophe Bliard 0a5765f21a Fix lost progress popover state on submit with invalid values
When submitting with invalid values, the progress popover was updated
via turbo-stream with a modal which did not include the touched fields.
This caused the fields to be ignored on the second submit, even if they
appeared to be invalid. This was also causing the preview to not work as
expected.

This has been changed:
- the update is done through a turbo-stream morph instead of an update.
  It avoids disconnecting and reconnecting the stimulus controllers.
- the touched fields are now correctly sent to the component for
  rendering. The state is maintained in the stimulus controller instead
  of the hidden fields. Fields are still needed for form submission.
- the fields sent to the server when previewing are exactly the same as
  the ones being sent on submit.
- the turbo_stream commands are sent directly from the controller. None
  are sent if the update completed successfully as the modal will be
  closed by client side javascript anyway.
- the referrer-field is now just the field name instead of the full
  work package key, to reduce noise.
2024-09-17 13:49:35 +02:00
Oliver Günther 12ee9e6b83 Merge remote-tracking branch 'origin/idea/56781-remove-years-from-copyrights' into dev 2024-08-06 10:17:59 +02:00
Ivan Kuchin 4911b8a149 remove years from copyrights (except for COPYRIGHT file) 2024-07-31 15:02:49 +02:00
Christophe Bliard 38fcd07836 [52233] Add feature flag for modification of % complete field
Feature flag is percent_complete_edition. So % complete edition will be
shipped but disabled in 14.4.

It will eventually be activated in 15.0 when there will be a total %
complete calculation mode so that we can bundle both features together
in one release.
2024-07-17 17:24:04 +02:00
Christophe Bliard 706c5b228a Fix progress value live preview in new work package page
The values were not retained between modifications of percent values, so
a new parameter `initial` was introduced to "save" the entered values
between edits.

It also fixed the progress modal having empty values when opening it a
second time in the create work package page.
2024-07-15 17:32:33 +02:00
Christophe Bliard 7725acc10c [52233] Allow edition of % Complete
Still incomplete and some tests are failing, but this is usable first
draft.
2024-07-11 09:58:16 +02:00
Oliver Günther 2684ff1efd Merge remote-tracking branch 'origin/release/14.2' into dev 2024-06-13 19:03:42 +02:00
Christophe Bliard 259222b2e1 Remove now useless format_durations parameter 2024-06-13 15:42:40 +02:00
Christophe Bliard 7a588db68a Only use user-supplied values when updating progress 2024-06-13 12:09:26 +02:00
Jens Ulferts 5a176ba9f3 Merge pull request #15733 from opf/code-maintenance/55192-require-authorize-by-default-for-controller-actions
[#55192] require authorize by default for controller actions
2024-06-11 11:31:06 +02:00
ulferts fdbd6b6d5a forcing to specify allowed actions when forfeiting authorization check 2024-06-11 10:29:22 +02:00
Aaron Contreras 3eb38bb3e4 Show formatted durations solely when blurring the input field 2024-06-07 15:14:57 -05:00
ulferts ed5a162230 allow actions to be called on those not using default authorization before_actions 2024-06-07 16:55:40 +02:00
Christophe Bliard 69b61c3352 Handle conversion of duration strings to hours in model
This allows to do things like `wp.estimated_hours = "3d 4h 30m"`
directly so that all the code can benefit from it.
2024-06-06 16:25:26 +02:00
Aaron Contreras c1e46072e9 Ensure only valid durations are accepted
Strings such as "Hello world" aren't durations and hence, should not
be parsed or continue through to the services. An early validation at
the controller level guards against these.
2024-06-04 10:45:13 -05:00
Aaron Contreras f844feb58e Extract parsing and formatting logic for duration into service 2024-05-07 11:48:23 -05:00
Aaron Contreras ec5b0300d6 Parse and format modal progress fields 2024-05-07 11:48:22 -05:00
Christophe Bliard 4fabb80cf9 Merge branch 'release/14.0' into feature-add-turbo-frame-morphing 2024-04-23 08:56:39 +02:00
Christophe Bliard 00c078e535 [54370] Prevent error when saving unset progress modal
See https://community.openproject.org/wp/54370

It was producing a 500 error.
2024-04-22 16:09:55 +02:00
Aaron Contreras 80a992e551 Fix modal rendering for new work packages 2024-04-19 17:48:23 -05:00
Aaron Contreras e086ecb8fe Flag changed fields for change detection on server side 2024-04-17 10:49:01 -05:00
Aaron Contreras 9bb78a8591 Ensure user is allowed to see the requested work package
Thanks Klaus!

Co-authored-by: Klaus Zanders <klaustopher@users.noreply.github.com>
2024-04-10 07:35:33 -05:00
Aaron Contreras 61435a40fa Allow status_id being set in ProgressController 2024-04-03 11:25:59 -05:00
Aaron Contreras e3250c481a Allow interacting with progress modal on new work package form 2024-04-02 13:13:00 -05:00
Aaron Contreras 7ba30580d4 Allow interacting with progress modal on new work package form 2024-04-02 09:52:01 -05:00
Aaron Contreras ac23016a1e Add status-based version of progress modal 2024-03-28 16:32:18 -05:00
Aaron Contreras 8fbe98fea5 Autofocus the clicked field upon the modal opening
In order to forward context to the modal, it will autofocus the clicked
on field that triggered it to open.
2024-03-28 16:32:16 -05:00
Aaron Contreras 19d05a57b2 Interact with progress fields via a modal
* Renders a modal with an edit form for work and remaining work fields.

* Renders a turbo frame within a spot-drop-modal.

* Handles propagating changes from Rails form submissions in an Angular
  context.
2024-03-28 16:32:16 -05:00