Skip to content

Commit 9994ac0

Browse files
authored
Merge branch 'next' into refactor-showin
2 parents 02a1243 + fdd7007 commit 9994ac0

File tree

3 files changed

+29
-5
lines changed

3 files changed

+29
-5
lines changed

adminforth/documentation/docs/tutorial/03-Customization/13-standardPagesTuning.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -370,6 +370,25 @@ export default {
370370

371371
> `validation` checks are enforced both on frontend and backend.
372372
373+
### Editing note
374+
375+
You can add `editingNote` to a column to show a note below the input field.
376+
377+
```typescript title="./resources/users.ts"
378+
export default {
379+
name: 'users',
380+
columns: [
381+
...
382+
{
383+
name: "password",
384+
editingNote: { edit: "Leave empty to keep password unchanged" },
385+
},
386+
],
387+
},
388+
...
389+
],
390+
```
391+
373392
### Foreign resources
374393

375394
[Documentation in progress]

adminforth/modules/configValidator.ts

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -386,16 +386,21 @@ export default class ConfigValidator implements IConfigValidator {
386386
// force required to be object
387387
col.required = typeof inCol.required === 'boolean' ? { create: inCol.required, edit: inCol.required } : inCol.required;
388388

389+
389390
// same for editingNote
390-
if (col.editingNote && !((typeof col.editingNote === 'string') || (typeof col.editingNote === 'object'))) {
391+
if (inCol.editingNote && !((typeof inCol.editingNote === 'string') || (typeof inCol.editingNote === 'object'))) {
391392
errors.push(`Resource "${res.resourceId}" column "${col.name}" editingNote must be a string or object`);
392393
}
393-
if (typeof col.editingNote === 'object') {
394-
const wrongEditingNoteOn = Object.keys(col.editingNote).find((c) => !['create', 'edit'].includes(c));
394+
if (typeof inCol.editingNote === 'object') {
395+
const wrongEditingNoteOn = Object.keys(inCol.editingNote).find((c) => !['create', 'edit'].includes(c));
395396
if (wrongEditingNoteOn) {
396-
errors.push(`Resource "${res.resourceId}" column "${col.name}" has invalid editingNote value "${wrongEditingNoteOn}", allowed keys are 'create', 'edit']`);
397+
errors.push(`Resource "${res.resourceId}" column "${inCol.name}" has invalid editingNote value "${wrongEditingNoteOn}", allowed keys are 'create', 'edit']`);
397398
}
398399
}
400+
401+
col.editingNote = typeof inCol.editingNote === 'string' ? { create: inCol.editingNote, edit: inCol.editingNote } : inCol.editingNote;
402+
403+
col.showIn = col.showIn || Object.values(AdminForthResourcePages);
399404

400405
if (col.foreignResource) {
401406

live-demo/deploy/buildSlackNotify.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ CODE_BLOCK="\`\`\`$BUILD_LOG\n\`\`\`"
2828

2929
echo "Sending slack message to developers $MESSAGE"
3030
# Send the message
31-
curl -s -X POST -H "Content-Type: application/json" -d '{
31+
curl -X POST -H "Content-Type: application/json" -d '{
3232
"username": "'"$CI_COMMIT_AUTHOR"'",
3333
"icon_url": "'"$CI_COMMIT_AUTHOR_AVATAR"'",
3434
"attachments": [

0 commit comments

Comments
 (0)