Uploaded image for project: 'XWiki Platform'
  1. XWiki Platform
  2. XWIKI-25733

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

    XMLWordPrintable

Details

    • Bug
    • Resolution: Invalid
    • Major
    • None
    • 18.2.0-rc-1
    • None
    • Unknown

    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' 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.

      Attachments

        Issue Links

          Activity

            People

              mleduc Manuel Leduc
              mleduc Manuel Leduc
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: