Merge pull request #113 from nextcloud/delete-fix-and-undo
Fix deleting boards and add a simple undo function
This commit is contained in:
@@ -86,6 +86,13 @@ button:hover {
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
#app-navigation .app-navigation-entry-utils li.board-delete-undo {
|
||||
background-color: #aa0000;
|
||||
color: #fff;
|
||||
cursor: pointer;
|
||||
width: auto !important;
|
||||
}
|
||||
|
||||
/**
|
||||
* Board view
|
||||
*/
|
||||
|
||||
@@ -21,10 +21,12 @@
|
||||
*
|
||||
*/
|
||||
|
||||
app.controller('ListController', function ($scope, $location, $filter, BoardService, $element) {
|
||||
app.controller('ListController', function ($scope, $location, $filter, BoardService, $element, $timeout) {
|
||||
$scope.boards = [];
|
||||
$scope.newBoard = {};
|
||||
$scope.status = {};
|
||||
$scope.status = {
|
||||
deleteUndo: []
|
||||
};
|
||||
$scope.colors = ['0082c9', '00c9c6','00c906', 'c92b00', 'F1DB50', '7C31CC', '3A3B3D', 'CACBCD'];
|
||||
$scope.boardservice = BoardService;
|
||||
$scope.newBoard.color = $scope.colors[0];
|
||||
@@ -71,9 +73,25 @@ app.controller('ListController', function ($scope, $location, $filter, BoardServ
|
||||
};
|
||||
|
||||
$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);
|
||||
}
|
||||
if($scope.status.deleteUndo[boardId] === 0) {
|
||||
BoardService.delete(board.id).then(function (data) {
|
||||
$scope.filterData();
|
||||
});
|
||||
}
|
||||
};
|
||||
$timeout($scope.boardDeleteCountdown, 1000);
|
||||
};
|
||||
|
||||
$scope.boardDeleteUndo = function (board) {
|
||||
delete $scope.status.deleteUndo[board.id];
|
||||
};
|
||||
|
||||
});
|
||||
|
||||
@@ -7,15 +7,16 @@
|
||||
<a href="#!/board/{{b.id}}/" ng-if="!b.status.edit">{{ b.title }}</a>
|
||||
<div class="app-navigation-entry-utils" ng-show="!b.status.edit" style="position:absolute;">
|
||||
<ul>
|
||||
<li class="app-navigation-entry-utils-counter board-delete-undo" ng-show="status.deleteUndo[b.id]" ng-click="boardDeleteUndo(b)" title="Click to undo">Deleting in {{ status.deleteUndo[b.id] }}s X</li>
|
||||
<li class="app-navigation-entry-utils-menu-share svg" ng-show="b.shared>0"><i class="icon icon-share" title="<?php p($l->t('Shared with you')); ?>"> </i></li>
|
||||
<li class="app-navigation-entry-utils-menu-button svg"><button class="icon-more"></button></li>
|
||||
<li class="app-navigation-entry-utils-menu-button svg" ng-show="!status.deleteUndo[b.id]"><button class="icon-more"></button></li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="app-navigation-entry-menu app-navigation-noclose" ng-show="!b.status.edit">
|
||||
<ul>
|
||||
<li ng-show="b.owner===user"><button class="icon-rename svg" title="<?php p($l->t('edit')); ?>" ng-click="b.status.edit=true"></button></li>
|
||||
<li ng-show="b.owner===user"><button class="icon-delete svg" title="<?php p($l->t('delete')); ?>" ng-click="boardDelete(b)"></button></li>
|
||||
<li ng-show="b.owner!==user"><button class="icon-delete svg" title="<?php p($l->t('remove share')); ?>" ng-click="boardRemoveShare(b)"></button></li>
|
||||
<li ng-show="b.owner.uid===user"><button class="icon-rename svg" title="<?php p($l->t('edit')); ?>" ng-click="b.status.edit=true"></button></li>
|
||||
<li ng-show="b.owner.uid===user"><button class="icon-delete svg" title="<?php p($l->t('delete')); ?>" ng-click="boardDelete(b)"></button></li>
|
||||
<li ng-show="b.owner.uid!==user && false"><button class="icon-delete svg" title="<?php p($l->t('remove share')); ?>" ng-click="boardRemoveShare(b)"></button></li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="app-navigation-entry-deleted" ng-show="false">
|
||||
|
||||
Reference in New Issue
Block a user