mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-21 20:47:08 -05:00
Add delete as an inline table action (only when viewing archived projects).
This commit is contained in:
parent
af4094a88c
commit
60cbc989e2
2 changed files with 34 additions and 1 deletions
|
@ -90,6 +90,14 @@ if settings.overleaf
|
|||
ng-click="restore($event)"
|
||||
)
|
||||
i.icon.fa.fa-reply
|
||||
button.btn.btn-link.action-btn(
|
||||
ng-if="project.archived && isOwner()"
|
||||
tooltip=translate('delete_forever'),
|
||||
tooltip-placement="top",
|
||||
tooltip-append-to-body="true",
|
||||
ng-click="deleteProject($event)"
|
||||
)
|
||||
i.icon.fa.fa-trash
|
||||
div(
|
||||
ng-if="project.isTableActionInflight"
|
||||
)
|
||||
|
|
|
@ -469,7 +469,7 @@ define [
|
|||
else
|
||||
$scope.updateVisibleProjects()
|
||||
|
||||
App.controller "ProjectListItemController", ($scope) ->
|
||||
App.controller "ProjectListItemController", ($scope, $modal, queuedHttp) ->
|
||||
|
||||
$scope.shouldDisableCheckbox = (project) ->
|
||||
$scope.filter == 'archived' && project.accessLevel != 'owner'
|
||||
|
@ -518,3 +518,28 @@ define [
|
|||
$scope.restore = (e) ->
|
||||
e.stopPropagation()
|
||||
$scope.restoreProjects([$scope.project])
|
||||
|
||||
$scope.deleteProject = (e) ->
|
||||
e.stopPropagation()
|
||||
modalInstance = $modal.open(
|
||||
templateUrl: "deleteProjectsModalTemplate"
|
||||
controller: "DeleteProjectsModalController"
|
||||
resolve:
|
||||
projects: () -> [ $scope.project ]
|
||||
)
|
||||
|
||||
modalInstance.result.then () ->
|
||||
$scope.project.isTableActionInflight = true
|
||||
queuedHttp({
|
||||
method: "DELETE"
|
||||
url: "/project/#{$scope.project.id}?forever=true"
|
||||
headers:
|
||||
"X-CSRF-Token": window.csrfToken
|
||||
}).then () ->
|
||||
$scope.project.isTableActionInflight = false
|
||||
$scope._removeProjectFromList $scope.project
|
||||
for tag in $scope.tags
|
||||
$scope._removeProjectIdsFromTagArray(tag, [ $scope.project.id ])
|
||||
$scope.updateVisibleProjects()
|
||||
.catch () ->
|
||||
$scope.project.isTableActionInflight = false
|
||||
|
|
Loading…
Reference in a new issue