Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add form preview documentation and create a generic form preview controller #17589

Merged
merged 5 commits into from
Jan 16, 2025

Conversation

dombesz
Copy link
Contributor

@dombesz dombesz commented Jan 13, 2025

Ticket

https://community.openproject.org/wp/60573

What are you trying to accomplish?

Follow up documentation of the form preview pattern implemented in the Stages and Gates Project Overview page. Additionally a general form preview stimulus controller has been extracted that could be used as plug and play on any form.

Screenshots

What approach did you choose and why?

The documentation includes a live example of how to use the form preview stimulus controller. Additionally it describes how our backend services can handle the previews easily.

Merge checklist

  • Added/updated tests
  • Added/updated documentation in Lookbook (patterns, previews, etc)
  • Tested major browsers (Chrome, Firefox, Edge, ...)

@dombesz dombesz marked this pull request as ready for review January 13, 2025 12:22
@dombesz dombesz force-pushed the documentation/add-form-preview-documentation branch 2 times, most recently from 26e28db to 66522e6 Compare January 13, 2025 12:32
Copy link
Contributor

@HDinger HDinger left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks very solid, thanks for taking the time to write that down so detailed 🙇 I just have one remark.

@@ -31,22 +31,13 @@
import { Controller } from '@hotwired/stimulus';

export default class ProjectLifeCyclesFormController extends Controller {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Have you thought about letting ProjectLifeCyclesFormController inherit from FormPreviewController? Thus you would not have register two controllers and handle the dispatched event in the html but can do it directly in the controller.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My idea was that the FormPreviewController can also be used as a standalone controller and wanted to communicate with it that way.
However, inheritance in this case would definitely make things simpler. The dispatching logic could be spared.

Copy link
Contributor Author

@dombesz dombesz Jan 15, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@HDinger I changed the ProjectLifeCyclesFormController to inherit from the FormPreviewController.
I also cherry picked a bugfix related to this code from the release branch and updated the docs.

@dombesz dombesz force-pushed the documentation/add-form-preview-documentation branch from 0ab9106 to c7fa8b3 Compare January 15, 2025 12:06
@dombesz dombesz requested a review from HDinger January 15, 2025 16:56
@HDinger HDinger merged commit 2960bc5 into dev Jan 16, 2025
13 checks passed
@HDinger HDinger deleted the documentation/add-form-preview-documentation branch January 16, 2025 06:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging this pull request may close these issues.

2 participants