From 2354f4156bf0cddcf07a62acf812c1a43fdb2ef1 Mon Sep 17 00:00:00 2001 From: Alasdair Smith Date: Thu, 17 May 2018 14:28:34 +0100 Subject: [PATCH] Download project action button --- services/web/app/views/project/list/item.pug | 1 + .../main/project-list/project-list.coffee | 17 +++++++++++------ 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/services/web/app/views/project/list/item.pug b/services/web/app/views/project/list/item.pug index 50a613980f..2f008101f9 100644 --- a/services/web/app/views/project/list/item.pug +++ b/services/web/app/views/project/list/item.pug @@ -59,6 +59,7 @@ if settings.overleaf tooltip=translate('download'), tooltip-placement="top", tooltip-append-to-body="true", + ng-click="download($event)" ) i.icon.fa.fa-cloud-download button.btn.btn-link.action-btn( diff --git a/services/web/public/coffee/main/project-list/project-list.coffee b/services/web/public/coffee/main/project-list/project-list.coffee index 0a01eb52d3..f458ebd15c 100644 --- a/services/web/public/coffee/main/project-list/project-list.coffee +++ b/services/web/public/coffee/main/project-list/project-list.coffee @@ -438,13 +438,14 @@ define [ ) $scope.downloadSelectedProjects = () -> - selected_project_ids = $scope.getSelectedProjectIds() - event_tracking.send 'project-list-page-interaction', 'project action', 'Download Zip' - if selected_project_ids.length > 1 - path = "/project/download/zip?project_ids=#{selected_project_ids.join(',')}" - else - path = "/project/#{selected_project_ids[0]}/download/zip" + $scope.downloadProjectsById($scope.getSelectedProjectIds()) + $scope.downloadProjectsById = (projectIds) -> + event_tracking.send 'project-list-page-interaction', 'project action', 'Download Zip' + if projectIds.length > 1 + path = "/project/download/zip?project_ids=#{projectIds.join(',')}" + else + path = "/project/#{projectIds[0]}/download/zip" window.location = path $scope.openV1ImportModal = (project) -> @@ -492,6 +493,10 @@ define [ if value? $scope.updateSelectedProjects() + $scope.download = (e) -> + e.stopPropagation() + $scope.downloadProjectsById([$scope.project.id]) + $scope.archive = (e) -> e.stopPropagation() $scope.archiveOrLeaveProjects([$scope.project])