Skip to content

Commit

Permalink
FIX Add default link type title and icon
Browse files Browse the repository at this point in the history
  • Loading branch information
Sabina Talipova committed Jan 18, 2024
1 parent 663a13f commit 0fdd946
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 6 deletions.
2 changes: 1 addition & 1 deletion client/dist/js/bundle.js

Large diffs are not rendered by default.

3 changes: 2 additions & 1 deletion client/lang/en.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ if (typeof(ss) === 'undefined' || typeof(ss.i18n) === 'undefined') {
"LinkField.FAILED_TO_SAVE_LINK": "Failed to save link",
"LinkField.SAVE_RECORD_FIRST": "Cannot add links until the record has been saved",
"LinkField.SORT_SUCCESS": "Updated link sort order",
"LinkField.SORT_ERROR": "Unable to sort links"
"LinkField.SORT_ERROR": "Unable to sort links",
"LinkField.DEFAULT_TYPE_TITLE": "Link",
});
}
3 changes: 2 additions & 1 deletion client/lang/src/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,6 @@
"LinkField.FAILED_TO_SAVE_LINK": "Failed to save link",
"LinkField.SAVE_RECORD_FIRST": "Cannot add links until the record has been saved",
"LinkField.SORT_SUCCESS": "Updated link sort order",
"LinkField.SORT_ERROR": "Unable to sort links"
"LinkField.SORT_ERROR": "Unable to sort links",
"LinkField.DEFAULT_TYPE_TITLE": "Link"
}
5 changes: 3 additions & 2 deletions client/src/components/LinkField/LinkField.js
Original file line number Diff line number Diff line change
Expand Up @@ -176,14 +176,15 @@ const LinkField = ({
continue;
}
const type = types.hasOwnProperty(data[linkID]?.typeKey) ? types[data[linkID]?.typeKey] : {};
const typeTitle = (type && type.hasOwnProperty('title')) ? type.title : i18n._t('LinkField.DEFAULT_TYPE_TITLE', 'Link');
links.push(<LinkPickerTitle
key={linkID}
id={linkID}
title={data[linkID]?.Title}
description={data[linkID]?.description}
versionState={data[linkID]?.versionState}
typeTitle={type.title || ''}
typeIcon={type.icon}
typeTitle={typeTitle}
typeIcon={type.icon || 'font-icon-link'}
onDelete={onDelete}
onClick={() => { setEditingID(linkID); }}
canDelete={data[linkID]?.canDelete ? true : false}
Expand Down
3 changes: 2 additions & 1 deletion client/src/containers/LinkModalContainer.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,14 @@ const LinkModalContainer = ({ types, typeKey, linkID = 0, isOpen, onSuccess, onC
}

const type = types.hasOwnProperty(typeKey) ? types[typeKey] : {};
const typeTitle = (type && type.hasOwnProperty('title')) ? type.title : i18n._t('LinkField.DEFAULT_TYPE_TITLE', 'Link');
const handlerName = type && type.hasOwnProperty('handlerName')
? type.handlerName
: 'FormBuilderModal';
const LinkModal = loadComponent(`LinkModal.${handlerName}`);

return <LinkModal
typeTitle={type.title || ''}
typeTitle={typeTitle}
typeKey={typeKey}
linkID={linkID}
isOpen={isOpen}
Expand Down

0 comments on commit 0fdd946

Please sign in to comment.