This issue has been created
There are 3 updates.
 
 
XWiki Platform / cid:jira-generated-image-avatar-399d76e2-40e9-435c-8c93-79d64b02a688 XWIKI-25733 Open

The class picker options are no longer links to the class pages

 
View issue   ยท   Add comment
 

Issue created

 
cid:jira-generated-image-avatar-11a0a6c6-f18b-4629-aae4-8d6e2ccb5159 Manuel Leduc created this issue on 12/Nov/26 10:14
 
Summary: The class picker options are no longer links to the class pages
Issue Type: cid:jira-generated-image-avatar-399d76e2-40e9-435c-8c93-79d64b02a688 Bug
Affects Versions: 18.2.0-rc-1
Assignee: Unassigned
Components: Web - Templates & Resources
Created: 12/Nov/26 10:14
Priority: cid:jira-generated-image-static-major-adee5f76-c32c-4438-8582-fcfd0b1fe57f Major
Reporter: Manuel Leduc
Description:

The class picker no longer shows its options as links to the class pages. Each class in the drop-down list (and each selected class) should be a link to its class page, as it was before the suggest widget moved to Tom Select. It is now plain text.

The class picker is used by:

  • the "Select a Class" field of the object editor, to add an object
  • the "Edit another class" field of the class editor
  • the Records macro, for its data type parameter

Steps to reproduce

  1. Edit any page with the object editor.
  2. Open the "Select a Class" drop-down list.

Expected: each class label is a link to its class page.
Actual: the labels are plain text.

Cause

The #classPicker Velocity macro of templates/macros.vm puts the class URL in a data-data attribute on each <option>, and the renderCommon function of uicomponents/suggest/xwiki.selectize.js wraps the label in a link when the option has a url. Selectize read data-data by default. Tom Select reads it only when the dataAttr setting is set, and its default is null. xwiki.selectize.js doesn't set it, so the URL is ignored.

Checked on 18.10.0-SNAPSHOT: in the object editor, data-data is present on all 121 options, tomselect.settings.dataAttr is null, and no option holds a link. #classPicker is the only producer of data-data in xwiki-platform.

A possible fix: add dataAttr: 'data-data' to the default settings of xwiki.selectize.js.

 
 

3 updates

 
cid:jira-generated-image-avatar-11a0a6c6-f18b-4629-aae4-8d6e2ccb5159 Changes by Manuel Leduc on 12/Nov/26 10:18
 
Description: The class picker no longer shows its options as links to the class pages. Each class in the drop-down list (and each selected class) should be a link to its class page, as it was before the suggest widget moved to Tom Select. It is now plain text.

The class picker is used by:
* the "Select a Class" field of the object editor, to add an object
* the "Edit another class" field of the class editor
* the Records macro, for its data type parameter

h2. Steps to reproduce

# Edit any page with the object editor.
# Open the "Select a Class" drop-down list.

*Expected:* each class label is a link to its class page.
*Actual:* the labels are plain text.

h2. Cause

The {{#classPicker}} Velocity macro of {{templates/macros.vm}} puts the class URL in a {{data-data}} attribute on each {{<option>}}, and the {{renderCommon}} function of {{uicomponents/suggest/xwiki.selectize.js}} wraps the label in a link when the option has a {{url}}. Selectize read {{data-data}} by default. Tom Select reads it only when the {{dataAttr}} setting is set, and its default is {{null}}. {{xwiki.selectize.js}} doesn't set it, so the URL is ignored.

Checked on 18.10.0-SNAPSHOT: in the object editor, {{data-data}} is present on all 121 options, {{tomselect.settings.dataAttr}} is {{null}}, and no option holds a link. {{#classPicker}} is the only producer of {{data-data}} in xwiki-platform.

A possible fix: add {{dataAttr: 'data
-data '}} to the default settings of {{xwiki.selectize.js}}. Tom Select looks the attribute up in the element's {{dataset}}, whose keys drop the {{data-}} prefix, so {{'data-data'}} would not work. Checked on 18.10.0-SNAPSHOT by injecting this setting in the browser: the option labels become links to the class pages again.
Priority: Major Blocker
Labels: regression