From 20cca0fcd4d303e1813dae8a3979e4723044968f Mon Sep 17 00:00:00 2001 From: Alasdair Smith Date: Wed, 16 May 2018 16:53:33 +0100 Subject: [PATCH 1/8] Add action buttons to project list --- services/web/app/views/project/list/item.pug | 23 +++++++++++++++++-- .../app/views/project/list/project-list.pug | 6 +++-- .../web/app/views/project/list/v1-item.pug | 4 ++-- 3 files changed, 27 insertions(+), 6 deletions(-) diff --git a/services/web/app/views/project/list/item.pug b/services/web/app/views/project/list/item.pug index bfc53a8360..b2fc9390de 100644 --- a/services/web/app/views/project/list/item.pug +++ b/services/web/app/views/project/list/item.pug @@ -1,4 +1,4 @@ -.col-xs-6 +.col-xs-6.col-sm-4.col-md-6 input.select-item( select-individual, type="checkbox", @@ -37,8 +37,27 @@ tooltip-placement="right" tooltip-append-to-body="true" ) -.col-xs-4 +.col-xs-4.col-sm-3.col-md-2 if settings.overleaf span.last-modified(tooltip="{{project.lastUpdated | formatDate}}") {{project.lastUpdated | fromNowDate}} else span.last-modified {{project.lastUpdated | formatDate}} +.hidden-xs.col-sm-3.col-md-2 + button.btn.btn-link.action-btn( + tooltip=translate('copy'), + tooltip-placement="top", + tooltip-append-to-body="true", + ) + i.icon.fa.fa-files-o + button.btn.btn-link.action-btn( + tooltip=translate('download'), + tooltip-placement="top", + tooltip-append-to-body="true", + ) + i.icon.fa.fa-cloud-download + button.btn.btn-link.action-btn( + tooltip=translate('archive'), + tooltip-placement="top", + tooltip-append-to-body="true", + ) + i.icon.fa.fa-inbox \ No newline at end of file diff --git a/services/web/app/views/project/list/project-list.pug b/services/web/app/views/project/list/project-list.pug index df3c2bf681..6e1732ad63 100644 --- a/services/web/app/views/project/list/project-list.pug +++ b/services/web/app/views/project/list/project-list.pug @@ -131,7 +131,7 @@ ) li.container-fluid .row - .col-xs-6 + .col-xs-6.col-sm-4.col-md-6 input.select-all( select-all, type="checkbox" @@ -142,9 +142,11 @@ .col-xs-2 span.header.clickable(ng-click="changePredicate('accessLevel')") #{translate("owner")} i.tablesort.fa(ng-class="getSortIconClass('accessLevel')") - .col-xs-4 + .col-xs-4.col-sm-3.col-md-2 span.header.clickable(ng-click="changePredicate('lastUpdated')") #{translate("last_modified")} i.tablesort.fa(ng-class="getSortIconClass('lastUpdated')") + .hidden-xs.col-sm-3.col-md-2 + span.header #{translate("actions")} li.project_entry.container-fluid( ng-repeat="project in visibleProjects | orderBy:predicate:reverse", ng-controller="ProjectListItemController" diff --git a/services/web/app/views/project/list/v1-item.pug b/services/web/app/views/project/list/v1-item.pug index b4a3ccb99d..5a8e37bca0 100644 --- a/services/web/app/views/project/list/v1-item.pug +++ b/services/web/app/views/project/list/v1-item.pug @@ -1,4 +1,4 @@ -.col-xs-6 +.col-xs-6.col-sm-4.col-md-6 .select-item span.v1-badge( aria-label=translate("v1_badge") @@ -21,5 +21,5 @@ .col-xs-2 span.owner {{ownerName()}} -.col-xs-4 +.col-xs-4.col-sm-3.col-md-2 span.last-modified(tooltip="{{project.lastUpdated | formatDate}}") {{project.lastUpdated | fromNowDate}} \ No newline at end of file From 2d1bcda9ff7a70e0ff628d843d6042fb6604b936 Mon Sep 17 00:00:00 2001 From: Alasdair Smith Date: Wed, 16 May 2018 16:55:23 +0100 Subject: [PATCH 2/8] Style action buttons, and hide on smaller screens --- services/web/public/stylesheets/app/project-list.less | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/services/web/public/stylesheets/app/project-list.less b/services/web/public/stylesheets/app/project-list.less index 982086a262..0843fc6784 100644 --- a/services/web/public/stylesheets/app/project-list.less +++ b/services/web/public/stylesheets/app/project-list.less @@ -369,6 +369,16 @@ ul.project-list { .v1-badge { margin-left: -4px; } + + .action-btn-row { + padding-right: 20px; + } + + .action-btn { + padding: 0 0.3em; + margin-left: 0.2em; + float: right; + } } i.tablesort { padding-left: 8px; From 83c62c8ab14c41229b394c7f6a783eb8c0a873ed Mon Sep 17 00:00:00 2001 From: Alasdair Smith Date: Wed, 16 May 2018 18:05:33 +0100 Subject: [PATCH 3/8] Only show action buttons on v2 --- services/web/app/views/project/list/item.pug | 48 +++++++++++-------- .../app/views/project/list/project-list.pug | 12 +++-- 2 files changed, 35 insertions(+), 25 deletions(-) diff --git a/services/web/app/views/project/list/item.pug b/services/web/app/views/project/list/item.pug index b2fc9390de..ccbf73ac80 100644 --- a/services/web/app/views/project/list/item.pug +++ b/services/web/app/views/project/list/item.pug @@ -1,4 +1,7 @@ -.col-xs-6.col-sm-4.col-md-6 +- var titleClasses = settings.overleaf ? "col-xs-6 col-sm-4 col-md-6" : "col-xs-6" +- var lastUpdatedClasses = settings.overleaf ? " col-xs-4 col-sm-3 col-md-2" : "col-xs-4" + +div(class=titleClasses) input.select-item( select-individual, type="checkbox", @@ -37,27 +40,30 @@ tooltip-placement="right" tooltip-append-to-body="true" ) -.col-xs-4.col-sm-3.col-md-2 + +div(class=lastUpdatedClasses) if settings.overleaf span.last-modified(tooltip="{{project.lastUpdated | formatDate}}") {{project.lastUpdated | fromNowDate}} else span.last-modified {{project.lastUpdated | formatDate}} -.hidden-xs.col-sm-3.col-md-2 - button.btn.btn-link.action-btn( - tooltip=translate('copy'), - tooltip-placement="top", - tooltip-append-to-body="true", - ) - i.icon.fa.fa-files-o - button.btn.btn-link.action-btn( - tooltip=translate('download'), - tooltip-placement="top", - tooltip-append-to-body="true", - ) - i.icon.fa.fa-cloud-download - button.btn.btn-link.action-btn( - tooltip=translate('archive'), - tooltip-placement="top", - tooltip-append-to-body="true", - ) - i.icon.fa.fa-inbox \ No newline at end of file + +if settings.overleaf + .hidden-xs.col-sm-3.col-md-2 + button.btn.btn-link.action-btn( + tooltip=translate('copy'), + tooltip-placement="top", + tooltip-append-to-body="true", + ) + i.icon.fa.fa-files-o + button.btn.btn-link.action-btn( + tooltip=translate('download'), + tooltip-placement="top", + tooltip-append-to-body="true", + ) + i.icon.fa.fa-cloud-download + button.btn.btn-link.action-btn( + tooltip=translate('archive'), + tooltip-placement="top", + tooltip-append-to-body="true", + ) + i.icon.fa.fa-inbox \ No newline at end of file diff --git a/services/web/app/views/project/list/project-list.pug b/services/web/app/views/project/list/project-list.pug index 6e1732ad63..5ce92d3d5e 100644 --- a/services/web/app/views/project/list/project-list.pug +++ b/services/web/app/views/project/list/project-list.pug @@ -131,7 +131,10 @@ ) li.container-fluid .row - .col-xs-6.col-sm-4.col-md-6 + - var titleClasses = settings.overleaf ? " col-xs-6 col-sm-4 col-md-6" : "col-xs-6" + - var lastUpdatedClasses = settings.overleaf ? " col-xs-4 col-sm-3 col-md-2" : "col-xs-4" + + div(class=titleClasses) input.select-all( select-all, type="checkbox" @@ -142,11 +145,12 @@ .col-xs-2 span.header.clickable(ng-click="changePredicate('accessLevel')") #{translate("owner")} i.tablesort.fa(ng-class="getSortIconClass('accessLevel')") - .col-xs-4.col-sm-3.col-md-2 + div(class=lastUpdatedClasses) span.header.clickable(ng-click="changePredicate('lastUpdated')") #{translate("last_modified")} i.tablesort.fa(ng-class="getSortIconClass('lastUpdated')") - .hidden-xs.col-sm-3.col-md-2 - span.header #{translate("actions")} + if settings.overleaf + .hidden-xs.col-sm-3.col-md-2 + span.header #{translate("actions")} li.project_entry.container-fluid( ng-repeat="project in visibleProjects | orderBy:predicate:reverse", ng-controller="ProjectListItemController" From a2dff4bfbbfa69e044953f6acdfe6a7dc90e4146 Mon Sep 17 00:00:00 2001 From: Alasdair Smith Date: Thu, 17 May 2018 11:12:52 +0100 Subject: [PATCH 4/8] Right align actions header --- services/web/app/views/project/list/item.pug | 2 +- services/web/app/views/project/list/project-list.pug | 2 +- services/web/public/stylesheets/app/project-list.less | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/services/web/app/views/project/list/item.pug b/services/web/app/views/project/list/item.pug index ccbf73ac80..3326168105 100644 --- a/services/web/app/views/project/list/item.pug +++ b/services/web/app/views/project/list/item.pug @@ -48,7 +48,7 @@ div(class=lastUpdatedClasses) span.last-modified {{project.lastUpdated | formatDate}} if settings.overleaf - .hidden-xs.col-sm-3.col-md-2 + .hidden-xs.col-sm-3.col-md-2.action-btn-row button.btn.btn-link.action-btn( tooltip=translate('copy'), tooltip-placement="top", diff --git a/services/web/app/views/project/list/project-list.pug b/services/web/app/views/project/list/project-list.pug index 5ce92d3d5e..cfea4aa6c6 100644 --- a/services/web/app/views/project/list/project-list.pug +++ b/services/web/app/views/project/list/project-list.pug @@ -149,7 +149,7 @@ span.header.clickable(ng-click="changePredicate('lastUpdated')") #{translate("last_modified")} i.tablesort.fa(ng-class="getSortIconClass('lastUpdated')") if settings.overleaf - .hidden-xs.col-sm-3.col-md-2 + .hidden-xs.col-sm-3.col-md-2.action-btn-row-header span.header #{translate("actions")} li.project_entry.container-fluid( ng-repeat="project in visibleProjects | orderBy:predicate:reverse", diff --git a/services/web/public/stylesheets/app/project-list.less b/services/web/public/stylesheets/app/project-list.less index 0843fc6784..569035ad72 100644 --- a/services/web/public/stylesheets/app/project-list.less +++ b/services/web/public/stylesheets/app/project-list.less @@ -370,14 +370,14 @@ ul.project-list { margin-left: -4px; } - .action-btn-row { + .action-btn-row-header, .action-btn-row { padding-right: 20px; + text-align: right; } .action-btn { padding: 0 0.3em; margin-left: 0.2em; - float: right; } } i.tablesort { From ffc06f2a3b4365a194bf9bfafdab96967947fb83 Mon Sep 17 00:00:00 2001 From: Alasdair Smith Date: Thu, 17 May 2018 14:28:34 +0100 Subject: [PATCH 5/8] Archive project action button --- services/web/app/views/project/list/item.pug | 1 + .../coffee/main/project-list/project-list.coffee | 13 +++++++++---- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/services/web/app/views/project/list/item.pug b/services/web/app/views/project/list/item.pug index 3326168105..50a613980f 100644 --- a/services/web/app/views/project/list/item.pug +++ b/services/web/app/views/project/list/item.pug @@ -65,5 +65,6 @@ if settings.overleaf tooltip=translate('archive'), tooltip-placement="top", tooltip-append-to-body="true", + ng-click="archive($event)" ) i.icon.fa.fa-inbox \ No newline at end of file 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 36520d2cc7..0a01eb52d3 100644 --- a/services/web/public/coffee/main/project-list/project-list.coffee +++ b/services/web/public/coffee/main/project-list/project-list.coffee @@ -350,14 +350,15 @@ define [ $scope.archiveOrLeaveSelectedProjects() $scope.archiveOrLeaveSelectedProjects = () -> - selected_projects = $scope.getSelectedProjects() - selected_project_ids = $scope.getSelectedProjectIds() + $scope.archiveOrLeaveProjects($scope.getSelectedProjects()) + $scope.archiveOrLeaveProjects = (projects) -> + projectIds = projects.map (p) -> p.id # Remove project from any tags for tag in $scope.tags - $scope._removeProjectIdsFromTagArray(tag, selected_project_ids) + $scope._removeProjectIdsFromTagArray(tag, projectIds) - for project in selected_projects + for project in projects project.tags = [] if project.accessLevel == "owner" project.archived = true @@ -490,3 +491,7 @@ define [ $scope.$watch "project.selected", (value) -> if value? $scope.updateSelectedProjects() + + $scope.archive = (e) -> + e.stopPropagation() + $scope.archiveOrLeaveProjects([$scope.project]) From 2354f4156bf0cddcf07a62acf812c1a43fdb2ef1 Mon Sep 17 00:00:00 2001 From: Alasdair Smith Date: Thu, 17 May 2018 14:28:34 +0100 Subject: [PATCH 6/8] 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]) From 7dffc568049e95665293711e0dde43b0fb2d8e15 Mon Sep 17 00:00:00 2001 From: Alasdair Smith Date: Thu, 17 May 2018 14:28:34 +0100 Subject: [PATCH 7/8] Clone project action button --- services/web/app/views/project/list/item.pug | 1 + .../web/public/coffee/main/project-list/project-list.coffee | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/services/web/app/views/project/list/item.pug b/services/web/app/views/project/list/item.pug index 2f008101f9..a5362ebfd7 100644 --- a/services/web/app/views/project/list/item.pug +++ b/services/web/app/views/project/list/item.pug @@ -53,6 +53,7 @@ if settings.overleaf tooltip=translate('copy'), tooltip-placement="top", tooltip-append-to-body="true", + ng-click="clone($event)" ) i.icon.fa.fa-files-o 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 f458ebd15c..72074a19b9 100644 --- a/services/web/public/coffee/main/project-list/project-list.coffee +++ b/services/web/public/coffee/main/project-list/project-list.coffee @@ -493,6 +493,10 @@ define [ if value? $scope.updateSelectedProjects() + $scope.clone = (e) -> + e.stopPropagation() + $scope.cloneProject($scope.project, "#{$scope.project.name} (Copy)") + $scope.download = (e) -> e.stopPropagation() $scope.downloadProjectsById([$scope.project.id]) From 5ec238cae88483325d4b93c960b8aadd71dac6e2 Mon Sep 17 00:00:00 2001 From: Alasdair Smith Date: Thu, 17 May 2018 15:04:50 +0100 Subject: [PATCH 8/8] Switch archive button with restore button for archived projects --- services/web/app/views/project/list/item.pug | 11 ++++++++++- .../coffee/main/project-list/project-list.coffee | 13 +++++++++---- 2 files changed, 19 insertions(+), 5 deletions(-) diff --git a/services/web/app/views/project/list/item.pug b/services/web/app/views/project/list/item.pug index a5362ebfd7..bc37683489 100644 --- a/services/web/app/views/project/list/item.pug +++ b/services/web/app/views/project/list/item.pug @@ -64,9 +64,18 @@ if settings.overleaf ) i.icon.fa.fa-cloud-download button.btn.btn-link.action-btn( + ng-if="!project.archived" tooltip=translate('archive'), tooltip-placement="top", tooltip-append-to-body="true", ng-click="archive($event)" ) - i.icon.fa.fa-inbox \ No newline at end of file + i.icon.fa.fa-inbox + button.btn.btn-link.action-btn( + ng-if="project.archived" + tooltip=translate('unarchive'), + tooltip-placement="top", + tooltip-append-to-body="true", + ng-click="restore($event)" + ) + i.icon.fa.fa-reply \ No newline at end of file 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 72074a19b9..c2b251bd65 100644 --- a/services/web/public/coffee/main/project-list/project-list.coffee +++ b/services/web/public/coffee/main/project-list/project-list.coffee @@ -415,13 +415,14 @@ define [ $scope.updateVisibleProjects() $scope.restoreSelectedProjects = () -> - selected_projects = $scope.getSelectedProjects() - selected_project_ids = $scope.getSelectedProjectIds() + $scope.restoreProjects($scope.getSelectedProjects()) - for project in selected_projects + $scope.restoreProjects = (projects) -> + projectIds = projects.map (p) -> p.id + for project in projects project.archived = false - for project_id in selected_project_ids + for projectId in projectIds queuedHttp { method: "POST" url: "/project/#{project_id}/restore" @@ -504,3 +505,7 @@ define [ $scope.archive = (e) -> e.stopPropagation() $scope.archiveOrLeaveProjects([$scope.project]) + + $scope.restore = (e) -> + e.stopPropagation() + $scope.restoreProjects([$scope.project])