Add additional validation measures and create triggers for last modified columns

This commit is contained in:
Thilo Hohlt
2024-08-05 16:03:07 +02:00
parent fa500cf376
commit 62db2776a7
6 changed files with 127 additions and 28 deletions

View File

@@ -33,6 +33,8 @@
type="color"
name="accent-color-light"
value={data.globalSettings.accent_color_light_theme}
pattern="\S(.*\S)?"
required
/>
</label>
<label>
@@ -41,6 +43,8 @@
type="color"
name="accent-color-dark"
value={data.globalSettings.accent_color_dark_theme}
pattern="\S(.*\S)?"
required
/>
</label>
<label>
@@ -74,11 +78,22 @@
</label>
<label>
Logo text:
<input type="text" name="logo-text" value={data.header.logo_text} />
<input
type="text"
name="logo-text"
value={data.header.logo_text}
pattern="\S(.*\S)?"
required={data.header.logo_type === "text"}
/>
</label>
<label>
Logo image:
<input type="file" name="logo-image" accept={ALLOWED_MIME_TYPES.join(", ")} />
<input
type="file"
name="logo-image"
accept={ALLOWED_MIME_TYPES.join(", ")}
required={data.header.logo_type === "image"}
/>
</label>
<button type="submit">Submit</button>
@@ -99,7 +114,7 @@
>
<label>
Main content:
<textarea name="main-content" rows="20">{data.home.main_content}</textarea>
<textarea name="main-content" rows="20" required>{data.home.main_content}</textarea>
</label>
<button type="submit">Submit</button>
@@ -120,7 +135,9 @@
>
<label>
Additional text:
<textarea name="additional-text" rows="5">{data.footer.additional_text}</textarea>
<textarea name="additional-text" rows="5" maxlength="250" required
>{data.footer.additional_text}</textarea
>
</label>
<button type="submit">Submit</button>

View File

@@ -35,7 +35,7 @@
>
<label>
Title:
<input type="text" name="title" />
<input type="text" name="title" pattern="\S(.*\S)?" maxlength="100" required />
</label>
<button type="submit">Submit</button>

View File

@@ -30,19 +30,35 @@
>
<label>
Title:
<input type="text" name="title" value={data.article.title} />
<input
type="text"
name="title"
value={data.article.title}
pattern="\S(.*\S)?"
maxlength="100"
required
/>
</label>
<label>
Description:
<textarea name="description" rows="5">{data.article.meta_description}</textarea>
<textarea name="description" rows="5" maxlength="250" required
>{data.article.meta_description}</textarea
>
</label>
<label>
Author:
<input type="text" name="author" value={data.article.meta_author} />
<input
type="text"
name="author"
value={data.article.meta_author}
pattern="\S(.*\S)?"
maxlength="100"
required
/>
</label>
<label>
Publication date:
<input type="date" name="publication-date" value={data.article.publication_date} />
<input type="date" name="publication-date" value={data.article.publication_date} required />
</label>
<label>
Cover image:
@@ -50,7 +66,7 @@
</label>
<label>
Main content:
<textarea name="main-content" rows="20">{data.article.main_content}</textarea>
<textarea name="main-content" rows="20" required>{data.article.main_content}</textarea>
</label>
<button type="submit">Submit</button>