Skip to content
New issue

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

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

Already on GitHub? # to your account

[my_preference] Add support for my_preference widgets #8938

Merged
merged 2 commits into from
Jan 23, 2024

Conversation

driusan
Copy link
Collaborator

@driusan driusan commented Nov 7, 2023

This adds a new widget type, "userpreference" which allows modules to plug content into the user's my_preferences page.

It works similarly to the candidate_profile widget, where it assumes each call will return an array of UserPreferenceWidget's to add to the page, each one denoting a single react component. The UserPreferenceWidget must have:

  1. A title to display as a heading
  2. A URL to get the javascript for the component
  3. The component name to instantiate
  4. React props to pass to the widget

This is useful for ie. the OIDC module adding a widget where the user can link an external openid account to the logged in user, but can also be used for any other modules which have preferences that should be configurable by the user on the my_preferences page.

@laemtl laemtl assigned ridz1208 and laemtl and unassigned ridz1208 Dec 12, 2023
@laemtl
Copy link
Contributor

laemtl commented Jan 16, 2024

@driusan Should we fix the tests?

FILE: .../Loris/modules/my_preferences/php/userpreferencewidget.class.inc
----------------------------------------------------------------------
FOUND 4 ERRORS AFFECTING 4 LINES
----------------------------------------------------------------------
 23 | ERROR | [ ] Superfluous parameter comment
 24 | ERROR | [ ] Superfluous parameter comment
 25 | ERROR | [ ] Superfluous parameter comment
 [32](https://github.com/aces/Loris/actions/runs/6789898738/job/18458106479?pr=8938#step:11:33) | ERROR | [x] Closing brace must be on a line by itself
----------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
----------------------------------------------------------------------

* Renders the widget within a preference panel and implements
* the \LORIS\GUI\Widget interface.
*
* @return string the HTML content of the widget to be rendered
Copy link
Contributor

Choose a reason for hiding this comment

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

It seems to return an url, not html.

@laemtl laemtl self-requested a review January 16, 2024 18:26
@laemtl laemtl assigned driusan and unassigned laemtl Jan 16, 2024
This adds a new widget type, "userpreference" which allows modules
to plug content into the user's my_preferences page.
@driusan
Copy link
Collaborator Author

driusan commented Jan 23, 2024

Fixed tests and comment

@driusan driusan merged commit d7bef4a into aces:main Jan 23, 2024
19 checks passed
@ridz1208 ridz1208 added this to the 26.0.0 milestone Apr 9, 2024
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants