Skip to content

Commit b5152ef

Browse files
author
Jelte Lagendijk
committed
Code cleanup & templates cleanup
1 parent 5259a2b commit b5152ef

File tree

22 files changed

+79
-218
lines changed

22 files changed

+79
-218
lines changed

.jshintrc

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,8 @@
99
"undef" : true,
1010
"globals" : {
1111
"mendix" : false,
12-
"mx" : false
12+
"mx" : false,
13+
"logger" : false
1314
},
1415

1516
// Relaxing

src/ChartJS/widgets/BarChart/widget/BarChart.js

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,12 @@
1-
/*jslint vars: true, plusplus: true, devel: true, nomen: true, regexp: true, indent: 4, maxerr: 50 */
2-
/*global mx, mendix, require, console, define, module, logger, window */
3-
/*mendix */
41
define([
5-
6-
"dojo/_base/declare", "dojo/_base/lang", "dojo/on", "ChartJS/widgets/Core"
7-
8-
], function (declare, lang, on, _core) {
2+
"dojo/_base/declare",
3+
"ChartJS/widgets/Core",
4+
"dojo/_base/lang",
5+
"dojo/on"
6+
], function (declare, Core, lang, on) {
97
"use strict";
108

11-
// Declare widget.
12-
return declare("ChartJS.widgets.BarChart.widget.BarChart", [ _core ], {
13-
14-
// Overwrite functions from _core here...
9+
return declare("ChartJS.widgets.BarChart.widget.BarChart", [ Core ], {
1510

1611
_processData : function () {
1712
logger.debug(this.id + "._processData");

src/ChartJS/widgets/BarChart/widget/templates/BarChart.html

Lines changed: 0 additions & 5 deletions
This file was deleted.

src/ChartJS/widgets/BarChart/widget/ui/BarChart.css

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
.chartjs-node {
22
position: relative;
33
}
4+
45
.legend-node {
56
width: 250px;
67
padding: 5px;
@@ -24,6 +25,7 @@
2425
opacity: 0.5;
2526
filter:Alpha(opacity=50);
2627
}
28+
2729
.chartjs-custom-tooltip {
2830
position: absolute;
2931
top: -50px;
@@ -42,4 +44,4 @@
4244
display: inline-block;
4345
padding: 10px;
4446
background-color: #f1f1f1;
45-
}
47+
}

src/ChartJS/widgets/Core.js

Lines changed: 20 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,25 @@
1-
/*jslint white:true, nomen: true, plusplus: true */
2-
/*global mx, mxui, mendix, require, console, define, module, logger, ChartJS, position, clearTimeout, setTimeout */
3-
/*mendix */
4-
5-
// Required module list. Remove unnecessary modules, you can always get them back from the boilerplate.
61
define([
72

83
// Mixins
9-
"dojo/_base/declare", "mxui/widget/_WidgetBase", "dijit/_TemplatedMixin",
4+
"dojo/_base/declare",
5+
"mxui/widget/_WidgetBase",
6+
"dijit/_TemplatedMixin",
107

118
// Client API and DOJO functions
12-
"mxui/dom", "dojo/dom", "dojo/query", "dojo/dom-prop", "dojo/dom-geometry", "dojo/dom-class", "dojo/dom-attr", "dojo/dom-style", "dojo/_base/window", "dojo/dom-construct", "dojo/_base/array", "dojo/_base/lang", "dojo/html", "dojo/ready",
9+
"mxui/dom",
10+
"dojo/dom",
11+
"dojo/query",
12+
"dojo/dom-prop",
13+
"dojo/dom-geometry",
14+
"dojo/dom-class",
15+
"dojo/dom-attr",
16+
"dojo/dom-style",
17+
"dojo/_base/window",
18+
"dojo/dom-construct",
19+
"dojo/_base/array",
20+
"dojo/_base/lang",
21+
"dojo/html",
22+
"dojo/ready",
1323

1424
// External libraries
1525
"ChartJS/lib/charts",
@@ -62,8 +72,6 @@ define([
6272
_tooltipNode: null,
6373

6474
startup: function () {
65-
// Uncomment line to start debugging
66-
//logger.level(logger.DEBUG);
6775
logger.debug(this.id + ".startup");
6876

6977
var domNode = null;
@@ -539,9 +547,9 @@ define([
539547
callback(obj);
540548
}
541549
}),
542-
error: function (error) {
543-
console.log(error.description);
544-
}
550+
error: lang.hitch(this, function (error) {
551+
console.log(this.id + "._executeMicroflow error: " + error.description);
552+
})
545553
}, this);
546554
}
547555

src/ChartJS/widgets/DoughnutChart/widget/DoughnutChart.js

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,14 @@
1-
/*jslint vars: true, plusplus: true, devel: true, nomen: true, regexp: true, indent: 4, maxerr: 50 */
2-
/*global mx, mendix, require, console, define, module, logger, window */
3-
/*mendix */
41
define([
5-
6-
"dojo/_base/declare", "dojo/_base/lang", "dojo/query", "dojo/on", "dojo/html", "ChartJS/widgets/Core"
7-
8-
], function (declare, lang, domQuery, on, html, _core) {
2+
"dojo/_base/declare",
3+
"ChartJS/widgets/Core",
4+
"dojo/_base/lang",
5+
"dojo/query",
6+
"dojo/on",
7+
"dojo/html"
8+
], function (declare, Core, lang, domQuery, on, html) {
99
"use strict";
1010

11-
// Declare widget.
12-
return declare("ChartJS.widgets.DoughnutChart.widget.DoughnutChart", [ _core ], {
11+
return declare("ChartJS.widgets.DoughnutChart.widget.DoughnutChart", [ Core ], {
1312

1413
_processData : function () {
1514
logger.debug(this.id + "._processData");

src/ChartJS/widgets/DoughnutChart/widget/templates/DoughnutChart.html

Lines changed: 0 additions & 5 deletions
This file was deleted.
Lines changed: 1 addition & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1 @@
1-
.chartjs-node {
2-
position: relative;
3-
}
4-
.legend-node {
5-
width: 100%;
6-
padding: 5px;
7-
}
8-
.legend-node li {
9-
cursor: pointer;
10-
}
11-
.pie-legend {
12-
text-align : center;
13-
}
14-
.pie-legend li {
15-
clear: none;
16-
display: inline-block;
17-
margin-right: 20px;
18-
}
1+
/* DoughnutChart reference css file, all general ChartJS styles are in widgets/BarChart/widget/ui/BarChart.css */

src/ChartJS/widgets/LineChart/widget/LineChart.js

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,13 @@
1-
/*jslint vars: true, plusplus: true, devel: true, nomen: true, regexp: true, indent: 4, maxerr: 50 */
2-
/*global mx, mendix, require, console, define, module, logger, window */
3-
/*mendix */
41
define([
5-
6-
"dojo/_base/declare", "dojo/_base/lang", "dojo/query", "dojo/on", "ChartJS/widgets/Core"
7-
8-
], function (declare, lang, domQuery, on, _core) {
2+
"dojo/_base/declare",
3+
"ChartJS/widgets/Core",
4+
"dojo/_base/lang",
5+
"dojo/query",
6+
"dojo/on"
7+
], function (declare, Core, lang, domQuery, on) {
98
"use strict";
109

11-
// Declare widget.
12-
return declare("ChartJS.widgets.LineChart.widget.LineChart", [ _core ], {
10+
return declare("ChartJS.widgets.LineChart.widget.LineChart", [ Core ], {
1311

1412
// Overwrite functions from _core here...
1513

@@ -255,6 +253,7 @@ define([
255253

256254
});
257255
});
256+
258257
require(["ChartJS/widgets/LineChart/widget/LineChart"], function () {
259258
"use strict";
260259
});

src/ChartJS/widgets/LineChart/widget/templates/LineChart.html

Lines changed: 0 additions & 5 deletions
This file was deleted.

0 commit comments

Comments
 (0)