Verified Commit 5aa2aa43 authored by Elias Häußler's avatar Elias Häußler 🐛

[FEATURE] Add necessary output of license which is used for the data

The provided data are published under a common license which needs to be
displayed if anybody works with the data. Therefore this commit adds the
ability to download license information and show them on the project page.
parent 474eaa68
......@@ -91,7 +91,11 @@ def get_information(url: str) -> object:
return {
"title": data['title'],
"author": data['author'],
"data_url": data_url
"data_url": data_url,
"license": {
"title": data['license_title'],
"url": data['license_url']
}
}
......@@ -212,7 +216,8 @@ def save_information(info: object, file: str, keys: object):
"sex": sex,
"state": state,
"semester": semester
}
},
"license": info['license']
}
# Write data to json file
......
......@@ -53,6 +53,12 @@ module.exports = {
*/
CHART_SELECTOR: ".visualization__chart",
/**
* CSS selector for output of license
* @type {string}
*/
LICENSE_SELECTOR: ".page-footer__license",
/**
* Minimum device width which is necessary to place both map and chart next to each other
* @type {number}
......
......@@ -150,6 +150,9 @@ export class Controller
// Change document title
document.title = `${document.title}: ${data.title}`;
// Show license information
Controller.showLicense(data.license);
})
.fail(() =>
{
......@@ -284,6 +287,28 @@ export class Controller
$('body').addClass(Global.DEVICE_NOTICE_CONFIRMED_CLASS);
}
/**
* Show license of the provided data.
*
* Shows the license of the provided data in the footer since this is necessary when working with the provided data.
* The license parameter should at least contain a title, but it's also possible to provide a URL to the license.
*
* @param license Object which contains title and URL (optional) to the given license
*/
static showLicense(license)
{
if (!license.title) return;
let output = " · License: ";
if (license.url) {
output += `<a href="${license.url}" target="_blank">${license.title}</a>`;
} else {
output += license.title;
}
$(Global.LICENSE_SELECTOR).html(output);
}
/**
* Update page URL with given settings from controls.
*
......
{"title": "Studierende: Bundesl\u00e4nder, Semester, Nationalit\u00e4t, Geschlecht", "author": "Statistisches Bundesamt", "url": "https://www-genesis.destatis.de/genesis/online?sequenz=tabelleDownload&selectionname=21311-0005&regionalschluessel=&format=csv", "file": "data/data.csv", "attributes": {"nationality": ["Germans", "Foreigners", "Total"], "sex": ["Male", "Female", "Total"], "state": ["Baden-W\u00fcrttemberg", "Bayern", "Berlin", "Brandenburg", "Bremen", "Hamburg", "Hessen", "Mecklenburg-Vorpommern", "Niedersachsen", "Nordrhein-Westfalen", "Rheinland-Pfalz", "Saarland", "Sachsen", "Sachsen-Anhalt", "Schleswig-Holstein", "Th\u00fcringen"], "semester": ["WT 1998/99", "WT 1999/00", "WT 2000/01", "WT 2001/02", "WT 2002/03", "WT 2003/04", "WT 2004/05", "WT 2005/06", "WT 2006/07", "WT 2007/08", "WT 2008/09", "WT 2009/10", "WT 2010/11", "WT 2011/12", "WT 2012/13", "WT 2013/14", "WT 2014/15", "WT 2015/16", "WT 2016/17"]}}
\ No newline at end of file
{"title": "Studierende: Bundesl\u00e4nder, Semester, Nationalit\u00e4t, Geschlecht", "author": "Statistisches Bundesamt", "url": "https://www-genesis.destatis.de/genesis/online?sequenz=tabelleDownload&selectionname=21311-0005&regionalschluessel=&format=csv", "file": "data/data.csv", "attributes": {"nationality": ["Germans", "Foreigners", "Total"], "sex": ["Male", "Female", "Total"], "state": ["Baden-W\u00fcrttemberg", "Bayern", "Berlin", "Brandenburg", "Bremen", "Hamburg", "Hessen", "Mecklenburg-Vorpommern", "Niedersachsen", "Nordrhein-Westfalen", "Rheinland-Pfalz", "Saarland", "Sachsen", "Sachsen-Anhalt", "Schleswig-Holstein", "Th\u00fcringen"], "semester": ["WT 1998/99", "WT 1999/00", "WT 2000/01", "WT 2001/02", "WT 2002/03", "WT 2003/04", "WT 2004/05", "WT 2005/06", "WT 2006/07", "WT 2007/08", "WT 2008/09", "WT 2009/10", "WT 2010/11", "WT 2011/12", "WT 2012/13", "WT 2013/14", "WT 2014/15", "WT 2015/16", "WT 2016/17"]}, "license": {"title": "Datenlizenz Deutschland Namensnennung 2.0", "url": "https://www.govdata.de/dl-de/by-2-0"}}
\ No newline at end of file
......@@ -36,6 +36,7 @@
<div class="page-footer__copyright">
&copy; 2018 <a class="link" href="https://www.elias-haeussler.de" target="_blank">Elias Häußler</a>
&middot; <a class="link" href="https://github.com/eliashaeussler/student-growth" target="_blank">GitHub</a>
<span class="page-footer__license"></span>
</div>
</footer> <!-- eof: .page-footer -->
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment