Skip to content

Commit

Permalink
Merge pull request #28 from mthh/master
Browse files Browse the repository at this point in the history
Several minor fixes
  • Loading branch information
mthh committed Oct 22, 2018
2 parents a6b0a7e + 460f963 commit 2699a8f
Show file tree
Hide file tree
Showing 25 changed files with 142 additions and 206 deletions.
10 changes: 9 additions & 1 deletion CHANGES.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,14 @@
Changes
=======

0.8.9 (2018-10-15)
------------------

- Fix bug with translation on index page.

- Remove the old contact form in favor of the contact form of RIATE website.


0.8.8 (2018-09-21)
------------------

Expand All @@ -18,7 +26,7 @@ Changes
0.8.6 (2018-08-08)
------------------

- Improve symbols positionning in waffle map legends.
- Improve symbols positioning in waffle map legends.

- Improve the tests suite.

Expand Down
23 changes: 21 additions & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,11 @@ $ make -s -j 4
$ sudo make install
```

* **Python packages** *
```
$ pip3 install -r requirements/dev.txt
```

* **Other tools needed: topojson**
```
$ sudo npm -g install topojson
Expand Down Expand Up @@ -111,11 +116,25 @@ Some `cython` files need to be compiled after modification. It can be done by ru

### Testing

...
The tests are intended to be played on Travis CI but also locally. We use [selenium](https://www.seleniumhq.org/) WebDriver to "talk" to the browser and automate testing actions.

Before running tests you need to download [ChromeDriver](http://chromedriver.chromium.org/downloads) and include its location in your `PATH` environment variable.

Then you can use py.test to run the test suite :

```
py.test tests/tests_web.py
```

If you are fixing a bug you should try to create a test case that exposes the bug before writing the fix. Then use that test case to verify that the bug is really fixed by your patch.


### Contributing to the deployement recipes

...
Deployement recipes are located in the `misc` folder.
In `misc/Docker` you will find the two dockerfiles (one for `nginx` and the other for the `Magrit` app) used to create and run the Magrit instance available on [our server] (http://magrit.cnrs.fr).
In `misc/dockerfiles` you will find the dockerfile used for the automated build on [Docker Hub](https://hub.docker.com/r/magrit/magrit/).


### Licencing

Expand Down
5 changes: 3 additions & 2 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
Copyright © RIATE-lab 2016-2017
Copyright © RIATE-lab 2016-2018
Contributors: Timothée Giraud, Nicolas Lambert, Matthieu Viry

matthieu.viry [at] cnrs [dot] fr
timothee.giraud [at] cnrs [dot] fr
matthieu.viry [at] univ-grenoble-alpes [dot] fr

Magrit is governed by the CeCILL license under French law and
abiding by the rules of distribution of free software. You can use,
Expand Down
2 changes: 1 addition & 1 deletion client/dist/app.35565a.js → client/dist/app.952590.js

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions client/dist/html/modules.html
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,8 @@
</div>
<script src="static/vendor/bootstrap-native3.mod.min.js"></script>
<script src="static/vendor/opentip-native.min.js"></script>
<script src="static/dist/vendor.35565a.js"></script>
<script src="static/dist/vendor.952590.js"></script>
<script src="static/dist/d3-custom.min.js"></script>
<script src="static/dist/app.35565a.js"></script>
<script src="static/dist/app.952590.js"></script>
</body>
</html>
File renamed without changes.
43 changes: 0 additions & 43 deletions client/html/contact_form.html
Original file line number Diff line number Diff line change
Expand Up @@ -191,21 +191,6 @@ <h1 style="font-family:Dosis;" data-i18n="[html]contact_form.contact" class="i18
<div class="row">
<div class="col-md-12">
<p class="col-md-12 i18n" data-i18n="[html]contact_form.intro_text" style="padding: 0 12% 0 12%;"></p>
<div class="contact_form clearfix">
<form onsubmit='sendForm(); return false;'>
<div class="half left">
<input name="name" type="text" id="input-name" class="i18n" data-i18n="[placeholder]contact_form.name">
<input name="email" type="email" id="input-email" class="i18n" data-i18n="[placeholder]contact_form.email">
<input name="subject" type="text" id="input-subject" class="i18n" data-i18n="[placeholder]contact_form.subject">
</div>
<div class="half right">
<textarea name="message" type="text" class="i18n" id="input-message" data-i18n="[placeholder]contact_form.message"></textarea>
</div>
<p class="col-md-12 i18n">
<input type="submit" class="btn btn-success i18n" style="margin: 5px; width: auto;" data-i18n="[html]contact_form.send" id="send_button">
</p>
</form>
</div>
</div>
<div class="box-wrap clearfix"></div>
</div>
Expand All @@ -215,34 +200,6 @@ <h1 style="font-family:Dosis;" data-i18n="[html]contact_form.contact" class="i18
</body>
<script>

function sendForm(){
let data = new FormData();
data.append('name', document.getElementById('input-name').value);
data.append('email', document.getElementById('input-email').value);
data.append('subject', document.getElementById('input-subject').value);
data.append('message', document.getElementById('input-message').value);

let request = new XMLHttpRequest();
request.open("POST", "/contact", true);
request.onload = resp => {
swal({title: "",
text: i18next.t("app_page.common.ok") + "!",
type: "success",
showCancelButton: false,
allowOutsideClick: false,
}).then(() => { return; }, dismiss => { return; });
};
request.onerror = err => {
swal({title: "",
text: i18next.t("app_page.common.error_msg") + "!",
type: "error",
showCancelButton: false,
allowOutsideClick: false,
}).then(() => { return; }, dismiss => { return; });
};
request.send(data);
}

//i18n initialization :
(function(){
var existing_lang = ["en", "es", "fr"];
Expand Down
17 changes: 9 additions & 8 deletions client/html/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
<title>Magrit</title>
<link rel="icon" type="image/png" href="static/img/favicon.png" />
<link href="static/vendor/css/bootstrap4.min.css" rel="stylesheet">
<script src="https://unpkg.com/popper.js/dist/umd/popper.min.js"></script>
<script src="static/vendor/popper.min.js"></script>
<script src="static/vendor/jquery-2.2.1.min.js"></script>
<script src="static/vendor/i18next.min.js"></script>
<script src="static/vendor/loc-i18next.min.js"></script>
Expand Down Expand Up @@ -412,8 +412,9 @@ <h2 id="title_app" style="font-family:Dosis;" class="i18n" data-i18n="index.temp


function prepare_lang_buttons(){
var current_lang = i18next.language,
other_langs = current_lang == "en" ? ["es", "fr"] : current_lang == "fr" ? ["en", "es"] : ["en", "fr"];
var current_lang = i18next.language;
var other_langs = current_lang === "en"
? ["es", "fr"] : current_lang === "fr" ? ["en", "es"] : ["en", "fr"];

document.getElementById("lang_current").innerHTML = current_lang;
var button_lang1 = document.getElementById("lang1");
Expand Down Expand Up @@ -467,8 +468,8 @@ <h2 id="title_app" style="font-family:Dosis;" class="i18n" data-i18n="index.temp
<div class="card mb-4 box-shadow">
<img class="img-fluid img-thumbnail" src="https://raw.githubusercontent.com/riatelab/magrit-templates-carto/master/${key}/export.png" alt="thumbnail">
<div class="card-body">
<h5 class="card-text i18n" data-i18n="[html]templates.${key}.name"></h5>
<p class="card-text i18n" data-i18n="[html]templates.${key}.description"></p>
<h5 class="card-text i18n" data-i18n="[html]translation_template:templates.${key}.name"></h5>
<p class="card-text i18n" data-i18n="[html]translation_template:templates.${key}.description"></p>
<div class="btn-group" role="group" aria-label="Button template">
<button type="button" class="btn btn-sm btn-outline-secondary i18n" data-i18n="[html]index.templates.open" onclick="openTemplate('${key}')"></button>
<a type="button" class="btn btn-sm btn-outline-secondary i18n" href="https://magrit.hypotheses.org/" target="_blank" data-i18n="[html]index.templates.details"></a>
Expand All @@ -477,9 +478,9 @@ <h5 class="card-text i18n" data-i18n="[html]templates.${key}.name"></h5>
</div>
</div>`
});
i18next.addResourceBundle('fr', 'translation', fr);
i18next.addResourceBundle('en', 'translation', en);
i18next.addResourceBundle('es', 'translation', es);
i18next.addResourceBundle('fr', 'translation_template', fr);
i18next.addResourceBundle('en', 'translation_template', en);
i18next.addResourceBundle('es', 'translation_template', es);
localize(".i18n");
document.querySelector('.lds-roller').remove();
});
Expand Down
94 changes: 47 additions & 47 deletions client/package.json
Original file line number Diff line number Diff line change
@@ -1,62 +1,62 @@
{
"devDependencies": {
"webpack-cli": "^2.1.5",
"babel-preset-airbnb": "^2.6.0",
"uglifyjs-webpack-plugin": "^1.3.0",
"babel-loader": "^7.1.5",
"babel-eslint": "^8.2.6",
"eslint": "^4.19.1",
"eslint-plugin-react": "^7.11.1",
"babel-core": "^6.26.0",
"eslint-config-airbnb": "^16.1.0",
"eslint-loader": "^2.1.0",
"clean-webpack-plugin": "^0.1.19",
"css-loader": "^0.28.11",
"webpack": "^4.17.2",
"style-loader": "^0.21.0",
"babel-preset-env": "^1.6.1",
"eslint-plugin-jsx-a11y": "^6.1.1",
"eslint-plugin-import": "^2.14.0",
"babel-plugin-syntax-dynamic-import": "^6.18.0",
"replace-hash-webpack-plugin": "^2.4.2"
},
"dependencies": {
"d3-interpolate": "^1.3.2",
"d3-axis": "^1.0.12",
"d3-drag": "^1.2.3",
"d3-dsv": "^1.0.10",
"d3-brush": "^1.0.6",
"d3-selection": "^1.3.2",
"d3-voronoi": "^1.1.4",
"d3-scale": "^2.1.2",
"d3-request": "latest",
"colorbrewer": "^1.3.0",
"d3-geo-projection": "^2.4.1",
"d3-scale-chromatic": "^1.3.3",
"d3-geo": "^1.11.1",
"bluebird": "^3.5.2",
"d3-voronoi": "^1.1.4",
"d3-brush": "^1.0.6",
"d3-format": "^1.3.2",
"d3-path": "^1.0.7",
"d3-zoom": "^1.7.3",
"d3-selection-multi": "latest",
"tippy.js": "2.5.2",
"d3-array": "^1.2.4",
"d3-polygon": "^1.0.5",
"i18next": "^11.7.0",
"alertifyjs": "^1.11.1",
"d3-selection": "^1.3.2",
"d3-transition": "^1.1.3",
"d3-scale": "^2.1.2",
"jschardet": "^1.6.0",
"tippy.js": "2.5.2",
"d3-zoom": "^1.7.3",
"d3-geo-projection": "^2.4.1",
"d3-axis": "^1.0.12",
"d3-array": "^1.2.4",
"d3-force": "^1.1.2",
"d3-transition": "^1.1.3",
"d3-polygon": "^1.0.5",
"d3-shape": "^1.2.2",
"d3-request": "latest",
"i18next-xhr-backend": "^1.5.1",
"d3-scale-chromatic": "^1.3.3",
"colorbrewer": "^1.3.0",
"d3-selection-multi": "latest",
"loc-i18next": "0.1.4",
"d3-path": "^1.0.7",
"d3-format": "^1.3.2"
"i18next-xhr-backend": "^1.5.1",
"bluebird": "^3.5.2",
"d3-interpolate": "^1.3.2",
"d3-shape": "^1.2.2",
"d3-dsv": "^1.0.10"
},
"name": "magrit-client",
"devDependencies": {
"css-loader": "^0.28.11",
"style-loader": "^0.21.0",
"eslint-plugin-react": "^7.11.1",
"uglifyjs-webpack-plugin": "^1.3.0",
"webpack": "^4.17.2",
"eslint-plugin-import": "^2.14.0",
"eslint-plugin-jsx-a11y": "^6.1.1",
"webpack-cli": "^2.1.5",
"babel-preset-airbnb": "^2.6.0",
"babel-core": "^6.26.0",
"babel-plugin-syntax-dynamic-import": "^6.18.0",
"eslint-loader": "^2.1.0",
"clean-webpack-plugin": "^0.1.19",
"eslint": "^4.19.1",
"eslint-config-airbnb": "^16.1.0",
"replace-hash-webpack-plugin": "^2.4.2",
"babel-preset-env": "^1.6.1",
"babel-loader": "^7.1.5",
"babel-eslint": "^8.2.6"
},
"homepage": "https://github.com/riatelab/magrit",
"scripts": {
"build": "./node_modules/webpack/bin/webpack.js",
"watch": "./node_modules/webpack/bin/webpack.js --watch",
"minify": "NODE_ENV=production ./node_modules/webpack/bin/webpack.js"
"minify": "NODE_ENV=production ./node_modules/webpack/bin/webpack.js",
"watch": "./node_modules/webpack/bin/webpack.js --watch"
},
"version": "0.8.8"
"version": "0.8.9",
"homepage": "https://github.com/riatelab/magrit"
}
7 changes: 7 additions & 0 deletions documentation/src/changelog_fr.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# Historique des versions et des changements effectués

#### 0.8.9 (2018-10-15)

- Corrige bug de traduction de la page d'acceuil.

- Enlève l'ancien formulaire de contact en faveur du formulaire de contact de site web du RIATE.


#### 0.8.8 (2018-09-21)

- Nouveauté : ajout de templates sur la page d'acceuil.
Expand Down
2 changes: 1 addition & 1 deletion magrit_app/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
# -*- coding: utf-8 -*-

__version__ = '0.8.8'
__version__ = '0.8.9'
23 changes: 0 additions & 23 deletions magrit_app/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -588,26 +588,6 @@ async def convert_extrabasemap(request):
['{"key":', str(hashed_input), ',"file":', result, '}']))


async def store_contact_info(request):
"""
Handle a message posted in the contact page by storing it (with the
relevant details) in JSON format in redis.
"""
posted_data = await request.post()
date = datetime.fromtimestamp(
time.time()).strftime("%B %d, %Y at %H:%M:%S")
asyncio.ensure_future(
request.app['redis_conn'].lpush(
'contact', json.dumps({
"name": posted_data.get('name'),
"email": posted_data.get('email'),
"subject": posted_data.get('subject'),
"message": posted_data.get('message'),
"date": date
})))
return web.Response(text='')


async def carto_doug(posted_data, user_id, app):
posted_data = json.loads(posted_data.get("json"))
f_name = '_'.join([user_id, str(posted_data['topojson'])])
Expand Down Expand Up @@ -1307,7 +1287,6 @@ async def get_stats_json(request):
redis_conn.get('view_onepage'),
redis_conn.get('single_view_onepage'),
])
contact = await redis_conn.lrange('contact', 0, -1)
count = await redis_conn.get('single_view_modulepage')
return web.Response(text=json.dumps({
"view_onepage": view_onepage,
Expand All @@ -1316,7 +1295,6 @@ async def get_stats_json(request):
"layer": layers,
"sample": sample_layers,
"extra_sample_layers": extra_sample_layers,
"contact": contact,
"t": {
"stewart": stewart, "dougenik": doug,
"gridded": gridded, "gridded_point": gridded_pt,
Expand Down Expand Up @@ -1507,7 +1485,6 @@ async def init(loop, port=None, watch_change=False, use_redis=True):
add_route('GET', '/', index_handler)
add_route('GET', '/index', index_handler)
add_route('GET', '/contact', serve_contact_form)
add_route('POST', '/contact', store_contact_info)
add_route('GET', '/modules', serve_main_page)
add_route('GET', '/modules/', serve_main_page)
add_route('GET', '/modules/{expr}', serve_main_page)
Expand Down
9 changes: 9 additions & 0 deletions magrit_app/static/book/changelog_fr.html
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,15 @@ <h1 class="menu-title">Les docs de Magrit</h1>
<div id="content" class="content">
<main>
<a class="header" href="changelog_fr.html#historique-des-versions-et-des-changements-effectués" id="historique-des-versions-et-des-changements-effectués"><h1>Historique des versions et des changements effectués</h1></a>
<a class="header" href="changelog_fr.html#089-2018-10-15" id="089-2018-10-15"><h4>0.8.9 (2018-10-15)</h4></a>
<ul>
<li>
<p>Corrige bug de traduction de la page d'acceuil.</p>
</li>
<li>
<p>Enlève l'ancien formulaire de contact en faveur du formulaire de contact de site web du RIATE.</p>
</li>
</ul>
<a class="header" href="changelog_fr.html#088-2018-09-21" id="088-2018-09-21"><h4>0.8.8 (2018-09-21)</h4></a>
<ul>
<li>
Expand Down
9 changes: 9 additions & 0 deletions magrit_app/static/book/print.html
Original file line number Diff line number Diff line change
Expand Up @@ -1041,6 +1041,15 @@ <h1 class="menu-title">Les docs de Magrit</h1>
<a class="header" href="print.html#pourquoi-magrit-émet-un-message-davertissement-lorsque-la-géométrie-de-certaines-entités-dune-couche-est-nulle-" id="pourquoi-magrit-émet-un-message-davertissement-lorsque-la-géométrie-de-certaines-entités-dune-couche-est-nulle-"><h3>Pourquoi Magrit émet un message d'avertissement lorsque la géométrie de certaines entités d'une couche est nulle ?</h3></a>
<a class="header" href="print.html#pourquoi-nest-il-pas-possible-dafficher-un-fond-type-openstreetmap-lors-de-la-réalisation-dune-carte-avec-magrit-" id="pourquoi-nest-il-pas-possible-dafficher-un-fond-type-openstreetmap-lors-de-la-réalisation-dune-carte-avec-magrit-"><h3>Pourquoi n'est-il pas possible d'afficher un fond type &quot;OpenStreetMap&quot; lors de la réalisation d'une carte avec Magrit ?</h3></a>
<a class="header" href="print.html#historique-des-versions-et-des-changements-effectués" id="historique-des-versions-et-des-changements-effectués"><h1>Historique des versions et des changements effectués</h1></a>
<a class="header" href="print.html#089-2018-10-15" id="089-2018-10-15"><h4>0.8.9 (2018-10-15)</h4></a>
<ul>
<li>
<p>Corrige bug de traduction de la page d'acceuil.</p>
</li>
<li>
<p>Enlève l'ancien formulaire de contact en faveur du formulaire de contact de site web du RIATE.</p>
</li>
</ul>
<a class="header" href="print.html#088-2018-09-21" id="088-2018-09-21"><h4>0.8.8 (2018-09-21)</h4></a>
<ul>
<li>
Expand Down
Loading

0 comments on commit 2699a8f

Please sign in to comment.