Skip to content

Commit 3a31be8

Browse files
committed
Static pages / update documentation page
1 parent 920d491 commit 3a31be8

File tree

4 files changed

+37
-72
lines changed

4 files changed

+37
-72
lines changed
Lines changed: 37 additions & 72 deletions
Original file line numberDiff line numberDiff line change
@@ -1,95 +1,55 @@
11
# Adding static pages
22

3-
This feature allows to store the HTML content for static pages and show the links to these pages in specific sections of the user interface:
3+
This function allows storing the HTML content of static pages and displaying links to these pages in specific sections of the user interface.
44

5-
- The HTML content is stored in a new table of the GN's database.
5+
To add new static pages go to **Admin Console** --> **Settings** --> **Static Pages** and select the **+ New Static Page** option, providing the following information:
66

7-
- The link to pages can be showed in different points of the GN's GUI according to a list of "sections" associated to each page. In this PR is introduced the support to show the links for the top toolbar and the footer.
7+
- **Language**: User interface language in which the static page will be displayed.
8+
- **Page identifier**: A unique text identifier for the page.
9+
- **Page label**: Label to display on the link.
10+
- **Page icon**: (Optional) Icon to display next to the link label.
11+
- **Format**: Format of the static page:
812

9-
- Each page can be in 3 states:
13+
- **Web link**: Link to a web page.
14+
- **HTML content displayed embedded in the app**
15+
- **HTML content displayed in a new browser tab**
16+
- **Plain text content**
17+
- **Email link**: Email address. Opens the system's mail client to send mail to the configured address.
1018

11-
- `HIDDEN`: visible to administrator.
12-
- `PRIVATE`: visible to logged users.
13-
- `PUBLIC`: visible to everyone.
19+
- **Link**: Available for **Web link** / **Email link** formats.
1420

15-
- Pages can be added to different page sections. Currently the sections implemented are `TOP` (top menu of the main page) and `FOOTER` (footer of the main page).
21+
- For **Web link** the link to a web page.
22+
- For **Email link**, the email address to which the email will be sent.
1623

17-
- Only the administrator can edit the pages and see the pages in `HIDDEN` status.
24+
- **Page content file**: For formats other than **Web link** or **Email link**, allows uploading a file with the HTML content / text to be displayed.
1825

19-
- The creation and the management of the content is done via the API.
26+
- **Page content**: For formats other than **Web link** or **Email link**, allows editing the HTML / text content to display.
2027

21-
![](img/pages-api.png)
28+
- **Page section**: Section of the page to display the link. Currently implemented sections are `TOP` (top menu of the main page) and `FOOTER` (footer of the main page).
2229

