There is 1 comment.
 
 
XWiki Platform / cid:jira-generated-image-avatar-089179c1-bd88-452d-8acf-557f8312f04f XWIKI-24636 Open

Create a multi location/space picker

 
View issue   ยท   Add comment
 

1 comment

 
cid:jira-generated-image-avatar-1026392e-cf62-42b3-adc9-9d85ab812118 Charpentier Lucas on 29/Jul/26 11:11
 

> I think that's a lot of pickers and you're adding a new one. We need to rationality and stop spawing page pickers

It's not a page picker but a location/space picker. The concepts are slightly different, and the more we go in the backend the more this difference shows up.
Right now you can see this difference still in https://extensions.xwiki.org/xwiki/bin/view/Extension/Notifications%20Macro/#HUsage. A lot of spaces are tied to a page but some can exist where there's no page, which makes it awkward to reuse a page picker for this.
We chatted with Simon Urli yesterday and there should be other XS macros that need this picker and right now use a raw string input because there's no proper option.

The location picker at https://extensions.xwiki.org/xwiki/bin/view/Extension/Document%20Picker#HLocationPickerMacro only supports a single location, we can base our new one on it, but a good part of the UI needs to change to fit all the locations at once. In addition, it's currently not wired at all to the macro field edition contrary to https://www.xwiki.org/xwiki/bin/view/Documentation/DevGuide/FrontendResources/AutoSuggestWidget/#HSuggestPages . The locationPicker is quite large to include in a modal, so I decided to go with a UI that saves space in https://github.com/xwiki/xwiki-platform/pull/6005 .

To be clear on the implementation I planned, this isn't a brand new picker, it's built mostly on existing pickers:

  • The Velocity macro (#spacePicker) is a near copy of the existing picker macros, using the same generic #suggestInput/#picker_import plumbing.
  • The suggestion widget (suggestSpaces.js) reuses xwiki-selectize.
  • The "browse" dropdown reuses the existing document tree (#documentTree/jstree).
  • It queries already existing REST search endpoints.

The only genuinely new code is the glue bringing these together for the List<SpaceReference> macro field case (which didn't have any picker before) and the document-tree/suggest-input synchronisation logic working in multiple entry case.