Skip to content

Commit f47cd9d

Browse files
Merge branch 'develop' of https://github.com/sklintyg/statistik into develop
2 parents b228b75 + 91fbdde commit f47cd9d

File tree

9 files changed

+57
-54
lines changed

9 files changed

+57
-54
lines changed

statistik-web/src/main/webapp/js/app/app.js

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,20 @@ underscore.factory('_', function() {
66
});
77

88
/* App Module */
9-
var app = angular.module('StatisticsApp', [ 'ngRoute', 'ngCookies', 'ngSanitize', 'ui.bootstrap', 'underscore' ]).config(
9+
var app = angular.module('StatisticsApp', [ 'ngRoute', 'ngCookies', 'ngSanitize', 'ui.bootstrap', 'underscore' ])
10+
.constant("COUNTY_COORDS", [{name: 'blekinge', xy: {"x": 35, "y": 15}} , {name: 'dalarna', xy: {"x": 31, "y": 50}},
11+
{name: 'halland', xy: {"x": 14, "y": 20}}, {name: 'kalmar', xy: {"x": 40, "y": 20}},
12+
{name: 'kronoberg', xy: {"x": 32, "y": 19}}, {name: 'gotland', xy: {"x": 55, "y": 22}},
13+
{name: 'gävleborg', xy: {"x": 45, "y": 50}}, {name: 'jämtland', xy: {"x": 29, "y": 66}},
14+
{name: 'jönköping', xy: {"x": 28, "y": 24}}, {name: 'norrbotten', xy: {"x": 59, "y": 94}},
15+
{name: 'skåne', xy: {"x": 21, "y": 11}}, {name: 'stockholm', xy: {"x": 52, "y": 37}},
16+
{name: 'södermanland', xy: {"x": 44, "y": 34}}, {name: 'uppsala', xy: {"x": 50, "y": 42}},
17+
{name: 'värmland', xy: {"x": 21, "y": 42}}, {name: 'västerbotten', xy: {"x": 51, "y": 80}},
18+
{name: 'västernorrland', xy: {"x": 48, "y": 67}}, {name: 'västmanland', xy: {"x": 42, "y": 42}},
19+
{name: 'västra götaland', xy: {"x": 12, "y": 32}}, {name: 'örebro', xy: {"x": 32, "y": 38}},
20+
{name: 'östergötland', xy: {"x": 40, "y": 30}}, {name: 'DEFAULT', xy: {"x": 12, "y": 94}}]
21+
)
22+
.config(
1023
[ '$routeProvider', '$httpProvider', function ($routeProvider, $httpProvider) {
1124
$routeProvider.when('/login', {
1225
templateUrl: 'views/login.html',

statistik-web/src/main/webapp/js/app/controller/business/businessOverviewCtrl.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -251,10 +251,12 @@ angular.module('StatisticsApp').controller('businessOverviewCtrl', ['$scope', '$
251251
color: color
252252
}
253253
];
254+
254255
var categories = _.map(chartData, function (e) {
255256
return e.name;
256257
});
257-
var chartOptions = ControllerCommons.getHighChartConfigBase(categories, series);
258+
259+
chartOptions = ControllerCommons.getHighChartConfigBase(categories, series);
258260
chartOptions.chart.type = 'column';
259261
chartOptions.chart.renderTo = containerId;
260262
chartOptions.chart.height = 240;

statistik-web/src/main/webapp/js/app/controller/common.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -231,7 +231,7 @@ var ControllerCommons = new function(){
231231

232232
this.getEnhetCountText = function(enhetsCount, basedOnAlreadyInText) {
233233
'use strict';
234-
var singleEnhet = enhetsCount == 1;
234+
var singleEnhet = enhetsCount === 1;
235235
if (basedOnAlreadyInText) {
236236
return enhetsCount ? " och " + enhetsCount + " enhet" + (singleEnhet ? "" : "er") + " " : " ";
237237
}

statistik-web/src/main/webapp/js/app/controller/doubleAreaChartsCtrl.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ angular.module('StatisticsApp').controller('doubleAreaChartsCtrl', [ '$scope', '
6060
printTable.headers = [];
6161
printTable.rows = [];
6262

63-
var totWidth = colWidth * 2; //total width of table frame (first and last column which should be used on all print tables)
63+
totWidth = colWidth * 2; //total width of table frame (first and last column which should be used on all print tables)
6464

6565
//Add headers for first column
6666
for (var i = 0; i < headers.length; i++) {

statistik-web/src/main/webapp/js/app/controller/overviewCtrl.js

Lines changed: 10 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@
1919

2020
'use strict';
2121

22-
angular.module('StatisticsApp').controller('overviewCtrl', [ '$scope', '$rootScope', '$window', '$timeout', 'statisticsData', '$routeParams', 'printFactory',
23-
function ($scope, $rootScope, $window, $timeout, statisticsData, $routeParams, printFactory) {
22+
angular.module('StatisticsApp').controller('overviewCtrl', [ '$scope', '$rootScope', '$window', '$timeout', 'statisticsData', '$routeParams', 'printFactory', 'COUNTY_COORDS',
23+
function ($scope, $rootScope, $window, $timeout, statisticsData, $routeParams, printFactory, COUNTY_COORDS) {
2424

2525
var self = this;
2626

@@ -181,12 +181,13 @@ angular.module('StatisticsApp').controller('overviewCtrl', [ '$scope', '$rootSco
181181
chartOptions.xAxis.title = { text: 'Sjukskrivningslängd' };
182182
chartOptions.yAxis.title = { text: 'Antal' };
183183

184-
chartOptions.yAxis.tickPixelInterval = 30,
185-
chartOptions.legend.enabled = false;
184+
chartOptions.yAxis.tickPixelInterval = 30;
185+
chartOptions.legend.enabled = false;
186+
186187
new Highcharts.Chart(chartOptions);
187188
}
188189

189-
function paintSickLeavePerCountyChart(containerId, chartData, tooltipHeaderPrefix) {
190+
function paintSickLeavePerCountyChart(containerId, chartData) {
190191
var series = _.map(chartData, function (e) {
191192
var coords = self.getCoordinates(e);
192193
return {"data": [
@@ -255,31 +256,17 @@ angular.module('StatisticsApp').controller('overviewCtrl', [ '$scope', '$rootSco
255256
}
256257

257258
self.getCoordinates = function getCoordinates(perCountyObject) {
258-
var defaultCoordinates = {"x": 12, "y": 94};
259-
260-
var counties = [{name: 'blekinge', xy: {"x": 35, "y": 15}} , {name: 'dalarna', xy: {"x": 31, "y": 50}},
261-
{name: 'halland', xy: {"x": 14, "y": 20}}, {name: 'kalmar', xy: {"x": 40, "y": 20}},
262-
{name: 'kronoberg', xy: {"x": 32, "y": 19}}, {name: 'gotland', xy: {"x": 55, "y": 22}},
263-
{name: 'gävleborg', xy: {"x": 45, "y": 50}}, {name: 'jämtland', xy: {"x": 29, "y": 66}},
264-
{name: 'jönköping', xy: {"x": 28, "y": 24}}, {name: 'norrbotten', xy: {"x": 59, "y": 94}},
265-
{name: 'skåne', xy: {"x": 21, "y": 11}}, {name: 'stockholm', xy: {"x": 52, "y": 37}},
266-
{name: 'södermanland', xy: {"x": 44, "y": 34}}, {name: 'uppsala', xy: {"x": 50, "y": 42}},
267-
{name: 'värmland', xy: {"x": 21, "y": 42}}, {name: 'västerbotten', xy: {"x": 51, "y": 80}},
268-
{name: 'västernorrland', xy: {"x": 48, "y": 67}}, {name: 'västmanland', xy: {"x": 42, "y": 42}},
269-
{name: 'västra götaland', xy: {"x": 12, "y": 32}}, {name: 'örebro', xy: {"x": 32, "y": 38}},
270-
{name: 'östergötland', xy: {"x": 40, "y": 30}}];
271-
272-
var result = _.find(counties, function(c) {
259+
var result = _.find(COUNTY_COORDS, function(c) {
273260
if(contains(perCountyObject.name.toLowerCase(), c.name)) {
274261
return c;
275262
}
276263
});
277264

278-
return result ? result.xy : defaultCoordinates;
265+
return result ? result.xy : _.find(COUNTY_COORDS, function(c) { return c.name === "DEFAULT";}).xy;
279266
};
280267

281268
function contains(master, substring) {
282-
return master.indexOf(substring) != -1;
269+
return master.indexOf(substring) !== -1;
283270
}
284271

285272
function extractDonutData(rawData) {
@@ -290,7 +277,7 @@ angular.module('StatisticsApp').controller('overviewCtrl', [ '$scope', '$rootSco
290277
name: ControllerCommons.htmlsafe(data.name),
291278
y: data.quantity,
292279
color: data.color
293-
}
280+
};
294281
});
295282
}
296283

statistik-web/src/main/webapp/js/app/controller/pageCtrl.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ angular.module('StatisticsApp').controller('pageCtrl', [ '$scope', '$rootScope',
6767

6868
$scope.loginClicked = function (url) {
6969
$window.location.href = "#/" + url;
70-
}
70+
};
7171

7272
}
7373
]);

statistik-web/src/main/webapp/js/app/directives.js

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
'use strict';
22

3-
angular.module('StatisticsApp').directive("navigationaware", function ($rootScope, $location) {
4-
3+
angular.module('StatisticsApp').directive("navigationaware", function ($rootScope) {
4+
55
var isActivePage = function(currentRoute, navLinkAttrs) {
66
return currentRoute.controllerAs === navLinkAttrs.ctrlname || currentRoute.controller === navLinkAttrs.ctrlname;
7-
}
7+
};
88

99
return {
1010
restrict: "A",
@@ -32,16 +32,16 @@ angular.module('StatisticsApp').directive("spinner", function() {
3232
showContent: "="
3333
},
3434
template :
35-
'<div>'
36-
+' <div ng-show="showSpinner" class="spinner">'
37-
+' <div class="cssspinner"></div>'
38-
+' <p id="loading-message">'
39-
+' <strong><span>{{ label }}</span></strong>'
40-
+' </p>'
41-
+' </div>'
42-
+' <div ng-transclude></div>'
43-
+'</div>'
44-
}
35+
'<div>' +
36+
' <div ng-show="showSpinner" class="spinner">' +
37+
' <div class="cssspinner"></div>' +
38+
' <p id="loading-message">' +
39+
' <strong><span>{{ label }}</span></strong>' +
40+
' </p>' +
41+
' </div>' +
42+
' <div ng-transclude></div>' +
43+
'</div>'
44+
};
4545
});
4646

4747
angular.module('StatisticsApp').directive("dataerrorview", function() {
@@ -55,18 +55,18 @@ angular.module('StatisticsApp').directive("dataerrorview", function() {
5555
},
5656
template :
5757
'<div>'+
58-
'<div ng-show="showError">'
59-
+'<div ng-include="\'views/error/failedToFetchData.html\'"></div>'
60-
+'</div>'
61-
+' <div ng-show="!showError">'
62-
+' <div ng-transclude></div>'
63-
+' </div>'
64-
+'</div>'
65-
}
58+
'<div ng-show="showError">' +
59+
'<div ng-include="\'views/error/failedToFetchData.html\'"></div>' +
60+
'</div>' +
61+
' <div ng-show="!showError">' +
62+
' <div ng-transclude></div>' +
63+
' </div>' +
64+
'</div>'
65+
};
6666
});
6767

6868
angular.module('StatisticsApp').directive('legendHeight', function() {
69-
return function(scope, element, attrs) {
69+
return function(scope, element) {
7070
if (scope.$last) {
7171
scope.$watch('seriesData', function(){
7272
var heights = _.map(element.parent().children(), function(e){return $(e).height();});
@@ -110,15 +110,15 @@ angular.module('StatisticsApp').directive('multiselectDropdown', function (busin
110110
scope.$watchCollection(attrs.ngModel, function () {
111111
element.multiselect('refresh');
112112
});
113-
}
113+
};
114114
});
115115

116116
angular.module('StatisticsApp').directive('intermediate', function() {
117117
return function(scope, element, attrs) {
118118
scope.$watch(attrs.intermediate, function (newVal) {
119119
element[0].indeterminate = newVal;
120120
});
121-
}
121+
};
122122
});
123123

124124
angular.module('StatisticsApp').directive("submenu", function (recursionService) {

statistik-web/src/main/webapp/js/app/services/printFactory.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -108,13 +108,13 @@ angular.module('StatisticsApp')
108108
var printQuery = bwPrint ? "printBw=true" : "print=true";
109109
var prefixChar = rootScope.queryString ? "&" : "?";
110110
windowParam.open(windowParam.location + prefixChar + printQuery);
111-
}
111+
};
112112

113113
//The public api of this factory
114114
return {
115115
addColor: addColor,
116116
setupSeriesForDisplayType: setupSeriesForDisplayType,
117117
printAndCloseWindow: printAndCloseWindow,
118118
print: print
119-
}
119+
};
120120
});

statistik-web/src/test/javascript/app/services/printFactoryTest.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
*/
1919

2020
describe("Test of common print services", function() {
21+
"use strict";
2122

2223
beforeEach(module('StatisticsApp'));
2324

0 commit comments

Comments
 (0)