Archive boards

Signed-off-by: Julius Härtl <jus@bitgrid.net>
This commit is contained in:
Julius Härtl
2017-05-04 10:58:35 +02:00
parent fa5cba631f
commit 8c04ea8dc9
23 changed files with 305 additions and 80 deletions

View File

@@ -80,7 +80,7 @@ app.controller('BoardController', function ($rootScope, $scope, $stateParams, St
}
};
$scope.checkCanEdit = function () {
return !$scope.archived;
return !BoardService.getCurrent().archived;
};
// filter cards here, as ng-sortable will not work nicely with html-inline filters

View File

@@ -48,9 +48,10 @@ app.controller('CardController', function ($scope, $rootScope, $routeParams, $lo
}
};
$scope.cardEditDescriptionShow = function($event) {
if(BoardService.isArchived() || CardService.getCurrent().archived) {
return false;
}
var node = $event.target.nodeName;
console.log($event);
console.log(BoardService);
if($scope.card.archived || !$scope.boardservice.canEdit()) {
console.log(node);
} else {

View File

@@ -21,11 +21,13 @@
*
*/
app.controller('ListController', function ($scope, $location, $filter, BoardService, $element, $timeout) {
app.controller('ListController', function ($scope, $location, $filter, BoardService, $element, $timeout, $stateParams) {
$scope.boards = [];
$scope.newBoard = {};
$scope.status = {
deleteUndo: []
deleteUndo: [],
filter: $stateParams.filter ? $stateParams.filter : '',
sidebar: false
};
$scope.colors = ['0082c9', '00c9c6','00c906', 'c92b00', 'F1DB50', '7C31CC', '3A3B3D', 'CACBCD'];
$scope.boardservice = BoardService;
@@ -42,9 +44,27 @@ app.controller('ListController', function ($scope, $location, $filter, BoardServ
$scope.filterData = function () {
angular.copy($scope.boardservice.getData(), $scope.boardservice.sorted);
$scope.boardservice.sidebar = $filter('orderBy')($scope.boardservice.sorted, 'title');
if ($scope.status.filter === 'archived') {
var filter = {};
filter[$scope.status.filter] = true;
$scope.boardservice.sorted = $filter('cardFilter')($scope.boardservice.sorted, filter);
} else if ($scope.status.filter === 'shared') {
$scope.boardservice.sorted = $filter('cardFilter')($scope.boardservice.sorted, {archived: false});
$scope.boardservice.sorted = $filter('boardFilterAcl')($scope.boardservice.sorted);
} else {
$scope.boardservice.sorted = $filter('cardFilter')($scope.boardservice.sorted, {archived: false});
}
$scope.boardservice.sorted = $filter('orderBy')($scope.boardservice.sorted, 'title');
};
$scope.$state = $stateParams;
$scope.$watch('$state.filter', function (name) {
$scope.status.filter = name;
$scope.filterData();
});
$scope.selectColor = function(color) {
$scope.newBoard.color = color;
};
@@ -72,11 +92,24 @@ app.controller('ListController', function ($scope, $location, $filter, BoardServ
board.status.edit = false;
};
$scope.boardArchive = function (board) {
board.archived = true;
BoardService.update(board).then(function(data) {
$scope.filterData();
});
};
$scope.boardUnarchive = function (board) {
board.archived = false;
BoardService.update(board).then(function(data) {
$scope.filterData();
});
};
$scope.boardDelete = function(board) {
var boardId = board.id;
$scope.status.deleteUndo[boardId] = 10;
$scope.boardDeleteCountdown = function () {
console.log($scope.status);
if($scope.status.deleteUndo[boardId] > 0) {
$scope.status.deleteUndo[boardId]--;
$timeout($scope.boardDeleteCountdown, 1000);