23-
Some restrictions:
24-
25-
- It is not possible to apply custom CSS to the page.
26-
- Any external image must be loaded externally.
27-
28-
## Examples of API usage
29-
30-
Before executing the following examples, see [Example of CSRF call using curl](misc.md#example-csrf-curl) for details on the usage of the CSRF token (instead of the value `"X-XSRF-TOKEN: e934f557-17a3-47f2-8e6b-bdf1a3c90a97"` used in the examples) and cookies in the requests.
31-
32-
### Load a page in the top menu bar
33-
34-
In this example we're going to upload a file ``contactus.html`` and link it in the top menu:
35-
36-
1. Load the content by using the method POST `/api/pages/`, the mandatory fields are:
37-
38-
- language (3 letters like 'eng', 'ita', 'fra' \...)
39-
- pageId (the identifier/link description of the page)
40-
- format (must be LINK if a link is associated to the page)
41-
- the content: data (a file with the page content) or a link (URL to another page). Define both is not possible.
42-
43-
``` bash
44-
$ curl -X POST "http://localhost:8080/geonetwork/srv/api/pages/?language=eng&pageId=contactus&format=HTML" -H "accept: */*" -H "Content-Type: multipart/form-data" -H "X-XSRF-TOKEN: e934f557-17a3-47f2-8e6b-bdf1a3c90a97" -d contactus.html
45-
```
46-
47-
At this point the page is created but not visible because is in status HIDDEN and is not loaded explicitly in any section of the page, except DRAFT that is not visible (in the future could be added to a page with an editor interface). Similar requests should be done for each UI language supported.
48-
49-
2. To associate the link to the top bar is necessary to use the method POST `/api/pages/{language}/{pageId}/{section}` with the `TOP` value for the section.
30+
- **Status**: Defines which users can see the link.
5031

51-
``` bash
52-
$ curl -X POST "http://localhost:8080/geonetwork/srv/api/pages/eng/contactus/TOP" -H "accept: */*" -H "X-XSRF-TOKEN: 7cfa1a0d-3335-4846-8061-a5bf176687b5" --user admin:admin -b /tmp/cookie
53-
```
32+
- **Visible only to the administrator**
33+
- **Visible to logged users**
34+
- **Visible to users belonging to groups**
35+
- **Visible to every one**
5436

55-
### Load a link in the footer bar
37+
![](img/add-static-page.png)
5638

57-
In this example we're going to add a link to an external resource <http://myorganisation/contactus.html> and link it in the footer:
5839

59-
1. Add the link by using the method POST `/api/pages/` with the `link` parameter in the request:
40+
![](img/static-page-footer.png)
6041

61-
``` bash
62-
$ curl -X POST "http://localhost:8080/geonetwork/srv/api/pages/?language=eng&pageId=contactus&format=LINK&link=http://myorganisation/contactus.html" -H "accept: */*" -H "X-XSRF-TOKEN: e934f557-17a3-47f2-8e6b-bdf1a3c90a97"
63-
```
6442

65-
2. To associate the link to the footer is necessary to use the method POST `/api/pages/{language}/{pageId}/{section}` with the `FOOTER` value for the section.
66-
67-
``` bash
68-
$ curl -X POST "http://localhost:8080/geonetwork/srv/api/pages/eng/contactus/FOOTER" -H "accept: */*" -H "X-XSRF-TOKEN: 7cfa1a0d-3335-4846-8061-a5bf176687b5" --user admin:admin -b /tmp/cookie
69-
```
70-
71-
### Remove a page from a section
72-
73-
To remove a page from a section DELETE `/api/pages/{language}/{pageId}/{section}`
74-
75-
``` bash
76-
curl -X DELETE "http://localhost:8080/geonetwork/srv/api/pages/eng/contactus?format=LINK" -H "accept: */*" -H "X-XSRF-TOKEN: 7cfa1a0d-3335-4846-8061-a5bf176687b5" --user admin:admin -b /tmp/cookie
77-
```
78-
79-
### Change the page status
80-
81-
The status of the page can be changed with the method PUT `/api/pages/{language}/{pageId}/{status}` where status could assume these values:
43+
Some restrictions:
8244

83-
- `PUBLIC` - Visible to every user
84-
- `PUBLIC_ONLY` - Visible to not logged users
85-
- `PRIVATE` - Visible to logged users
86-
- `HIDDEN` - Hidden to anyone
45+
- It is not possible to apply custom CSS to the page.
46+
- Any external image must be loaded externally.
8747

88-
Other methods in the API are to change/delete a page and to GET the list of the pages or the info of a specific one.
48+
## Change the menu order in the top toolbar
8949

90-
### Change the menu order in the top toolbar
50+
In the top bar, pages can be inserted between the default menu of the catalogue. This can be configured in **Admin Console** --> **Settings** --> **User interface**, in the **Header custom menu items** section.
9151

92-
Pages can be inserted in between catalogue default menu which are:
52+
By default, the order of the items in the top bar is as follows:
9353

9454
``` json
9555
["gn-site-name-menu",
@@ -100,7 +60,7 @@ Pages can be inserted in between catalogue default menu which are:
10060
"gn-admin-menu"]
10161
```
10262

103-
Insert a page as a simple menu using its id or as a submenu using an object:
63+
Insert a page as a simple menu using the page identifier or as a submenu using an object:
10464

10565
``` json
10666
["gn-site-name-menu",
@@ -115,3 +75,8 @@ Insert a page as a simple menu using its id or as a submenu using an object:
11575
"gn-admin-menu",
11676
"documentation"]
11777
```
78+
79+
## Change the static pages order in the footer
80+
81+
The order of the footer pages can be configured in **Admin Console** --> **Settings** --> **User interface**, in the **Footer custom menu items** section.
82+
Loading
Binary file not shown.
Loading

0 commit comments

Comments
 (0)