From 7c4d00764227c286cd1dc169eada2b7a06df6162 Mon Sep 17 00:00:00 2001 From: Julius Haertl Date: Wed, 9 Nov 2016 13:08:45 +0100 Subject: [PATCH] JS cleanup --- js/controller/BoardController.js | 8 +++---- js/directive/markdownChecklist.js | 34 --------------------------- js/filters/textColorFilter.js | 3 --- js/public/app.js | 38 ++++++++----------------------- js/service/ApiService.js | 12 ++++------ js/service/StackService.js | 2 +- 6 files changed, 20 insertions(+), 77 deletions(-) delete mode 100644 js/directive/markdownChecklist.js diff --git a/js/controller/BoardController.js b/js/controller/BoardController.js index 399b116fe..88283387b 100644 --- a/js/controller/BoardController.js +++ b/js/controller/BoardController.js @@ -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 }); diff --git a/js/directive/markdownChecklist.js b/js/directive/markdownChecklist.js deleted file mode 100644 index 7441b824d..000000000 --- a/js/directive/markdownChecklist.js +++ /dev/null @@ -1,34 +0,0 @@ -/* - * @copyright Copyright (c) 2016 Julius Härtl - * - * @author Julius Härtl - * - * @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 . - * - */ - -// 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) { - - } - }; -}); - diff --git a/js/filters/textColorFilter.js b/js/filters/textColorFilter.js index c11b4eb7c..75b76827c 100644 --- a/js/filters/textColorFilter.js +++ b/js/filters/textColorFilter.js @@ -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"; } diff --git a/js/public/app.js b/js/public/app.js index a202743af..c05ac479d 100644 --- a/js/public/app.js +++ b/js/public/app.js @@ -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