Skip to content

Commit

Permalink
update cli documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
Zwiterrion committed Nov 20, 2024
1 parent e1a3e3f commit 74a1e77
Show file tree
Hide file tree
Showing 9 changed files with 505 additions and 362 deletions.
21 changes: 19 additions & 2 deletions .github/CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,9 +64,26 @@ You must add the dependency and its licence in https://github.com/MAIF/daikoku/b

if you add features to Daikoku, don't forget to modify the user documentation

* https://github.com/MAIF/daikoku/tree/master/docs/manual
* https://github.com/MAIF/daikoku/tree/master/docs

to build the documentation, run the following command at the root of the repository
To run the documentation locally

Navigate to the `manual` folder and install the Docusaurus dependencies:
```sh
cd manual && npm install
```

Launch the documentation server, then edit the markdown files located in the manual folder:
```sh
npm run start
```

To test the search bar, build the project first:
```sh
npm run build
```

to build the documentation, run the following command at the root of the repository:

```sh
sh ./scripts/build.sh manual
Expand Down
20 changes: 7 additions & 13 deletions cli/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -131,18 +131,20 @@ The CMS projects adhere to the following strict file structure:
- `styles`: Contains CSS files.
- `documentations` : Contains files that can be used as documentation page of APIs

# Dynamic nested routing
# Dynamic routes

The CLI uses file-system routing where folders are used to create nested routes. Each folder represents a route segment that maps to a URL segment.

You can create separate UIs for each route using page.html files. `page.html` is a special CLI file that contains html content.

To create a nested route, you can nest folders inside each other and add page.html files inside them. For example:

`src/pages/page.html`: can be reach on `/` path.
`src/pages/invoices/page.html`: can be reach on `/invoices` path.
`src/pages/offres.html`: can be reach on `/offres` path.
`src/pages/apis/api/[apiId]`: can be reach on `/apis/api/any-kind-of-api` and the apiId value can be use in the page as mustache variable using {{apiId}}
```sh
src/pages/page.html -> mysite.com/
src/pages/invoices/page.html -> mysite.com/invoices
src/pages/offres.html -> mysite.com/offres
src/pages/apis/api/[apiId] -> mysite.com/apis/api/any-kind-of-api (the apiId value can be use in the page as mustache variable using {{apiId}})
```

# Manage your assets

Expand Down Expand Up @@ -369,14 +371,6 @@ When you have an user returned from directive, you can use the following fields
{{translate 'Logout'}}
```

## daikoku-path-param
`parameters`:
- the position of the path params

```html
{{daikoku-path-param '0'}}
```

## daikoku-query-param
`parameters`:
- the name of the query param
Expand Down
4 changes: 0 additions & 4 deletions daikoku/app/domain/tenantEntities.scala
Original file line number Diff line number Diff line change
Expand Up @@ -1951,10 +1951,6 @@ case class CmsPage(
"daikoku-generic-page-url",
(id: String, _: Options) => s"/cms/pages/$id"
)
handlebars.registerHelper(
"daikoku-path-param",
(id: String, _: Options) => daikokuPathParam(ctx, id, req)
)
handlebars.registerHelper(
"daikoku-query-param",
(id: String, _: Options) =>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -166,14 +166,6 @@
"example": "{{translate 'Logout'}}}",
"category": "OPERATION"
},
{
"name": "daikoku-path-param",
"parameters": [
"the position of the path params"
],
"example": "{{daikoku-path-param '0'}}",
"category": "OPERATION"
},
{
"name": "daikoku-query-param",
"parameters": [
Expand Down
1 change: 0 additions & 1 deletion daikoku/javascript/src/locales/en/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -1118,7 +1118,6 @@
"cms.content_side_view.ifnoteq": "Checks if the variable if not equals to the value",
"cms.content_side_view.getOrElse": "Evaluates the value of the variable and return us the alternative value if the value is empty",
"cms.content_side_view.translate": "Translates the variable using Daikoku translations",
"cms.content_side_view.daikoku-path-param": "Get the nth path params",
"cms.content_side_view.daikoku-query-param": "Get the query param of name",
"cms.content_side_view.daikoku-template-wrapper": "Display a wrapper block of the passed id",
"cms.content_side_view.daikoku-apis": "Get all APIs",
Expand Down
1 change: 0 additions & 1 deletion daikoku/javascript/src/locales/fr/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -1118,7 +1118,6 @@
"cms.content_side_view.ifnoteq": "S'assure que la variable n'est pas égale à la valeur souhaitée",
"cms.content_side_view.getOrElse": "Évalue la valeur de la variable et retourne l'alternative de la valeur si elle est non définie",
"cms.content_side_view.translate": "Traduit une variable en utilisant les traduction de Daikoku",
"cms.content_side_view.daikoku-path-param": "Récupère le énième path param",
"cms.content_side_view.daikoku-query-param": "Récupère le query param avec le nom passé en paramètre",
"cms.content_side_view.daikoku-template-wrapper": "Affiche un bloc englobant un contenu enfant (avec ID)",
"cms.content_side_view.daikoku-apis": "Récupère toutes les APIs",
Expand Down
24 changes: 0 additions & 24 deletions daikoku/test/daikoku/TenantControllerSpec.scala
Original file line number Diff line number Diff line change
Expand Up @@ -1246,30 +1246,6 @@ class TenantControllerSpec()
//redirect to error page
resp.status mustBe 303
}
"get a path param from cms page" in {
val page = defaultCmsPage.copy(
id = CmsPageId("foo-page"),
path = Some("/foo"),
body = "{{daikoku-path-param '0'}}"
)
setupEnvBlocking(
tenants = Seq(tenant),
users = Seq(tenantAdmin),
teams = Seq(defaultAdminTeam),
cmsPages = Seq(page),
apis = Seq(adminApi)
)

val session = loginWithBlocking(tenantAdmin, tenant)

val resp = httpJsonCallBlocking(
path = s"/_${page.path.get}/bar",
headers = Map("accept" -> "text/html")
)(tenant, session)

resp.status mustBe 200
resp.body mustBe "bar"
}
"get the query params from cms page" in {
val page = defaultCmsPage.copy(
id = CmsPageId("query-params"),
Expand Down
Loading

0 comments on commit 74a1e77

Please sign in to comment.