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/vendor/*
/js/node_modules/*
/js/public/*
/karma.conf.js
/tests/*
/l10n/*

View File

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

View File

@@ -48,9 +48,9 @@ app.controller('BoardController', function ($rootScope, $scope, $stateParams, St
StackService.clear(); //FIXME: Is this still needed?
$scope.$watch(function () {
return BoardService.getCurrent().title;
}, function() {
$scope.setPageTitle();
return BoardService.getCurrent().title;
}, function () {
$scope.setPageTitle();
});
$scope.setPageTitle = function () {
@@ -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
$scope.filterData = function (order, text) {
if ($scope.stacks === undefined)
{return;}
if ($scope.stacks === undefined) {
return;
}
angular.copy(StackService.getData(), $scope.stacks);
$scope.stacks = $filter('orderBy')($scope.stacks, 'order');
angular.forEach($scope.stacks, function (value, key) {

View File

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

View File

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

View File

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

View File

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

View File

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