Fix issues

Signed-off-by: Julius Härtl <jus@bitgrid.net>
This commit is contained in:
Julius Härtl
2017-11-11 12:53:11 +01:00
committed by Julius Härtl
parent afec4f211c
commit abc039a634
8 changed files with 22 additions and 13 deletions

View File

@@ -1,6 +1,8 @@
/js/tests/* /js/tests/*
/js/vendor/* /js/vendor/*
/js/node_modules/* /js/node_modules/*
/js/public/*
/karma.conf.js /karma.conf.js
/tests/* /tests/*
/l10n/* /l10n/*

View File

@@ -20,6 +20,7 @@
* *
*/ */
/* global module */
module.exports = function(grunt) { module.exports = function(grunt) {
'use strict'; 'use strict';

View File

@@ -100,8 +100,9 @@ app.controller('BoardController', function ($rootScope, $scope, $stateParams, St
// filter cards here, as ng-sortable will not work nicely with html-inline filters // filter cards here, as ng-sortable will not work nicely with html-inline filters
$scope.filterData = function (order, text) { $scope.filterData = function (order, text) {
if ($scope.stacks === undefined) if ($scope.stacks === undefined) {
{return;} return;
}
angular.copy(StackService.getData(), $scope.stacks); angular.copy(StackService.getData(), $scope.stacks);
$scope.stacks = $filter('orderBy')($scope.stacks, 'order'); $scope.stacks = $filter('orderBy')($scope.stacks, 'order');
angular.forEach($scope.stacks, function (value, key) { angular.forEach($scope.stacks, function (value, key) {

View File

@@ -22,11 +22,15 @@
app.filter('orderObjectBy', function(){ app.filter('orderObjectBy', function(){
return function(input, attribute) { return function(input, attribute) {
if (!angular.isObject(input)) {return input;} if (!angular.isObject(input)) {
return input;
}
var array = []; var array = [];
for(var objectKey in input) { for(var objectKey in input) {
if ({}.hasOwnProperty.call(input, objectKey)) {
array.push(input[objectKey]); array.push(input[objectKey]);
} }
}
array.sort(function(a, b){ array.sort(function(a, b){
a = parseInt(a[attribute]); a = parseInt(a[attribute]);

View File

@@ -37,7 +37,7 @@ app.filter('textColorFilter', function () {
var max = Math.max(r, g, b), min = Math.min(r, g, b); var max = Math.max(r, g, b), min = Math.min(r, g, b);
var h, s, l = (max + min) / 2; var h, s, l = (max + min) / 2;
if (max == min) { if (max === min) {
h = s = 0; // achromatic h = s = 0; // achromatic
} else { } else {
var d = max - min; var d = max - min;

View File

@@ -132,6 +132,6 @@ app.factory('CardService', function (ApiService, $http, $q) {
return deferred.promise; return deferred.promise;
}; };
service = new CardService($http, 'cards', $q); var service = new CardService($http, 'cards', $q);
return service; return service;
}); });

View File

@@ -103,7 +103,7 @@ app.factory('StackService', function (ApiService, $http, $q) {
var self = this; var self = this;
var cards = this.data[entity.stackId].cards; var cards = this.data[entity.stackId].cards;
for (var i = 0; i < cards.length; i++) { for (var i = 0; i < cards.length; i++) {
if (cards[i].id == entity.id) { if (cards[i].id === entity.id) {
cards[i] = entity; cards[i] = entity;
} }
} }
@@ -112,13 +112,13 @@ app.factory('StackService', function (ApiService, $http, $q) {
var self = this; var self = this;
var cards = this.data[entity.stackId].cards; var cards = this.data[entity.stackId].cards;
for (var i = 0; i < cards.length; i++) { for (var i = 0; i < cards.length; i++) {
if (cards[i].id == entity.id) { if (cards[i].id === entity.id) {
cards.splice(i, 1); cards.splice(i, 1);
} }
} }
}; };
service = new StackService($http, 'stacks', $q); var service = new StackService($http, 'stacks', $q);
return service; return service;
}); });

View File

@@ -12,4 +12,5 @@ find -name "*.js" -not -path '*js/node_modules*' \
-not -path '*l10n/*' \ -not -path '*l10n/*' \
-not -path '*js/vendor*' \ -not -path '*js/vendor*' \
-not -path '*js/tests*' \ -not -path '*js/tests*' \
-print0 | xargs -0 $ESLINT --quiet -not -path '*js/public*' \
-print0 | xargs -0 $ESLINT