|
1
|
|
|
|
|
2
|
|
|
|
|
3
|
|
|
/* |
|
4
|
|
|
* @copyright Copyright (c) 2016 Julius Härtl <[email protected]> |
|
5
|
|
|
* |
|
6
|
|
|
* @author Julius Härtl <[email protected]> |
|
7
|
|
|
* |
|
8
|
|
|
* @license GNU AGPL version 3 or any later version |
|
9
|
|
|
* |
|
10
|
|
|
* This program is free software: you can redistribute it and/or modify |
|
11
|
|
|
* it under the terms of the GNU Affero General Public License as |
|
12
|
|
|
* published by the Free Software Foundation, either version 3 of the |
|
13
|
|
|
* License, or (at your option) any later version. |
|
14
|
|
|
* |
|
15
|
|
|
* This program is distributed in the hope that it will be useful, |
|
16
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
17
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
18
|
|
|
* GNU Affero General Public License for more details. |
|
19
|
|
|
* |
|
20
|
|
|
* You should have received a copy of the GNU Affero General Public License |
|
21
|
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>. |
|
22
|
|
|
* |
|
23
|
|
|
*/ |
|
24
|
|
|
|
|
25
|
|
|
app.controller('CardController', function ($scope, $rootScope, $routeParams, $location, $stateParams, BoardService, CardService, StackService, StatusService) { |
|
26
|
|
|
$scope.sidebar = $rootScope.sidebar; |
|
27
|
|
|
$scope.status = {}; |
|
28
|
|
|
|
|
29
|
|
|
$scope.cardservice = CardService; |
|
30
|
|
|
$scope.cardId = $stateParams.cardId; |
|
31
|
|
|
|
|
32
|
|
|
$scope.statusservice = StatusService.getInstance(); |
|
33
|
|
|
$scope.boardservice = BoardService; |
|
34
|
|
|
|
|
35
|
|
|
$scope.statusservice.retainWaiting(); |
|
36
|
|
|
|
|
37
|
|
|
CardService.fetchOne($scope.cardId).then(function(data) { |
|
|
|
|
|
|
38
|
|
|
$scope.statusservice.releaseWaiting(); |
|
39
|
|
|
$scope.archived = CardService.getCurrent().archived; |
|
40
|
|
|
}, function(error) { |
|
|
|
|
|
|
41
|
|
|
}); |
|
42
|
|
|
|
|
43
|
|
|
$scope.cardRenameShow = function() { |
|
44
|
|
|
if($scope.archived || !BoardService.canEdit()) |
|
45
|
|
|
return false; |
|
|
|
|
|
|
46
|
|
|
else { |
|
47
|
|
|
$scope.status.cardRename=true; |
|
|
|
|
|
|
48
|
|
|
} |
|
49
|
|
|
}; |
|
50
|
|
|
$scope.cardEditDescriptionShow = function($event) { |
|
51
|
|
|
var node = $event.target.nodeName; |
|
52
|
|
|
console.log($event); |
|
|
|
|
|
|
53
|
|
|
console.log(BoardService); |
|
54
|
|
|
if($scope.card.archived || !$scope.boardservice.canEdit()) { |
|
55
|
|
|
console.log(node); |
|
56
|
|
|
} else { |
|
57
|
|
|
console.log("edit"); |
|
58
|
|
|
$scope.status.cardEditDescription=true; |
|
59
|
|
|
} |
|
60
|
|
|
console.log($scope.status.canEditDescription); |
|
61
|
|
|
}; |
|
62
|
|
|
// handle rename to update information on the board as well |
|
63
|
|
|
$scope.cardRename = function(card) { |
|
64
|
|
|
CardService.rename(card).then(function(data) { |
|
|
|
|
|
|
65
|
|
|
StackService.updateCard(card); |
|
66
|
|
|
$scope.status.renameCard = false; |
|
67
|
|
|
}); |
|
68
|
|
|
}; |
|
69
|
|
|
$scope.cardUpdate = function(card) { |
|
|
|
|
|
|
70
|
|
|
CardService.update(CardService.getCurrent()).then(function(data) { |
|
|
|
|
|
|
71
|
|
|
$scope.status.cardEditDescription = false; |
|
72
|
|
|
$('#card-description').find('.save-indicator').fadeIn(500).fadeOut(1000); |
|
73
|
|
|
}); |
|
74
|
|
|
}; |
|
75
|
|
|
|
|
76
|
|
|
$scope.labelAssign = function(element, model) { |
|
|
|
|
|
|
77
|
|
|
CardService.assignLabel($scope.cardId, element.id); |
|
78
|
|
|
var card = CardService.getCurrent(); |
|
79
|
|
|
StackService.updateCard(card); |
|
80
|
|
|
}; |
|
81
|
|
|
|
|
82
|
|
|
$scope.labelRemove = function(element, model) { |
|
|
|
|
|
|
83
|
|
|
CardService.removeLabel($scope.cardId, element.id) |
|
84
|
|
|
} |
|
85
|
|
|
|
|
86
|
|
|
}); |
|
87
|
|
|
|
This check looks for parameters in functions that are not used in the function body and are not followed by other parameters which are used inside the function.