"- Select a value -" or "- None -" doesn't appear if term is single

Created on 10 May 2023, over 1 year ago
Updated 29 September 2023, about 1 year ago

Problem/Motivation

"- Select a value -" for required field or "- None -" for unrequired field doesn't appear (becomes empty) if term is single in a level.
They appear if terms are multiple in a level.

Steps to reproduce

Create terms; (See terms.png)
Level1 "1" > Level2 "1-1", "1-2", "1-3", "1-4"
Level1 "2" > Level2 "2-1"
Show SHS on a node. (See rc4_multiterm_OK.png, rc4_singleterm_NG.png, expected_singleterm.png)

Proposed resolution

Reverting /shs/js/views/WidgetView.js of 2.0.0-rc4 to 2.0.0-rc1 works OK.

diff WidgetView.js WidgetView.js.rc1
97a98,100
> // Add "any" option.
> widget.$el.append($('').text(widget.container.app.getSetting('anyLabel')).val(widget.container.app.getSetting('anyValue')));
>
122,126d124
<
< // Add "any" option.
< if (widget.model.itemCollection.length > 1) {
< widget.$el.append($('').text(widget.container.app.getSetting('anyLabel')).val(widget.container.app.getSetting('anyValue')));

🐛 Bug report
Status

RTBC

Version

2.0

Component

Code

Created by

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Production build 0.71.5 2024