eslint auto fix

Signed-off-by: Julius Härtl <jus@bitgrid.net>
This commit is contained in:
Julius Härtl
2017-11-11 12:42:35 +01:00
committed by Julius Härtl
parent 47b51c512d
commit afec4f211c
19 changed files with 315 additions and 305 deletions

View File

@@ -20,7 +20,7 @@
*
*/
/** global: OC, oc_defaults, Snap */
/* global Snap */
app.run(function ($document, $rootScope, $transitions, BoardService) {
'use strict';
$document.click(function (event) {

View File

@@ -101,7 +101,7 @@ 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;
{return;}
angular.copy(StackService.getData(), $scope.stacks);
$scope.stacks = $filter('orderBy')($scope.stacks, 'order');
angular.forEach($scope.stacks, function (value, key) {

View File

@@ -46,7 +46,7 @@ app.controller('CardController', function ($scope, $rootScope, $routeParams, $lo
$scope.cardRenameShow = function () {
if ($scope.archived || !BoardService.canEdit())
return false;
{return false;}
else {
$scope.status.cardRename = true;
}
@@ -104,7 +104,7 @@ app.controller('CardController', function ($scope, $rootScope, $routeParams, $lo
};
$scope.labelRemove = function (element, model) {
CardService.removeLabel($scope.cardId, element.id)
CardService.removeLabel($scope.cardId, element.id);
};
$scope.setDuedate = function (duedate) {

View File

@@ -27,19 +27,19 @@
app.filter('relativeDateFilter', function() {
return function (timestamp) {
return OC.Util.relativeModifiedDate(timestamp*1000);
}
};
});
app.filter('relativeDateFilterString', function() {
return function (date) {
return OC.Util.relativeModifiedDate(Date.parse(date));
}
};
});
app.filter('dateToTimestamp', function() {
return function (date) {
return Date.parse(date);
}
};
});
app.filter('parseDate', function() {
@@ -48,7 +48,7 @@ app.filter('parseDate', function() {
return moment(date).format('YYYY-MM-DD');
}
return '';
}
};
});
app.filter('parseTime', function() {
@@ -57,5 +57,5 @@ app.filter('parseTime', function() {
return moment(date).format('HH:mm');
}
return '';
}
};
});

View File

@@ -39,7 +39,7 @@ app.filter('iconWhiteFilter', 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;
@@ -62,5 +62,5 @@ app.filter('iconWhiteFilter', function () {
} else {
return "";
}
}
};
});

View File

@@ -33,5 +33,5 @@ app.filter('lightenColorFilter', function() {
} else {
return "#" + hex;
}
}
};
});

View File

@@ -22,7 +22,7 @@
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]);
@@ -34,5 +34,5 @@ app.filter('orderObjectBy', function(){
return a < b;
});
return array;
}
};
});

View File

@@ -64,5 +64,5 @@ app.filter('textColorFilter', function () {
return "#000000";
}
}
};
});

View File

