Skip to content

Commit 97587d0

Browse files
committed
After QA
1 parent ce73425 commit 97587d0

File tree

2 files changed

+17
-3
lines changed

2 files changed

+17
-3
lines changed

src/bundle/Resources/public/js/scripts/fieldType/ezobjectrelationlist.js

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,7 @@
8787
const itemNodeNameCell = itemNode.querySelector('.ibexa-relations__item-name');
8888

8989
itemNode.dataset.contentId = contentId;
90+
itemNode.dataset.locationId = locationId;
9091
itemNode.querySelector('.ibexa-relations__table-action--remove-item').addEventListener('click', removeItem, false);
9192

9293
itemNodeNameCell.dataset.ibexaUpdateContentId = contentId;
@@ -128,9 +129,15 @@
128129
};
129130
const openUDW = (event) => {
130131
event.preventDefault();
131-
132+
const selectedItemsRow = fieldContainer.querySelectorAll(SELECTOR_ROW);
132133
const config = JSON.parse(event.currentTarget.dataset.udwConfig);
133134
const limit = parseInt(event.currentTarget.dataset.limit, 10);
135+
const selectedLocations = [...selectedItemsRow].reduce((locationsIds, selectedItemRow) => {
136+
const { locationId } = selectedItemRow.dataset;
137+
const parsedLocationId = parseInt(locationId, 10);
138+
139+
return isNaN(parsedLocationId) ? locationsIds : [...locationsIds, parsedLocationId];
140+
}, []);
134141
const title =
135142
limit === 1
136143
? Translator.trans(
@@ -151,6 +158,7 @@
151158
onCancel: closeUDW,
152159
title,
153160
startingLocationId,
161+
selectedLocations,
154162
...config,
155163
multiple: isSingle ? false : selectedItemsLimit !== 1,
156164
multipleItemsLimit: selectedItemsLimit > 1 ? selectedItemsLimit - selectedItems.length : selectedItemsLimit,

src/bundle/Resources/views/themes/admin/ui/field_type/edit/relation_base.html.twig

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,10 @@
170170
{% set body_rows = body_rows|merge([{
171171
cols: body_row_cols,
172172
class: 'ibexa-relations__item',
173-
attr: { 'data-content-id': relation.contentInfo.id },
173+
attr: {
174+
'data-content-id': relation.contentInfo.id,
175+
'data-location-id': relation.contentInfo.mainLocationId,
176+
},
174177
}]) %}
175178
{% elseif relation.unauthorized %}
176179
{% set col_raw_unauthorised %}
@@ -194,7 +197,10 @@
194197
{ content: col_raw_order_input, raw: true, attr: { class: 'ibexa-relations__order-wrapper' } }
195198
],
196199
class: 'ibexa-relations__item',
197-
attr: { 'data-content-id': relation.contentId },
200+
attr: {
201+
'data-content-id': relation.contentId,
202+
'data-location-id': relation.contentInfo.mainLocationId,
203+
},
198204
}]) %}
199205
{% endif %}
200206
{% endfor %}

0 commit comments

Comments
 (0)