|
1 | | -# README # |
| 1 | +# OpenKaarten Frontend Plugin |
2 | 2 |
|
3 | | -This README would normally document whatever steps are necessary to get your application up and running. |
| 3 | +This plugin adds a Gutenberg block to WordPress which can be used to show a map with locations of datalayers, from the OpenKaarten Base plugin. |
4 | 4 |
|
5 | | -### What is this repository for? ### |
| 5 | +## Requirements |
6 | 6 |
|
7 | | -* Quick summary |
8 | | -* Version |
9 | | -* [Learn Markdown](https://bitbucket.org/tutorials/markdowndemo) |
| 7 | +### OpenKaarten Frontend |
10 | 8 |
|
11 | | -### How do I get set up? ### |
| 9 | +In order to make the OpenKaarten Frontend Plugin work, you will need to have a WordPress installation with at least the following installed (and activated): |
12 | 10 |
|
13 | | -* Summary of set up |
14 | | -* Configuration |
15 | | -* Dependencies |
16 | | -* Database configuration |
17 | | -* How to run tests |
18 | | -* Deployment instructions |
| 11 | +* [WordPress](https://wordpress.org/) |
19 | 12 |
|
20 | | -### Contribution guidelines ### |
| 13 | +On this WordPress installation you will have to enable pretty permalinks (Settings > Permalinks > Select any of the options that is not plain). |
21 | 14 |
|
22 | | -* Writing tests |
23 | | -* Code review |
24 | | -* Other guidelines |
| 15 | +There are two possible setups for the OpenKaarten Frontend, this can be: |
25 | 16 |
|
26 | | -### Who do I talk to? ### |
| 17 | +1. On the WordPress installation of an existing website. |
| 18 | +2. On a completely new WordPress installation. |
27 | 19 |
|
28 | | -* Repo owner or admin |
29 | | -* Other community or team contact |
| 20 | +In all scenarios the OpenKaarten Frontend plugin needs to have the following installed (and activated): |
| 21 | + |
| 22 | +* [WordPress](https://wordpress.org/) |
| 23 | +* [OpenKaarten Frontend](https://github.com/OpenWebconcept/plugin-openkaarten-frontend-plugin) |
| 24 | + |
| 25 | +With this installed you can use the OpenKaarten Frontend plugin in your WordPress website. |
| 26 | + |
| 27 | +If you chose for option 2 (new WordPress installation), you will probably need to install a WordPress theme. Since the OpenKaarten plugin is a REST API, it can be used in any WordPress theme. |
| 28 | + |
| 29 | +## Works best with |
| 30 | + |
| 31 | +The OpenKaarten Frontend plugin works best with the following plugins, which can be installed on a different WordPress installation: |
| 32 | + |
| 33 | +- [OpenKaarten Base](https://github.com/openwebconcept/plugin-openkaarten-base): This plugin adds Datalayers and Locations to WordPress which can be retrieved via the OpenKaarten REST API. |
| 34 | +- [OpenKaarten GeoData](https://github.com/OpenWebconcept/plugin-openkaarten-geodata-for-posts): This plugin adds GeoData fields to the OpenPub Items post type and creates a REST endpoint to retrieve OpenPub Items with geodata. |
| 35 | + |
| 36 | +## Installation |
| 37 | + |
| 38 | +### Manual installation |
| 39 | + |
| 40 | +You can download the latest release from the [releases page](https://github.com/OpenWebconcept/plugin-openkaarten-frontend-plugin) and install it manually in your WordPress installation. |
| 41 | + |
| 42 | +### Composer installation |
| 43 | + |
| 44 | +1. `composer source git@github.com:OpenWebconcept/plugin-openkaarten-frontend-plugin.git` |
| 45 | +2. `composer require acato/openkaarten-frontend-plugin` |
| 46 | +3. `cd /wp-content/plugins/openkaarten-frontend-plugin` |
| 47 | +4. `npm install && npm run build` |
| 48 | +5. Activate the OpenKaarten Frontend Plugin through the 'Plugins' menu in WordPress. |
| 49 | + |
| 50 | +## Usage |
| 51 | + |
| 52 | +### Add a Gutenberg blok to show a map with locations |
| 53 | +In the WordPress admin panel, go to the page or post where you want to show the map with locations. Add a new block and search for the 'OWC Openmaps Openstreet Map' block. |
| 54 | +Add this block to the page or post, add a URL where the OpenKaarten Base plugin is installed and select the datalayer(s) you want to show on the map. |
| 55 | + |
| 56 | +## Development |
| 57 | + |
| 58 | +### Coding Standards |
| 59 | + |
| 60 | +Please remember, we use the WordPress PHP Coding Standards for this plugin! (https://make.wordpress.org/core/handbook/best-practices/coding-standards/php/) To check if your changes are compatible with these standards: |
| 61 | + |
| 62 | +* `cd /wp-content/plugins/openkaarten-frontend` |
| 63 | +* `composer install` (this step is only needed once after installing the plugin) |
| 64 | +* `./vendor/bin/phpcs --standard=phpcs.xml.dist .` |
| 65 | +* See the output if you have made any errors. |
| 66 | + * Errors marked with `[x]` can be fixed automatically by phpcbf, to do so run: `./vendor/bin/phpcbf --standard=phpcs.xml.dist .` |
| 67 | + |
| 68 | +N.B. the `composer install` command will also install a git hook, preventing you from committing code that isn't compatible with the coding standards. |
| 69 | + |
| 70 | +### NPM |
| 71 | +The plugin uses NPM for managing the JavaScript dependencies and building the leaflet map for showing locations within a datalayer. To install the dependencies, run the following command: |
| 72 | +``` |
| 73 | +npm install |
| 74 | +``` |
| 75 | + |
| 76 | +To deploy the JavaScript files, run the following command: |
| 77 | +``` |
| 78 | +npm run build |
| 79 | +``` |
| 80 | + |
| 81 | +To watch the JavaScript files for changes, run the following command: |
| 82 | +``` |
| 83 | +npm run watch |
| 84 | +``` |
0 commit comments