From 0191b000dc1f26dd1ae6eef95c06fae2f7378a2f Mon Sep 17 00:00:00 2001 From: Julius Haertl Date: Fri, 28 Oct 2016 11:59:31 +0200 Subject: [PATCH] Remove console output and add relative dates --- js/controller/BoardController.js | 8 -------- js/controller/CardController.js | 1 - js/filters/relativeDateFilter.js | 27 +++++++++++++++++++++++++++ js/public/app.js | 18 ++++++------------ js/service/StackService.js | 3 --- templates/part.card.php | 4 ++-- 6 files changed, 35 insertions(+), 26 deletions(-) create mode 100644 js/filters/relativeDateFilter.js diff --git a/js/controller/BoardController.js b/js/controller/BoardController.js index 50a4ab0bf..b5a3cb11d 100644 --- a/js/controller/BoardController.js +++ b/js/controller/BoardController.js @@ -50,11 +50,9 @@ app.controller('BoardController', function ($rootScope, $scope, $stateParams, St $scope.$state = $stateParams; $scope.filter = $stateParams.filter; $scope.$watch('$state.filter', function (name) { - console.log("statewatch" + name); $scope.filter = name; }); $scope.switchFilter = function (filter) { - console.log("switch filter click " + name); $state.go('.', {filter: filter}, {notify: false}); $scope.filter = filter; }; @@ -88,7 +86,6 @@ 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) { - console.log("filter data"); if ($scope.stacks === undefined) return; angular.copy(StackService.getAll(), $scope.stacks); @@ -101,7 +98,6 @@ app.controller('BoardController', function ($rootScope, $scope, $stateParams, St }; $scope.loadDefault = function () { - console.log("Load default"); StackService.fetchAll($scope.id).then(function (data) { $scope.statusservice.releaseWaiting(); }, function (error) { @@ -110,7 +106,6 @@ app.controller('BoardController', function ($rootScope, $scope, $stateParams, St }; $scope.loadArchived = function () { - console.log("Load archived!"); StackService.fetchArchived($scope.id).then(function (data) { $scope.statusservice.releaseWaiting(); }, function (error) { @@ -188,7 +183,6 @@ app.controller('BoardController', function ($rootScope, $scope, $stateParams, St $scope.labelUpdate = function (label) { label.edit = false; LabelService.update(label); - console.log(label); } $scope.aclAdd = function (sharee) { @@ -207,8 +201,6 @@ app.controller('BoardController', function ($rootScope, $scope, $stateParams, St // settings for card sorting $scope.sortOptions = { itemMoved: function (event) { - console.log('itemMoved'); - // TODO: Implement reodering here (set new order of all cards in stack) event.source.itemScope.modelValue.status = event.dest.sortableScope.$parent.column; var order = event.dest.index; var card = event.source.itemScope.c; diff --git a/js/controller/CardController.js b/js/controller/CardController.js index 15097fe80..18e5f8668 100644 --- a/js/controller/CardController.js +++ b/js/controller/CardController.js @@ -37,7 +37,6 @@ app.controller('CardController', function ($scope, $rootScope, $routeParams, $lo CardService.fetchOne($scope.cardId).then(function(data) { $scope.statusservice.releaseWaiting(); $scope.archived = CardService.getCurrent().archived; - console.log(data); }, function(error) { }); diff --git a/js/filters/relativeDateFilter.js b/js/filters/relativeDateFilter.js new file mode 100644 index 000000000..95e780558 --- /dev/null +++ b/js/filters/relativeDateFilter.js @@ -0,0 +1,27 @@ +/* + * @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 . + * + */ + +app.filter('relativeDateFilter', function() { + return function (timestamp) { + return OC.Util.relativeModifiedDate(timestamp*1000); + } +}); diff --git a/js/public/app.js b/js/public/app.js index 8bcd1e90a..2ebeecd5a 100644 --- a/js/public/app.js +++ b/js/public/app.js @@ -144,11 +144,9 @@ app.controller('BoardController', ["$rootScope", "$scope", "$stateParams", "Stat $scope.$state = $stateParams; $scope.filter = $stateParams.filter; $scope.$watch('$state.filter', function (name) { - console.log("statewatch" + name); $scope.filter = name; }); $scope.switchFilter = function (filter) { - console.log("switch filter click " + name); $state.go('.', {filter: filter}, {notify: false}); $scope.filter = filter; }; @@ -182,7 +180,6 @@ app.controller('BoardController', ["$rootScope", "$scope", "$stateParams", "Stat // filter cards here, as ng-sortable will not work nicely with html-inline filters $scope.filterData = function (order, text) { - console.log("filter data"); if ($scope.stacks === undefined) return; angular.copy(StackService.getAll(), $scope.stacks); @@ -195,7 +192,6 @@ app.controller('BoardController', ["$rootScope", "$scope", "$stateParams", "Stat }; $scope.loadDefault = function () { - console.log("Load default"); StackService.fetchAll($scope.id).then(function (data) { $scope.statusservice.releaseWaiting(); }, function (error) { @@ -204,7 +200,6 @@ app.controller('BoardController', ["$rootScope", "$scope", "$stateParams", "Stat }; $scope.loadArchived = function () { - console.log("Load archived!"); StackService.fetchArchived($scope.id).then(function (data) { $scope.statusservice.releaseWaiting(); }, function (error) { @@ -282,7 +277,6 @@ app.controller('BoardController', ["$rootScope", "$scope", "$stateParams", "Stat $scope.labelUpdate = function (label) { label.edit = false; LabelService.update(label); - console.log(label); } $scope.aclAdd = function (sharee) { @@ -301,8 +295,6 @@ app.controller('BoardController', ["$rootScope", "$scope", "$stateParams", "Stat // settings for card sorting $scope.sortOptions = { itemMoved: function (event) { - console.log('itemMoved'); - // TODO: Implement reodering here (set new order of all cards in stack) event.source.itemScope.modelValue.status = event.dest.sortableScope.$parent.column; var order = event.dest.index; var card = event.source.itemScope.c; @@ -369,7 +361,6 @@ app.controller('CardController', ["$scope", "$rootScope", "$routeParams", "$loca CardService.fetchOne($scope.cardId).then(function(data) { $scope.statusservice.releaseWaiting(); $scope.archived = CardService.getCurrent().archived; - console.log(data); }, function(error) { }); @@ -586,6 +577,12 @@ app.filter('orderObjectBy', function(){ return array; } }); +app.filter('relativeDateFilter', function() { + return function (timestamp) { + return OC.Util.relativeModifiedDate(timestamp*1000); + } +}); + app.filter('textColorFilter', function() { return function (hex) { // RGB2HLS by Garry Tan @@ -1144,19 +1141,16 @@ app.factory('StackService', ["ApiService", "$http", "$q", function(ApiService, $ }; StackService.prototype.addCard = function(entity) { - console.log(this.data); if(!this.data[entity.stackId].cards) { this.data[entity.stackId].cards = []; } this.data[entity.stackId].cards.push(entity); - console.log(this.data); }; StackService.prototype.reorder = function(entity, order) { // assign new order for(var i=0, j=0;i
- t('Modified:')); ?> {{ cardservice.getCurrent().lastModified*1000|date:'medium' }} - t('Created:')); ?> {{ cardservice.getCurrent().createdAt*1000|date:'medium' }} + t('Modified:')); ?> {{ cardservice.getCurrent().lastModified|relativeDateFilter }} + t('Created:')); ?> {{ cardservice.getCurrent().createdAt|relativeDateFilter }} t('by')); ?> {{ cardservice.getCurrent().owner }}