Skip to content

Commit

Permalink
docs: update
Browse files Browse the repository at this point in the history
  • Loading branch information
mle-moni committed Jun 2, 2024
1 parent 1f7c9f4 commit f9f1e44
Show file tree
Hide file tree
Showing 5 changed files with 52 additions and 24 deletions.
32 changes: 24 additions & 8 deletions docs/astro.config.mjs
Original file line number Diff line number Diff line change
@@ -1,17 +1,33 @@
import starlight from "@astrojs/starlight";
import { defineConfig } from "astro/config";
import starlight from '@astrojs/starlight'
import { defineConfig } from 'astro/config'

// https://astro.build/config
export default defineConfig({
site: "https://galadrimteam.github.io",
base: "adomin",
site: 'https://galadrimteam.github.io',
base: 'adomin',
integrations: [
starlight({
title: "Adomin - Docs",
favicon: "favicon.png",
title: 'Adomin - Docs',
favicon: 'favicon.png',
social: {
github: "https://github.com/galadrimteam/adomin",
github: 'https://github.com/galadrimteam/adomin',
},
sidebar: [
{
label: 'Guides',
autogenerate: { directory: 'guides', collapsed: true },
},
{
label: 'Reference',
items: [
{
label: 'Views',
path: '/reference/views',
autogenerate: { directory: 'reference/views', collapsed: true },
},
],
},
],
}),
],
});
})
Original file line number Diff line number Diff line change
Expand Up @@ -15,20 +15,20 @@ To declare a model view page, you will need to add a `ModelConfig` object inside

```ts
export const ADOMIN_CONFIG: AdominConfig = {
title: "Adomin",
title: 'Adomin',
views: [MY_MODEL_CONFIG],
};
}
```

Use the `createModelViewConfig` function to create your `ModelConfig` object:

```ts
export const MY_MODEL_CONFIG = createModelViewConfig(() => MyModel, {
columns: {
title: { type: "string", label: "Titre" },
description: { type: "string", label: "Description" },
title: { type: 'string', label: 'Titre' },
description: { type: 'string', label: 'Description' },
},
});
})
```

The `createModelViewConfig` allows you to pass a function returning your Adonis model and an object with the adomin configuration for this model.
Expand All @@ -47,33 +47,33 @@ export interface AdominBaseFieldConfig {
* If true, validation will allow null values for this field
* @default false
*/
nullable?: boolean;
nullable?: boolean
/**
* If true, validation will allow undefined values for this field
* @default false
*/
optional?: boolean;
optional?: boolean
/**
* Label shown on the frontend
*/
label?: string;
label?: string
/**
* If false, user cannot edit this field
*/
editable?: boolean;
editable?: boolean
/**
* If false, user cannot create this field
*/
creatable?: boolean;
creatable?: boolean
/**
* Size of the field on the frontend
* @default 120
*/
size?: number;
size?: number
/**
* If this field is a \@computed() field in your model you must set this to true
*/
computed?: boolean;
computed?: boolean
}
```

Expand Down Expand Up @@ -181,6 +181,18 @@ queryBuilderCallback: (q) => {

### HasOne field

## See the source code
<br />

#### Waiting for ~~love~~ docs

As you can see, the documentation is not ready for many field types, while you wait for propper documentation, see the type definitions:

import { FileTree } from '@astrojs/starlight/components'

<FileTree>

- app
- adomin
- [fields.types.ts](https://github.com/galadrimteam/adomin/blob/main/app/adomin/fields.types.ts) Fields type definitions

[Type definitions](https://github.com/galadrimteam/adomin/blob/main/app/adomin/fields.types.ts)
</FileTree>
2 changes: 1 addition & 1 deletion docs/src/content/docs/reference/views/models/number.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ You can put whatever you want in the string as long as you put `{{value}}` somew
:::note[example]

```ts
"{{value}} €";
'{{value}} €'
```

:::
Expand Down
2 changes: 1 addition & 1 deletion docs/src/content/docs/reference/views/models/string.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ You can put whatever you want in the string as long as you put `{{value}}` somew
:::note[example]

```ts
"{{value}} €";
'{{value}} €'
```

:::

0 comments on commit f9f1e44

Please sign in to comment.