Skip to content
This repository was archived by the owner on Oct 27, 2022. It is now read-only.

Commit cd6ff5f

Browse files
committed
Add new features to Readme
1 parent 1206fc5 commit cd6ff5f

File tree

1 file changed

+98
-57
lines changed

1 file changed

+98
-57
lines changed

README.md

Lines changed: 98 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,36 @@
11
# wmch-interactive-maps
2-
A configurable backend to generate interactive maps on top of Wikidata.
32

4-
## Settings
3+
A configurable backend to generate and show interactive maps on top of Wikidata.
54

6-
A base configuration file is available on `config.js`.
5+
## User manual
76

8-
Local settings like database name and authentication data are available in the git ignored `localconfig.json` in the following formats.
7+
User manual in multiple languages is loaded on [i18n_man/index](https://github.com/synapta/wmch-interactive-maps/tree/master/i18n_man/index)
8+
9+
The user manual is available inside the app along the screenshots at the `/wizard/man/index` path.
910

10-
TL;DR: Copy localconfig.example.json to localconfig.json
11+
## Installation
1112

12-
Create directories:
13+
Create `screenshots` and `local` directories:
1314

1415
`mkdir -p screenshots && mkdir -p local`
1516

16-
### url
17+
Screenshots directory will contains preview files for maps, local directory could contain the sqlite database and other development data.
18+
19+
### Add localconfig.json
1720

18-
On localconfig.json, set the url to the production url. It will be used to:
19-
- Get preview
20-
- Expose the path to the user
21+
***TL;DR: Copy localconfig.example.json to localconfig.json. Change data as needed.***
22+
23+
Local settings like database name and authentication data are available in the git ignored `localconfig.json` in the following formats.
2124

22-
It will be something like https://interactivemap.wikimedia.swiss/.
25+
On localconfig.json, set the url to the production url. It will be used to expose the path to the user, something like https://example.org/.
2326

24-
### Database
27+
### config.js
28+
29+
A global base configuration file is available on `config.js`.
30+
31+
It contains available map styles based on sources listed on [Tile servers](https://wiki.openstreetmap.org/wiki/Tile_servers) page on OpenStreetMap.
32+
33+
### Set up database
2534

2635
Data can be saved by two different connectors, SQLite and MariaDB.
2736

@@ -65,7 +74,7 @@ Port and dialectOptions can be omitted, getting the default values above.
6574

6675
[Reference for MariaDB](http://docs.sequelizejs.com/manual/usage.html#mariadb)
6776

68-
## Run the app
77+
## Run
6978

7079
`node app.js`
7180

@@ -76,9 +85,27 @@ Port and dialectOptions can be omitted, getting the default values above.
7685
15 Mar 10:46:31 - WMCH Interactive maps listening at http://:::9089
7786

7887

79-
### Urls
80-
- Backend: http://localhost:9089/wizard/
81-
- Frontend: http://localhost:9089/
88+
### Run the screenshot server
89+
90+
The screenshot server is used to take a screenshot of the map just before a map is saved to the database.
91+
92+
Port and url are specified on config.json.
93+
94+
`node screenshot.js`
95+
96+
Both the app.js and screenshot.js must be running at the same time.
97+
98+
### Auto-update and keep running
99+
100+
To auto-update and keep running the node servers in development environment on changes, you can use:
101+
102+
`nodemon MYSERVERSCRIPT.js --port MYPORT`
103+
104+
In this case nodemon must be installed globally.
105+
106+
## Languages
107+
108+
The app supports multiple languages.
82109

83110
### Language negotiation
84111

@@ -89,29 +116,71 @@ To force a particular language in the format using the url use the `l` parameter
89116
- http://localhost:9089/wizard/?l=it
90117
- http://localhost:9089/wizard/?l=it-CH
91118

119+
A dropdown to change language is provided on both backend and frontend.
120+
92121
### Translations
93122

94123
All translations are key-based and hosted in JSON file named after the [ISO 639-1](https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes) code under the i18n folder.
95124

96-
Directory structure is.
125+
Directory structure is associated with the respective section.
97126

98127
~~~
99128
i18n
100-
├── wizard
101-
│ ├── en.json
102-
│ └── it.json
103-
└── frontend
104-
├── en.json
105-
└── it.json
129+
|-- admin
130+
| |-- en.json
131+
| `-- it.json
132+
|-- frontend
133+
| |-- en.json
134+
| `-- it.json
135+
|-- manual
136+
| |-- en.json
137+
| `-- it.json
138+
`-- wizard
139+
|-- en.json
140+
`-- it.json
141+
106142
~~~
107143

108-
The reference is the **en.json** file.
144+
To add a new translation:
145+
146+
1. Add a new ISO 639-1 file to each directory inside `i18n` copying a file like `en.json` and changing the keys.
147+
2. Edit `config.json` and add a new language code, e.g. `{"code": "ja", "name": "日本語"}`
148+
149+
## Paths
150+
151+
On development or locally, the main paths are:
152+
153+
- Backend: http://localhost:9089/admin/
154+
- Wizard (backend and user manual): http://localhost:9089/wizard/
155+
- Frontend: http://localhost:9089/
156+
157+
If the edit must be limited, `/admin` and `/wizard` paths can be protected via webserver.
158+
159+
## External resources
160+
161+
External libraries are loaded via Wikimedia CDN where availables:
162+
163+
- [https://tools.wmflabs.org/cdnjs/](https://tools.wmflabs.org/cdnjs/)
164+
165+
External fonts are loaded via:
166+
167+
- [https://tools.wmflabs.org/fontcdn/](https://tools.wmflabs.org/fontcdn/)
168+
169+
## Special commands
109170

110-
### Map styles
171+
### Maintenance scripts
111172

112-
Map styles is based on sources listed on [Tile servers](https://wiki.openstreetmap.org/wiki/Tile_servers).
173+
If a relevant change to the code will affect all maps in the database, screenshots can be regenerated.
113174

114-
### Icon list
175+
To regenerate all preview screenshots:
176+
177+
`node maintenance.js -P`
178+
179+
Help for all available commands:
180+
181+
`node maintenance.js --help`
182+
183+
### Generate a new icon list
115184

116185
Icon list can be selected between [those available on Semantic UI](https://semantic-ui.com/elements/icon.html) and saved on /public/js/icons.json.
117186

@@ -135,35 +204,7 @@ JSON.stringify(myels, null, ' ');
135204

136205
Then expand and copy object to get a JSON array.
137206

138-
### External libraries
139-
140-
External libraries are loaded via Wikimedia CDN where availables:
141-
- https://tools.wmflabs.org/cdnjs/
142-
143-
## Run the screenshot server
207+
Semantic UI Icons are available on wizard searching by class name.
144208

145-
The screenshot server is used to take a screenshot of the map just before a map is saved to the database.
209+
These steps are useful when the Semantic UI version is changed.
146210

147-
Port and url are specified on config.json.
148-
149-
`node screenshot.js`
150-
151-
## Auto-update and keep running
152-
153-
To auto-update and keep running the node servers in development environment, you can use:
154-
155-
`nodemon MYSERVERSCRIPT.js --port MYPORT`
156-
157-
## Sticky maps
158-
159-
Maps can be set as sticky altering the sticky column. Greater sticky value will put the item on the top of the map list. Default value for sticky column is 0.
160-
161-
## Maintenance scripts
162-
163-
Regenerate all preview screenshots:
164-
165-
`node maintenance.js -P`
166-
167-
Help for all available commands:
168-
169-
`node maintenance.js --help`

0 commit comments

Comments
 (0)