Skip to content

Commit

Permalink
RA: Fix Flatpage edit (PATCH to /undefined) (#526)
Browse files Browse the repository at this point in the history
* fix #513 - remove ID fields/inputs on Flatpage model

* move base/flat-page -> cms/flat-page
  • Loading branch information
rtrembecky authored Dec 14, 2024
1 parent 1d335f6 commit efe2c42
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 12 deletions.
8 changes: 4 additions & 4 deletions src/components/Admin/Admin.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ import {Admin as ReactAdmin, defaultDarkTheme, defaultLightTheme, RaThemeOptions
import {AdminLayout} from './AdminLayout'
import {dataProvider} from './dataProvider'
import {myI18nProvider} from './i18nProvider'
import {FlatpageCreate} from './resources/base/flat-page/FlatpageCreate'
import {FlatpageEdit} from './resources/base/flat-page/FlatpageEdit'
import {FlatpageList} from './resources/base/flat-page/FlatpageList'
import {FlatpageShow} from './resources/base/flat-page/FlatpageShow'
import {FlatpageCreate} from './resources/cms/flat-page/FlatpageCreate'
import {FlatpageEdit} from './resources/cms/flat-page/FlatpageEdit'
import {FlatpageList} from './resources/cms/flat-page/FlatpageList'
import {FlatpageShow} from './resources/cms/flat-page/FlatpageShow'
import {PostCreate} from './resources/cms/post/PostCreate'
import {PostEdit} from './resources/cms/post/PostEdit'
import {PostList} from './resources/cms/post/PostList'
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import {FC} from 'react'
import {FormTab, NumberInput, required, TabbedForm, TextInput} from 'react-admin'
import {FormTab, required, TabbedForm, TextInput} from 'react-admin'

import {FlatpagePreview} from '@/components/Admin/custom/FlatpagePreview'
import {MyCreate} from '@/components/Admin/custom/MyCreate'
Expand All @@ -8,7 +8,6 @@ export const FlatpageCreate: FC = () => (
<MyCreate>
<TabbedForm>
<FormTab label="content.labels.general">
<NumberInput source="id" fullWidth disabled />
<TextInput source="url" fullWidth validate={required()} />
<TextInput source="title" fullWidth validate={required()} />
<TextInput source="content" multiline fullWidth validate={required()} />
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import {FC} from 'react'
import {FormTab, NumberInput, required, TabbedForm, TextInput} from 'react-admin'
import {FormTab, required, TabbedForm, TextInput} from 'react-admin'

import {FlatpagePreview} from '@/components/Admin/custom/FlatpagePreview'
import {MyEdit} from '@/components/Admin/custom/MyEdit'
Expand All @@ -8,7 +8,6 @@ export const FlatpageEdit: FC = () => (
<MyEdit>
<TabbedForm>
<FormTab label="content.labels.general">
<NumberInput source="id" fullWidth disabled />
<TextInput source="url" fullWidth validate={required()} />
<TextInput source="title" fullWidth validate={required()} />
<TextInput source="content" multiline fullWidth validate={required()} />
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
import {FC} from 'react'
import {Datagrid, List, NumberField, TextField} from 'react-admin'
import {Datagrid, List, TextField} from 'react-admin'

import {TruncatedTextField} from '@/components/Admin/custom/TruncatedTextField'

export const FlatpageList: FC = () => (
<List>
<Datagrid>
<NumberField source="id" />
<TextField source="url" />
<TextField source="title" />
<TruncatedTextField source="content" maxTextWidth={30} />
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
import {FC} from 'react'
import {NumberField, Show, SimpleShowLayout, TextField} from 'react-admin'
import {Show, SimpleShowLayout, TextField} from 'react-admin'

import {MyShowActions} from '@/components/Admin/custom/MyShowActions'
import {TruncatedTextField} from '@/components/Admin/custom/TruncatedTextField'

export const FlatpageShow: FC = () => (
<Show actions={<MyShowActions />}>
<SimpleShowLayout>
<NumberField source="id" />
<TextField source="url" />
<TextField source="title" />
<TruncatedTextField source="content" maxTextWidth={200} expandable />
Expand Down

0 comments on commit efe2c42

Please sign in to comment.