Remove console output and add relative dates

This commit is contained in:
Julius Haertl
2016-10-28 11:59:31 +02:00
parent d8217edb82
commit 0191b000dc
6 changed files with 35 additions and 26 deletions

View File

@@ -50,11 +50,9 @@ app.controller('BoardController', function ($rootScope, $scope, $stateParams, St
$scope.$state = $stateParams; $scope.$state = $stateParams;
$scope.filter = $stateParams.filter; $scope.filter = $stateParams.filter;
$scope.$watch('$state.filter', function (name) { $scope.$watch('$state.filter', function (name) {
console.log("statewatch" + name);
$scope.filter = name; $scope.filter = name;
}); });
$scope.switchFilter = function (filter) { $scope.switchFilter = function (filter) {
console.log("switch filter click " + name);
$state.go('.', {filter: filter}, {notify: false}); $state.go('.', {filter: filter}, {notify: false});
$scope.filter = filter; $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 // filter cards here, as ng-sortable will not work nicely with html-inline filters
$scope.filterData = function (order, text) { $scope.filterData = function (order, text) {
console.log("filter data");
if ($scope.stacks === undefined) if ($scope.stacks === undefined)
return; return;
angular.copy(StackService.getAll(), $scope.stacks); angular.copy(StackService.getAll(), $scope.stacks);
@@ -101,7 +98,6 @@ app.controller('BoardController', function ($rootScope, $scope, $stateParams, St
}; };
$scope.loadDefault = function () { $scope.loadDefault = function () {
console.log("Load default");
StackService.fetchAll($scope.id).then(function (data) { StackService.fetchAll($scope.id).then(function (data) {
$scope.statusservice.releaseWaiting(); $scope.statusservice.releaseWaiting();
}, function (error) { }, function (error) {
@@ -110,7 +106,6 @@ app.controller('BoardController', function ($rootScope, $scope, $stateParams, St
}; };
$scope.loadArchived = function () { $scope.loadArchived = function () {
console.log("Load archived!");
StackService.fetchArchived($scope.id).then(function (data) { StackService.fetchArchived($scope.id).then(function (data) {
$scope.statusservice.releaseWaiting(); $scope.statusservice.releaseWaiting();
}, function (error) { }, function (error) {
@@ -188,7 +183,6 @@ app.controller('BoardController', function ($rootScope, $scope, $stateParams, St
$scope.labelUpdate = function (label) { $scope.labelUpdate = function (label) {
label.edit = false; label.edit = false;
LabelService.update(label); LabelService.update(label);
console.log(label);
} }
$scope.aclAdd = function (sharee) { $scope.aclAdd = function (sharee) {
@@ -207,8 +201,6 @@ app.controller('BoardController', function ($rootScope, $scope, $stateParams, St
// settings for card sorting // settings for card sorting
$scope.sortOptions = { $scope.sortOptions = {
itemMoved: function (event) { 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; event.source.itemScope.modelValue.status = event.dest.sortableScope.$parent.column;
var order = event.dest.index; var order = event.dest.index;
var card = event.source.itemScope.c; var card = event.source.itemScope.c;

View File

@@ -37,7 +37,6 @@ app.controller('CardController', function ($scope, $rootScope, $routeParams, $lo
CardService.fetchOne($scope.cardId).then(function(data) { CardService.fetchOne($scope.cardId).then(function(data) {
$scope.statusservice.releaseWaiting(); $scope.statusservice.releaseWaiting();
$scope.archived = CardService.getCurrent().archived; $scope.archived = CardService.getCurrent().archived;
console.log(data);
}, function(error) { }, function(error) {
}); });

View File

@@ -0,0 +1,27 @@
/*
* @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/>.
*
*/
app.filter('relativeDateFilter', function() {
return function (timestamp) {
return OC.Util.relativeModifiedDate(timestamp*1000);
}
});

View File

@@ -144,11 +144,9 @@ app.controller('BoardController', ["$rootScope", "$scope", "$stateParams", "Stat
$scope.$state = $stateParams; $scope.$state = $stateParams;
$scope.filter = $stateParams.filter; $scope.filter = $stateParams.filter;
$scope.$watch('$state.filter', function (name) { $scope.$watch('$state.filter', function (name) {
console.log("statewatch" + name);
$scope.filter = name; $scope.filter = name;
}); });
$scope.switchFilter = function (filter) { $scope.switchFilter = function (filter) {
console.log("switch filter click " + name);
$state.go('.', {filter: filter}, {notify: false}); $state.go('.', {filter: filter}, {notify: false});
$scope.filter = filter; $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 // filter cards here, as ng-sortable will not work nicely with html-inline filters
$scope.filterData = function (order, text) { $scope.filterData = function (order, text) {
console.log("filter data");
if ($scope.stacks === undefined) if ($scope.stacks === undefined)
return; return;
angular.copy(StackService.getAll(), $scope.stacks); angular.copy(StackService.getAll(), $scope.stacks);
@@ -195,7 +192,6 @@ app.controller('BoardController', ["$rootScope", "$scope", "$stateParams", "Stat
}; };
$scope.loadDefault = function () { $scope.loadDefault = function () {
console.log("Load default");
StackService.fetchAll($scope.id).then(function (data) { StackService.fetchAll($scope.id).then(function (data) {
$scope.statusservice.releaseWaiting(); $scope.statusservice.releaseWaiting();
}, function (error) { }, function (error) {
@@ -204,7 +200,6 @@ app.controller('BoardController', ["$rootScope", "$scope", "$stateParams", "Stat
}; };
$scope.loadArchived = function () { $scope.loadArchived = function () {
console.log("Load archived!");
StackService.fetchArchived($scope.id).then(function (data) { StackService.fetchArchived($scope.id).then(function (data) {
$scope.statusservice.releaseWaiting(); $scope.statusservice.releaseWaiting();
}, function (error) { }, function (error) {
@@ -282,7 +277,6 @@ app.controller('BoardController', ["$rootScope", "$scope", "$stateParams", "Stat
$scope.labelUpdate = function (label) { $scope.labelUpdate = function (label) {
label.edit = false; label.edit = false;
LabelService.update(label); LabelService.update(label);
console.log(label);
} }
$scope.aclAdd = function (sharee) { $scope.aclAdd = function (sharee) {
@@ -301,8 +295,6 @@ app.controller('BoardController', ["$rootScope", "$scope", "$stateParams", "Stat
// settings for card sorting // settings for card sorting
$scope.sortOptions = { $scope.sortOptions = {
itemMoved: function (event) { 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; event.source.itemScope.modelValue.status = event.dest.sortableScope.$parent.column;
var order = event.dest.index; var order = event.dest.index;
var card = event.source.itemScope.c; var card = event.source.itemScope.c;
@@ -369,7 +361,6 @@ app.controller('CardController', ["$scope", "$rootScope", "$routeParams", "$loca
CardService.fetchOne($scope.cardId).then(function(data) { CardService.fetchOne($scope.cardId).then(function(data) {
$scope.statusservice.releaseWaiting(); $scope.statusservice.releaseWaiting();
$scope.archived = CardService.getCurrent().archived; $scope.archived = CardService.getCurrent().archived;
console.log(data);
}, function(error) { }, function(error) {
}); });
@@ -586,6 +577,12 @@ app.filter('orderObjectBy', function(){
return array; return array;
} }
}); });
app.filter('relativeDateFilter', function() {
return function (timestamp) {
return OC.Util.relativeModifiedDate(timestamp*1000);
}
});
app.filter('textColorFilter', function() { app.filter('textColorFilter', function() {
return function (hex) { return function (hex) {
// RGB2HLS by Garry Tan // RGB2HLS by Garry Tan
@@ -1144,19 +1141,16 @@ app.factory('StackService', ["ApiService", "$http", "$q", function(ApiService, $
}; };
StackService.prototype.addCard = function(entity) { StackService.prototype.addCard = function(entity) {
console.log(this.data);
if(!this.data[entity.stackId].cards) { if(!this.data[entity.stackId].cards) {
this.data[entity.stackId].cards = []; this.data[entity.stackId].cards = [];
} }
this.data[entity.stackId].cards.push(entity); this.data[entity.stackId].cards.push(entity);
console.log(this.data);
}; };
StackService.prototype.reorder = function(entity, order) { StackService.prototype.reorder = function(entity, order) {
// assign new order // assign new order
for(var i=0, j=0;i<this.data[entity.stackId].cards.length;i++) { for(var i=0, j=0;i<this.data[entity.stackId].cards.length;i++) {
if(this.data[entity.stackId].cards[i].id === entity.id) { if(this.data[entity.stackId].cards[i].id === entity.id) {
console.log(this.data[entity.stackId].cards[i].title + " " + order);
this.data[entity.stackId].cards[i].order = order; this.data[entity.stackId].cards[i].order = order;
} }
if(j === order) { if(j === order) {

View File

@@ -53,19 +53,16 @@ app.factory('StackService', function(ApiService, $http, $q){
}; };
StackService.prototype.addCard = function(entity) { StackService.prototype.addCard = function(entity) {
console.log(this.data);
if(!this.data[entity.stackId].cards) { if(!this.data[entity.stackId].cards) {
this.data[entity.stackId].cards = []; this.data[entity.stackId].cards = [];
} }
this.data[entity.stackId].cards.push(entity); this.data[entity.stackId].cards.push(entity);
console.log(this.data);
}; };
StackService.prototype.reorder = function(entity, order) { StackService.prototype.reorder = function(entity, order) {
// assign new order // assign new order
for(var i=0, j=0;i<this.data[entity.stackId].cards.length;i++) { for(var i=0, j=0;i<this.data[entity.stackId].cards.length;i++) {
if(this.data[entity.stackId].cards[i].id === entity.id) { if(this.data[entity.stackId].cards[i].id === entity.id) {
console.log(this.data[entity.stackId].cards[i].title + " " + order);
this.data[entity.stackId].cards[i].order = order; this.data[entity.stackId].cards[i].order = order;
} }
if(j === order) { if(j === order) {

View File

@@ -23,8 +23,8 @@
<div id="card-meta" class="card-block"> <div id="card-meta" class="card-block">
<div id="card-dates"> <div id="card-dates">
<?php p($l->t('Modified:')); ?> <span>{{ cardservice.getCurrent().lastModified*1000|date:'medium' }}</span> <?php p($l->t('Modified:')); ?> <span class="live-relative-timestamp" data-timestamp="{{cardservice.getCurrent().lastModified*1000}}">{{ cardservice.getCurrent().lastModified|relativeDateFilter }}</span>
<?php p($l->t('Created:')); ?> <span>{{ cardservice.getCurrent().createdAt*1000|date:'medium' }}</span> <?php p($l->t('Created:')); ?> <span class="live-relative-timestamp" data-timestamp="{{cardservice.getCurrent().createdAt*1000}}">{{ cardservice.getCurrent().createdAt|relativeDateFilter }}</span>
<?php p($l->t('by')); ?> <?php p($l->t('by')); ?>
<span>{{ cardservice.getCurrent().owner }}</span> <span>{{ cardservice.getCurrent().owner }}</span>
</div> </div>