Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RA now validates mas length of 200 characters on Post text #461

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/components/Admin/resources/cms/post/PostCreate.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import {FC} from 'react'
import {ArrayInput, FormTab, required, SimpleFormIterator, TabbedForm, TextInput} from 'react-admin'
import {ArrayInput, FormTab, maxLength, required, SimpleFormIterator, TabbedForm, TextInput} from 'react-admin'

import {MyCreate} from '@/components/Admin/custom/MyCreate'
import {MyDateTimeInput} from '@/components/Admin/custom/MyDateTimeInput'
Expand All @@ -12,7 +12,7 @@ export const PostCreate: FC = () => {
<TabbedForm>
<FormTab label="general">
<TextInput source="caption" fullWidth validate={required()} />
<TextInput source="short_text" fullWidth validate={required()} />
<TextInput source="short_text" fullWidth validate={maxLength(200, 'Text musí mať najviac 200 znakov.')} />
<TextInput source="details" multiline fullWidth />
<MyDateTimeInput source="added_at" fullWidth disabled defaultValue={new Date().toISOString()} />
<MyDateTimeInput source="visible_after" fullWidth validate={required()} />
Expand Down
4 changes: 2 additions & 2 deletions src/components/Admin/resources/cms/post/PostEdit.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import {FC} from 'react'
import {ArrayInput, FormTab, required, SimpleFormIterator, TabbedForm, TextInput} from 'react-admin'
import {ArrayInput, FormTab, maxLength, required, SimpleFormIterator, TabbedForm, TextInput} from 'react-admin'

import {MyDateTimeInput} from '@/components/Admin/custom/MyDateTimeInput'
import {MyEdit} from '@/components/Admin/custom/MyEdit'
Expand All @@ -11,7 +11,7 @@ export const PostEdit: FC = () => (
<TabbedForm>
<FormTab label="general">
<TextInput source="caption" fullWidth validate={required()} />
<TextInput source="short_text" fullWidth validate={required()} />
<TextInput source="short_text" fullWidth validate={maxLength(200, 'Text musí mať najviac 200 znakov.')} />
<TextInput source="details" multiline fullWidth />
<MyDateTimeInput source="added_at" fullWidth disabled />
<MyDateTimeInput source="visible_after" fullWidth validate={required()} />
Expand Down
Loading