Revert "WIP: demonstrates handling fallback locale on the front end instead of in the api"
This reverts commit c9a579b1df.
This commit is contained in:
@@ -20,9 +20,9 @@ const withEditData = PassedComponent => {
|
||||
|
||||
fetchData = () => {
|
||||
const { id } = this.props.match.params;
|
||||
|
||||
const params = {
|
||||
// TODO: if the app is not using localization this will need to be revisited
|
||||
locale: 'all'
|
||||
locale: this.props.locale
|
||||
};
|
||||
|
||||
if (id) {
|
||||
|
||||
@@ -5,15 +5,6 @@ import './index.scss';
|
||||
|
||||
const EditView = props => {
|
||||
|
||||
function title() {
|
||||
// TODO: this doesn't work because props.locale is missing
|
||||
// TODO: if the app is not using localization this will need to be revisited
|
||||
if (Object.keys(props.data).length > 0 && props.locale) {
|
||||
return props.data[props.collection.useAsTitle] ? props.data[props.collection.useAsTitle]['en'] || props.data[props.collection.useAsTitle] : '[Untitled]';
|
||||
}
|
||||
return '[Untitled]';
|
||||
}
|
||||
|
||||
const nav = [{
|
||||
url: `/collections/${props.collection.slug}`,
|
||||
label: props.collection.label
|
||||
@@ -22,7 +13,7 @@ const EditView = props => {
|
||||
if (props.isEditing) {
|
||||
nav.push({
|
||||
url: `/collections/${props.collection.slug}/${props.data._id}`,
|
||||
label: props.data ? title() : ''
|
||||
label: props.data ? props.data[props.collection.useAsTitle] : ''
|
||||
})
|
||||
} else {
|
||||
nav.push({
|
||||
@@ -36,7 +27,9 @@ const EditView = props => {
|
||||
<header>
|
||||
{props.isEditing &&
|
||||
<h1>
|
||||
Edit {title()}
|
||||
Edit {Object.keys(props.data).length > 0 &&
|
||||
(props.data[props.collection.useAsTitle] ? props.data[props.collection.useAsTitle] : '[Untitled]')
|
||||
}
|
||||
</h1>
|
||||
}
|
||||
{!props.isEditing &&
|
||||
|
||||
Reference in New Issue
Block a user