@@ -128,7 +128,7 @@ app.factory('BoardService', function (ApiService, $http, $q) {
permissionManage: true,
permissionShare: true,
type: type
}
};
};
BoardService.prototype.addAcl = function (acl) {

View File

@@ -20,16 +20,20 @@
*
*/
app.factory('CardService', function(ApiService, $http, $q){
var CardService = function($http, ep, $q) {
app.factory('CardService', function (ApiService, $http, $q) {
var CardService = function ($http, ep, $q) {
ApiService.call(this, $http, ep, $q);
};
CardService.prototype = angular.copy(ApiService.prototype);
CardService.prototype.reorder = function(card, order) {
CardService.prototype.reorder = function (card, order) {
var deferred = $q.defer();
var self = this;
$http.put(this.baseUrl + '/' + card.id + '/reorder', {cardId: card.id, order: order, stackId: card.stackId}).then(function (response) {
$http.put(this.baseUrl + '/' + card.id + '/reorder', {
cardId: card.id,
order: order,
stackId: card.stackId
}).then(function (response) {
deferred.resolve(response.data);
}, function (error) {
deferred.reject('Error while update ' + self.endpoint);
@@ -37,10 +41,13 @@ app.factory('CardService', function(ApiService, $http, $q){
return deferred.promise;
};
CardService.prototype.rename = function(card) {
CardService.prototype.rename = function (card) {
var deferred = $q.defer();
var self = this;
$http.put(this.baseUrl + '/' + card.id + '/rename', {cardId: card.id, title: card.title}).then(function (response) {
$http.put(this.baseUrl + '/' + card.id + '/rename', {
cardId: card.id,
title: card.title
}).then(function (response) {
self.data[card.id].title = card.title;
deferred.resolve(response.data);
}, function (error) {
@@ -49,7 +56,7 @@ app.factory('CardService', function(ApiService, $http, $q){
return deferred.promise;
};
CardService.prototype.assignLabel = function(card, label) {
CardService.prototype.assignLabel = function (card, label) {
var url = this.baseUrl + '/' + card + '/label/' + label;
var deferred = $q.defer();
var self = this;
@@ -60,7 +67,7 @@ app.factory('CardService', function(ApiService, $http, $q){
});
return deferred.promise;
};
CardService.prototype.removeLabel = function(card, label) {
CardService.prototype.removeLabel = function (card, label) {
var url = this.baseUrl + '/' + card + '/label/' + label;
var deferred = $q.defer();
var self = this;
@@ -115,7 +122,7 @@ app.factory('CardService', function(ApiService, $http, $q){
var deferred = $q.defer();
var self = this;
$http.delete(this.baseUrl + '/' + card.id + '/assign/' + user, {}).then(function (response) {
self.getCurrent().assignedUsers = self.getCurrent().assignedUsers.filter(function( obj ) {
self.getCurrent().assignedUsers = self.getCurrent().assignedUsers.filter(function (obj) {
return obj.participant.uid !== user;
});
deferred.resolve(response.data);

View File

@@ -20,15 +20,15 @@
*
*/
app.factory('StackService', function(ApiService, $http, $q){
var StackService = function($http, ep, $q) {
app.factory('StackService', function (ApiService, $http, $q) {
var StackService = function ($http, ep, $q) {
ApiService.call(this, $http, ep, $q);
};
StackService.prototype = angular.copy(ApiService.prototype);
StackService.prototype.fetchAll = function(boardId) {
StackService.prototype.fetchAll = function (boardId) {
var deferred = $q.defer();
var self=this;
$http.get(this.baseUrl +'/'+boardId).then(function (response) {
var self = this;
$http.get(this.baseUrl + '/' + boardId).then(function (response) {
self.clear();
self.addAll(response.data);
deferred.resolve(self.data);
@@ -38,10 +38,10 @@ app.factory('StackService', function(ApiService, $http, $q){
return deferred.promise;
};
StackService.prototype.fetchArchived = function(boardId) {
StackService.prototype.fetchArchived = function (boardId) {
var deferred = $q.defer();
var self=this;
$http.get(this.baseUrl +'/'+boardId+'/archived').then(function (response) {
var self = this;
$http.get(this.baseUrl + '/' + boardId + '/archived').then(function (response) {
self.clear();
self.addAll(response.data);
deferred.resolve(self.data);
@@ -51,17 +51,20 @@ app.factory('StackService', function(ApiService, $http, $q){
return deferred.promise;
};
StackService.prototype.addCard = function(entity) {
if(!this.data[entity.stackId].cards) {
StackService.prototype.addCard = function (entity) {
if (!this.data[entity.stackId].cards) {
this.data[entity.stackId].cards = [];
}
this.data[entity.stackId].cards.push(entity);
};
StackService.prototype.reorder = function(stack, order) {
StackService.prototype.reorder = function (stack, order) {
var deferred = $q.defer();
var self = this;
$http.put(this.baseUrl + '/' + stack.id + '/reorder', {stackId: stack.id, order: order}).then(function (response) {
$http.put(this.baseUrl + '/' + stack.id + '/reorder', {
stackId: stack.id,
order: order
}).then(function (response) {
angular.forEach(response.data, function (value, key) {
var id = value.id;
self.data[id].order = value.order;
@@ -73,43 +76,43 @@ app.factory('StackService', function(ApiService, $http, $q){
return deferred.promise;
};
StackService.prototype.reorderCard = function(entity, order) {
StackService.prototype.reorderCard = function (entity, order) {
// assign new order
for(var i=0, j=0;i<this.data[entity.stackId].cards.length;i++) {
if(this.data[entity.stackId].cards[i].id === entity.id) {
for (var i = 0, j = 0; i < this.data[entity.stackId].cards.length; i++) {
if (this.data[entity.stackId].cards[i].id === entity.id) {
this.data[entity.stackId].cards[i].order = order;
}
if(j === order) {
if (j === order) {
j++;
}
if(this.data[entity.stackId].cards[i].id !== entity.id) {
if (this.data[entity.stackId].cards[i].id !== entity.id) {
this.data[entity.stackId].cards[i].order = j++;
}
}
// sort array by order
this.data[entity.stackId].cards.sort(function(a,b) {
this.data[entity.stackId].cards.sort(function (a, b) {
if (a.order < b.order)
return -1;
{return -1;}
if (a.order > b.order)
return 1;
{return 1;}
return 0;
});
};
StackService.prototype.updateCard = function(entity) {
StackService.prototype.updateCard = function (entity) {
var self = this;
var cards = this.data[entity.stackId].cards;
for(var i=0;i<cards.length;i++) {
if(cards[i].id == entity.id) {
for (var i = 0; i < cards.length; i++) {
if (cards[i].id == entity.id) {
cards[i] = entity;
}
}
};
StackService.prototype.removeCard = function(entity) {
StackService.prototype.removeCard = function (entity) {
var self = this;
var cards = this.data[entity.stackId].cards;
for(var i=0;i<cards.length;i++) {
if(cards[i].id == entity.id) {
for (var i = 0; i < cards.length; i++) {
if (cards[i].id == entity.id) {
cards.splice(i, 1);
}
}

View File

@@ -20,9 +20,9 @@
*
*/
app.factory('StatusService', function(){
app.factory('StatusService', function () {
// Status Helper
var StatusService = function() {
var StatusService = function () {
this.active = true;
this.icon = 'loading';
this.title = '';
@@ -31,14 +31,14 @@ app.factory('StatusService', function(){
};
StatusService.prototype.setStatus = function($icon, $title, $text) {
StatusService.prototype.setStatus = function ($icon, $title, $text) {
this.active = true;
this.icon = $icon;
this.title = $title;
this.text = $text;
};
StatusService.prototype.setError = function($title, $text) {
StatusService.prototype.setError = function ($title, $text) {
this.active = true;
this.icon = 'error';
this.title = $title;
@@ -46,16 +46,16 @@ app.factory('StatusService', function(){
this.counter = 0;
};
StatusService.prototype.releaseWaiting = function() {
if(this.counter>0)
this.counter--;
if(this.counter<=0) {
StatusService.prototype.releaseWaiting = function () {
if (this.counter > 0)
{this.counter--;}
if (this.counter <= 0) {
this.active = false;
this.counter = 0;
}
};
StatusService.prototype.retainWaiting = function() {
StatusService.prototype.retainWaiting = function () {
this.active = true;
this.icon = 'loading';
this.title = '';
@@ -63,15 +63,15 @@ app.factory('StatusService', function(){
this.counter++;
};
StatusService.prototype.unsetStatus = function() {
StatusService.prototype.unsetStatus = function () {
this.active = false;
};
return {
getInstance: function() {
getInstance: function () {
return new StatusService();
}
}
};
});