diff --git a/src/pages/Translations/TranslationCard.js b/src/pages/Translations/TranslationCard.js
index c84b0da4..f8dbac1f 100644
--- a/src/pages/Translations/TranslationCard.js
+++ b/src/pages/Translations/TranslationCard.js
@@ -69,7 +69,7 @@ const TranslationCard = (props) => {
alignItems="center"
>
- {props.object.name}
+ {props.object[props.cardTitleProperty]}
{getState() === TRANSLATED_ID && (
@@ -145,6 +145,7 @@ const TranslationCard = (props) => {
}
TranslationCard.propTypes = {
+ cardTitleProperty: PropTypes.string.isRequired,
clearFeedback: PropTypes.func.isRequired,
hasUnsavedChanges: PropTypes.func.isRequired,
localeId: PropTypes.string.isRequired,
diff --git a/src/pages/Translations/TranslationsList.js b/src/pages/Translations/TranslationsList.js
index 955bf2e8..8d905be2 100644
--- a/src/pages/Translations/TranslationsList.js
+++ b/src/pages/Translations/TranslationsList.js
@@ -54,6 +54,7 @@ const TranslationsList = (props) =>
openCard={props.openCard(object.id)}
openCardOnClick={props.openCardOnClick(object.id)}
clearFeedback={props.clearFeedback}
+ cardTitleProperty={props.cardTitleProperty}
/>
))}
{PaginationBuilder(
@@ -67,6 +68,7 @@ const TranslationsList = (props) =>
)
TranslationsList.propTypes = {
+ cardTitleProperty: PropTypes.string.isRequired,
clearFeedback: PropTypes.func.isRequired,
goToNextPage: PropTypes.func.isRequired,
goToPreviousPage: PropTypes.func.isRequired,
diff --git a/src/pages/Translations/index.js b/src/pages/Translations/index.js
index 00dff96e..023430aa 100644
--- a/src/pages/Translations/index.js
+++ b/src/pages/Translations/index.js
@@ -19,6 +19,10 @@ const DEFAULT_SNACKBAR_CONF = {
onActionClick: null,
}
+const OVERRIDE_TITLE_AND_SEARCH_PROPS = {
+ programRuleAction: 'content',
+}
+
/* auxiliar methods */
/* FIXME move to an external file, SchemaEntry class */
const modelToSchemaEntry = (model) => ({
@@ -538,7 +542,7 @@ class TranslationsPage extends PureComponent {
model
.list({
paging: false,
- fields: 'id,displayName,name,translations',
+ fields: 'id,displayName,name,content,translations',
})
.then((objects) => {
const objectInstances = objects ? objects.toArray() : []
@@ -653,14 +657,17 @@ class TranslationsPage extends PureComponent {
.trim()
.toLowerCase()
const newElements = []
-
for (let i = 0; i < elements.length; i++) {
const element = elements[i]
if (
- element.name
- .trim()
- .toLowerCase()
- .includes(currentSearchTerm)
+ element[
+ OVERRIDE_TITLE_AND_SEARCH_PROPS[
+ searchFilter.selectedObject?.id
+ ] ?? 'name'
+ ]
+ ?.trim()
+ ?.toLowerCase()
+ ?.includes(currentSearchTerm)
) {
const flatElement = flatElementForPropertiesAndLocale(
element,
@@ -832,6 +839,11 @@ class TranslationsPage extends PureComponent {
openCardOnClick={this.openCardOnClick}
hasUnsavedChanges={this.hasUnsavedChanges}
clearFeedback={this.clearFeedbackSnackbar}
+ cardTitleProperty={
+ OVERRIDE_TITLE_AND_SEARCH_PROPS[
+ this.state?.searchFilter?.selectedObject?.id
+ ] ?? 'name'
+ }
/>
{feedbackElement}