Ticket #13824 (new Bug)

Opened 2 years ago

Last modified 23 months ago

Can't change order of related items in content edit view

Reported by: dholth Owned by:
Priority: minor Milestone: 4.x
Component: Unknown Version: 4.3
Keywords: Cc:

Description

When I try to change the order of a page's related items in the 'categorization' tab of the /edit view, the up/down arrows cause a page load instead of re-ordering the items.

Instead, the up/down arrows should change the order of the related items.

This behavior is caused by the arrow's onclick= handler referencing a non-global JavaScript function.

Perhaps at some point it was redesigned to be applied to a sortable area by the javascript instead of being called directly from the HTML.

 https://github.com/plone/archetypes.referencebrowserwidget/blob/master/src/archetypes/referencebrowserwidget/skins/referencebrowser/referencebrowser.pt#L177

 https://github.com/plone/archetypes.referencebrowserwidget/blob/master/src/archetypes/referencebrowserwidget/skins/referencebrowser/referencebrowser.js#L269

Change History

comment:1 Changed 2 years ago by dholth

A quick fix is to just export the relevant functions from referencebrowser.js like so. A different way might be to change the form HTML so that the 'onload' script adds the correct click handler.

  // expose these two Up/Down functions as global because the widget calls them.
  window['refbrowser_moveReferenceUp'] = refbrowser_moveReferenceUp;
  window['refbrowser_moveReferenceDown'] = refbrowser_moveReferenceDown;

comment:2 Changed 23 months ago by jensens

this bug is referenced in pull request  https://github.com/plone/archetypes.referencebrowserwidget/pull/13 and in there also #13879 is referenced. So this needs clarification and a decision.

Note: See TracTickets for help on using tickets.