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

[!!!][TASK] Rename class Data to Controller

The Data class provides several methods to handle the complete project.
Thus, it acts more or less as controller for both visualization classes,
Map and Chart, and should be renamed since it does not only provide data
for both classes anymore.
parent d425d3fa
......@@ -21,7 +21,7 @@ window.d3 = Object.assign({},
window.Global = require('./modules/variables');
// Load classes
let { Data } = require('./partials/data');
let { Controller } = require('./partials/controller');
let { VisualizationMap } = require('./partials/map');
let { Chart } = require('./partials/chart');
......@@ -32,4 +32,4 @@ let chart = new Chart().init();
let map = new VisualizationMap().geo(Global.GEO_FILE).chart(chart);
// Get data and update visualization
new Data(map, chart);
new Controller(map, chart);
......@@ -9,7 +9,7 @@
* years. The class is also used to initialize the visualization. It serves as interface and data collector/provider
* between visualization classes and functions.
*/
export class Data
export class Controller
{
/**
* Read data information and initialize map and chart visualization.
......@@ -54,7 +54,7 @@ export class Data
initSpinner()
{
// Hide page
Data.hidePage();
Controller.hidePage();
// Markup from Spinkit
let spinner = `<div class="sk-wave">
......@@ -128,17 +128,17 @@ export class Data
}
// Check if cookie for device-notice is set
Data.initDeviceNotice();
Controller.initDeviceNotice();
// Start visualization, then hide spinner
$.when(
this.map.data(this.dataFile),
this.chart.data(this.dataFile),
this.update()
).done(Data.closeFullscreen);
).done(Controller.closeFullscreen);
// Add event for confirm button of device notice
$(Global.DEVICE_NOTICE_CONFIRM_SELECTOR).on('click', () => { Data.hideDeviceNotice(); });
$(Global.DEVICE_NOTICE_CONFIRM_SELECTOR).on('click', () => { Controller.hideDeviceNotice(); });
// Change document title
document.title = `${document.title}: ${data.title}`;
......@@ -181,12 +181,12 @@ export class Data
$('main').hide();
// Hide spinner
Data.closeFullscreen();
Controller.closeFullscreen();
})
.always(() =>
{
// Show page
Data.showPage();
Controller.showPage();
});
}
......
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