gbif / gbif-web

Apache License 2.0
6 stars 8 forks source link

Custom components on composition pages #517

Open MortenHofft opened 1 month ago

MortenHofft commented 1 month ago

The composition pages is mostly composed of standard components. But there is also the option to have components that are typically only used once. Like a form.

Example: https://www.gbif.org/composition/7zgSnALNuD1OvzanAUPG4z/hosted-portals-application-form It is a page of contentType: composition, but with a custom block that refers to a named component that needs to be implemented. So in above entry there is a reference to block 2IYmYjB0tB4BCR6RY4UvUP which just refers to a component called hostedPortalForm. In code there is a switch statement that then picks that form component and inserts it. It is only used in that one page and will never will be used anywhere else.

Based on the content in the dropdown we only have 2 such custom components. We need to implement them.

It would be good to have both of these implemented. And the form in particular will serve as a basis for how we handle code that only runs server side (so far everything we write is being shipped to the client)

MortenHofft commented 1 month ago

current implementation: https://github.com/gbif/portal16/tree/master/app/controllers/api/tools/hostedPortals https://github.com/gbif/portal16/tree/master/app/views/components/pageComponents/hostedPortalForm