зеркало из https://github.com/nextcloud/deck.git
JS cleanup
This commit is contained in:
Родитель
493b9b6260
Коммит
7c4d007642
|
@ -152,15 +152,15 @@ app.controller('BoardController', function ($rootScope, $scope, $stateParams, St
|
|||
|
||||
$scope.cardDelete = function (card) {
|
||||
CardService.delete(card.id);
|
||||
StackService.deleteCard(card);
|
||||
StackService.removeCard(card);
|
||||
};
|
||||
$scope.cardArchive = function (card) {
|
||||
CardService.archive(card);
|
||||
StackService.deleteCard(card);
|
||||
StackService.removeCard(card);
|
||||
};
|
||||
$scope.cardUnarchive = function (card) {
|
||||
CardService.unarchive(card);
|
||||
StackService.deleteCard(card);
|
||||
StackService.removeCard(card);
|
||||
};
|
||||
|
||||
$scope.labelDelete = function (label) {
|
||||
|
@ -208,7 +208,7 @@ app.controller('BoardController', function ($rootScope, $scope, $stateParams, St
|
|||
CardService.reorder(card, order).then(function (data) {
|
||||
StackService.addCard(card);
|
||||
StackService.reorder(card, order);
|
||||
StackService.deleteCard({
|
||||
StackService.removeCard({
|
||||
id: card.id,
|
||||
stackId: oldStack
|
||||
});
|
||||
|
|
|
@ -1,34 +0,0 @@
|
|||
/*
|
||||
* @copyright Copyright (c) 2016 Julius Härtl <jus@bitgrid.net>
|
||||
*
|
||||
* @author Julius Härtl <jus@bitgrid.net>
|
||||
*
|
||||
* @license GNU AGPL version 3 or any later version
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as
|
||||
* published by the Free Software Foundation, either version 3 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
// OwnCloud Click Handling
|
||||
// https://doc.owncloud.org/server/8.0/developer_manual/app/css.html
|
||||
app.directive('markdownChecklist', function () {
|
||||
'use strict';
|
||||
return {
|
||||
restrict: 'C',
|
||||
link: function (scope, elm) {
|
||||
|
||||
}
|
||||
};
|
||||
});
|
||||
|
|
@ -49,14 +49,11 @@ app.filter('textColorFilter', function() {
|
|||
}
|
||||
h /= 6;
|
||||
}
|
||||
// TODO: Maybe just darken/lighten the color
|
||||
if(l<0.5) {
|
||||
return "#ffffff";
|
||||
} else {
|
||||
return "#000000";
|
||||
}
|
||||
//var rgba = "rgba(" + color.r + "," + color.g + "," + color.b + ",0.7)";
|
||||
//return rgba;
|
||||
} else {
|
||||
return "#000000";
|
||||
}
|
||||
|
|
|
@ -248,15 +248,15 @@ app.controller('BoardController', ["$rootScope", "$scope", "$stateParams", "Stat
|
|||
|
||||
$scope.cardDelete = function (card) {
|
||||
CardService.delete(card.id);
|
||||
StackService.deleteCard(card);
|
||||
StackService.removeCard(card);
|
||||
};
|
||||
$scope.cardArchive = function (card) {
|
||||
CardService.archive(card);
|
||||
StackService.deleteCard(card);
|
||||
StackService.removeCard(card);
|
||||
};
|
||||
$scope.cardUnarchive = function (card) {
|
||||
CardService.unarchive(card);
|
||||
StackService.deleteCard(card);
|
||||
StackService.removeCard(card);
|
||||
};
|
||||
|
||||
$scope.labelDelete = function (label) {
|
||||
|
@ -304,7 +304,7 @@ app.controller('BoardController', ["$rootScope", "$scope", "$stateParams", "Stat
|
|||
CardService.reorder(card, order).then(function (data) {
|
||||
StackService.addCard(card);
|
||||
StackService.reorder(card, order);
|
||||
StackService.deleteCard({
|
||||
StackService.removeCard({
|
||||
id: card.id,
|
||||
stackId: oldStack
|
||||
});
|
||||
|
@ -611,14 +611,11 @@ app.filter('textColorFilter', function() {
|
|||
}
|
||||
h /= 6;
|
||||
}
|
||||
// TODO: Maybe just darken/lighten the color
|
||||
if(l<0.5) {
|
||||
return "#ffffff";
|
||||
} else {
|
||||
return "#000000";
|
||||
}
|
||||
//var rgba = "rgba(" + color.r + "," + color.g + "," + color.b + ",0.7)";
|
||||
//return rgba;
|
||||
} else {
|
||||
return "#000000";
|
||||
}
|
||||
|
@ -715,19 +712,6 @@ app.directive('elastic', [
|
|||
};
|
||||
}
|
||||
]);
|
||||
// OwnCloud Click Handling
|
||||
// https://doc.owncloud.org/server/8.0/developer_manual/app/css.html
|
||||
app.directive('markdownChecklist', function () {
|
||||
'use strict';
|
||||
return {
|
||||
restrict: 'C',
|
||||
link: function (scope, elm) {
|
||||
|
||||
}
|
||||
};
|
||||
});
|
||||
|
||||
|
||||
app.directive('search', ["$document", "$location", function ($document, $location) {
|
||||
'use strict';
|
||||
|
||||
|
@ -768,7 +752,6 @@ app.factory('ApiService', ["$http", "$q", function($http, $q){
|
|||
this.sorted = [];
|
||||
};
|
||||
|
||||
// TODO: Unify error messages
|
||||
ApiService.prototype.fetchAll = function(){
|
||||
var deferred = $q.defer();
|
||||
var self = this;
|
||||
|
@ -779,8 +762,7 @@ app.factory('ApiService', ["$http", "$q", function($http, $q){
|
|||
});
|
||||
deferred.resolve(self.data);
|
||||
}, function (error) {
|
||||
deferred.reject('Error while ' + self.getName() + '.fetchAll() ');
|
||||
|
||||
deferred.reject('Fetching ' + self.endpoint + ' failed');
|
||||
});
|
||||
return deferred.promise;
|
||||
};
|
||||
|
@ -806,7 +788,7 @@ app.factory('ApiService', ["$http", "$q", function($http, $q){
|
|||
deferred.resolve(response.data);
|
||||
|
||||
}, function (error) {
|
||||
deferred.reject('Error in ' + self.endpoint + ' fetchAll() ');
|
||||
deferred.reject('Fetching ' + self.endpoint + ' failed');
|
||||
});
|
||||
return deferred.promise;
|
||||
};
|
||||
|
@ -818,7 +800,7 @@ app.factory('ApiService', ["$http", "$q", function($http, $q){
|
|||
self.add(response.data);
|
||||
deferred.resolve(response.data);
|
||||
}, function (error) {
|
||||
deferred.reject('Error in ' + self.endpoint + ' create() ');
|
||||
deferred.reject('Fetching' + self.endpoint + ' failed');
|
||||
});
|
||||
return deferred.promise;
|
||||
};
|
||||
|
@ -830,7 +812,7 @@ app.factory('ApiService', ["$http", "$q", function($http, $q){
|
|||
self.add(response.data);
|
||||
deferred.resolve(response.data);
|
||||
}, function (error) {
|
||||
deferred.reject('Error while update ' + self.endpoint);
|
||||
deferred.reject('Updating ' + self.endpoint + ' failed');
|
||||
});
|
||||
return deferred.promise;
|
||||
|
||||
|
@ -845,7 +827,7 @@ app.factory('ApiService', ["$http", "$q", function($http, $q){
|
|||
deferred.resolve(response.data);
|
||||
|
||||
}, function (error) {
|
||||
deferred.reject('Error while delete ' + self.endpoint);
|
||||
deferred.reject('Deleting ' + self.endpoint + ' failed');
|
||||
});
|
||||
return deferred.promise;
|
||||
|
||||
|
@ -1185,7 +1167,7 @@ app.factory('StackService', ["ApiService", "$http", "$q", function(ApiService, $
|
|||
}
|
||||
}
|
||||
};
|
||||
StackService.prototype.deleteCard = 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++) {
|
||||
|
|
|
@ -31,7 +31,6 @@ app.factory('ApiService', function($http, $q){
|
|||
this.sorted = [];
|
||||
};
|
||||
|
||||
// TODO: Unify error messages
|
||||
ApiService.prototype.fetchAll = function(){
|
||||
var deferred = $q.defer();
|
||||
var self = this;
|
||||
|
@ -42,8 +41,7 @@ app.factory('ApiService', function($http, $q){
|
|||
});
|
||||
deferred.resolve(self.data);
|
||||
}, function (error) {
|
||||
deferred.reject('Error while ' + self.getName() + '.fetchAll() ');
|
||||
|
||||
deferred.reject('Fetching ' + self.endpoint + ' failed');
|
||||
});
|
||||
return deferred.promise;
|
||||
};
|
||||
|
@ -69,7 +67,7 @@ app.factory('ApiService', function($http, $q){
|
|||
deferred.resolve(response.data);
|
||||
|
||||
}, function (error) {
|
||||
deferred.reject('Error in ' + self.endpoint + ' fetchAll() ');
|
||||
deferred.reject('Fetching ' + self.endpoint + ' failed');
|
||||
});
|
||||
return deferred.promise;
|
||||
};
|
||||
|
@ -81,7 +79,7 @@ app.factory('ApiService', function($http, $q){
|
|||
self.add(response.data);
|
||||
deferred.resolve(response.data);
|
||||
}, function (error) {
|
||||
deferred.reject('Error in ' + self.endpoint + ' create() ');
|
||||
deferred.reject('Fetching' + self.endpoint + ' failed');
|
||||
});
|
||||
return deferred.promise;
|
||||
};
|
||||
|
@ -93,7 +91,7 @@ app.factory('ApiService', function($http, $q){
|
|||
self.add(response.data);
|
||||
deferred.resolve(response.data);
|
||||
}, function (error) {
|
||||
deferred.reject('Error while update ' + self.endpoint);
|
||||
deferred.reject('Updating ' + self.endpoint + ' failed');
|
||||
});
|
||||
return deferred.promise;
|
||||
|
||||
|
@ -108,7 +106,7 @@ app.factory('ApiService', function($http, $q){
|
|||
deferred.resolve(response.data);
|
||||
|
||||
}, function (error) {
|
||||
deferred.reject('Error while delete ' + self.endpoint);
|
||||
deferred.reject('Deleting ' + self.endpoint + ' failed');
|
||||
});
|
||||
return deferred.promise;
|
||||
|
||||
|
|
|
@ -90,7 +90,7 @@ app.factory('StackService', function(ApiService, $http, $q){
|
|||
}
|
||||
}
|
||||
};
|
||||
StackService.prototype.deleteCard = 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++) {
|
||||
|
|
Загрузка…
Ссылка в новой задаче