Skip to content

Commit 501348d

Browse files
authored
IBX-7801: Removed upload files button from non container content (#1601)
1 parent 29d9997 commit 501348d

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

src/bundle/Resources/public/js/scripts/admin.location.view.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import { checkIsContainer } from './helpers/content.type.helper';
2+
13
(function (global, doc, localStorage, bootstrap, React, ReactDOMClient, ibexa, Routing, Translator) {
24
const SELECTOR_MODAL_BULK_ACTION_FAIL = '#bulk-action-failed-modal';
35
const listContainers = doc.querySelectorAll('.ibexa-sil');
@@ -181,6 +183,7 @@
181183
onPopupClose: (itemsUploaded) => itemsUploaded.length && global.location.reload(true),
182184
contentCreatePermissionsConfig: JSON.parse(container.dataset.mfuCreatePermissionsConfig),
183185
contentTypesMap: mfuContentTypesMap,
186+
withUploadButton: checkIsContainer(mfuContainer.dataset.parentContentTypeIdentifier),
184187
},
185188
},
186189
],

src/bundle/Resources/public/js/scripts/helpers/content.type.helper.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,14 @@ const getContentTypeDataByHref = (contentTypeHref) => {
117117
return contentTypesDataMapByHref[contentTypeHref];
118118
};
119119

120+
const checkIsContainer = (contentTypeIdentifier) => {
121+
if (!contentTypesDataMap) {
122+
contentTypesDataMap = createContentTypeDataMap();
123+
}
124+
125+
return contentTypesDataMap[contentTypeIdentifier]?.isContainer ?? false;
126+
};
127+
120128
export {
121129
createContentTypeDataMapByHref,
122130
getContentTypeDataMapByHref,
@@ -127,4 +135,5 @@ export {
127135
getContentTypeDataByHref,
128136
getContentTypeNameByHref,
129137
getContentTypeIdentifierByHref,
138+
checkIsContainer,
130139
};

0 commit comments

Comments
 (0)