From fc7b5bdd6324bcb34581023742732cb2e6ba4855 Mon Sep 17 00:00:00 2001 From: Paulo Reis Date: Fri, 31 Aug 2018 15:33:56 +0100 Subject: [PATCH 01/11] * Share button shown to all users, with a tooltip for non-admin; remove its id. --- services/web/app/views/project/editor/header.pug | 14 +++++++++----- .../ide/share/controllers/ShareController.coffee | 5 ++++- .../web/public/stylesheets/app/editor/toolbar.less | 11 +++++++++++ 3 files changed, 24 insertions(+), 6 deletions(-) diff --git a/services/web/app/views/project/editor/header.pug b/services/web/app/views/project/editor/header.pug index 03b56d9e20..233b2a77b7 100644 --- a/services/web/app/views/project/editor/header.pug +++ b/services/web/app/views/project/editor/header.pug @@ -99,11 +99,15 @@ header.toolbar.toolbar-header.toolbar-with-labels( i.review-icon p.toolbar-label | #{translate("review")} - a.btn.btn-full-height#shareButton( - href, - ng-if="permissions.admin", - ng-click="openShareProjectModal();", - ng-controller="ShareController", + + a.btn.btn-full-height( + href + ng-class="{ 'btn-full-height-disabled' : !permissions.admin }" + ng-click="openShareProjectModal(permissions.admin);" + ng-controller="ShareController" + tooltip-enable="!permissions.admin" + tooltip="Only the project owner can use the Share menu at the moment, but we're working on making it accessible to collaborators, too." + tooltip-placement="bottom" ) i.fa.fa-fw.fa-group p.toolbar-label #{translate("share")} diff --git a/services/web/public/coffee/ide/share/controllers/ShareController.coffee b/services/web/public/coffee/ide/share/controllers/ShareController.coffee index b4a1d7652b..e729b92f08 100644 --- a/services/web/public/coffee/ide/share/controllers/ShareController.coffee +++ b/services/web/public/coffee/ide/share/controllers/ShareController.coffee @@ -3,7 +3,10 @@ define [ ], (App) -> App.controller "ShareController", ["$scope", "$modal", "ide", "projectInvites", "projectMembers", "event_tracking", ($scope, $modal, ide, projectInvites, projectMembers, event_tracking) -> - $scope.openShareProjectModal = () -> + $scope.openShareProjectModal = (isAdmin) -> + if !isAdmin + return + event_tracking.sendMBOnce "ide-open-share-modal-once" $modal.open( diff --git a/services/web/public/stylesheets/app/editor/toolbar.less b/services/web/public/stylesheets/app/editor/toolbar.less index dcc0344c73..aeea9da50a 100644 --- a/services/web/public/stylesheets/app/editor/toolbar.less +++ b/services/web/public/stylesheets/app/editor/toolbar.less @@ -72,6 +72,17 @@ background-color: @toolbar-btn-active-bg-color; box-shadow: @toolbar-btn-active-shadow; } + &.btn-full-height-disabled { + opacity: 0.65; + &:hover, + &.active, + &:active { + text-shadow: none; + background-color: transparent; + color: @toolbar-btn-color; + box-shadow: none; + } + } .label { top: 4px; right: 4px; From 7e5094f53dc45a773d6cfe9199076e031d3605fe Mon Sep 17 00:00:00 2001 From: Paulo Reis Date: Fri, 31 Aug 2018 15:37:22 +0100 Subject: [PATCH 02/11] Avoid z-index issues with the new project dropdown. --- services/web/app/views/project/list/side-bar.pug | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/services/web/app/views/project/list/side-bar.pug b/services/web/app/views/project/list/side-bar.pug index ab8db43877..b2c8f11315 100644 --- a/services/web/app/views/project/list/side-bar.pug +++ b/services/web/app/views/project/list/side-bar.pug @@ -1,4 +1,7 @@ -.dropdown(dropdown) +.dropdown( + dropdown + dropdown-append-to-body +) a.btn.btn-primary.sidebar-new-proj-btn.dropdown-toggle( href="#", data-toggle="dropdown", From 0c390d91a04f027f9ca6e4d05d4f43ded5383185 Mon Sep 17 00:00:00 2001 From: Paulo Reis Date: Fri, 31 Aug 2018 15:44:07 +0100 Subject: [PATCH 03/11] Avoid z-index issues with track-changes comments and the editor splitter. --- services/web/public/stylesheets/app/editor.less | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/services/web/public/stylesheets/app/editor.less b/services/web/public/stylesheets/app/editor.less index 65041eeee8..a98e31f9fa 100644 --- a/services/web/public/stylesheets/app/editor.less +++ b/services/web/public/stylesheets/app/editor.less @@ -378,11 +378,11 @@ CodeMirror display: flex; align-items: center; justify-content: center; - width: @ui-resizer-size !important;; + width: @ui-resizer-size !important; height: 50px; margin-top: -25px; top: 50%; - z-index: 6; + z-index: 3; background-color: @editor-toggler-bg-color; &:hover, From 8ad9db3f0270afb5de72b8edc243c1f9383ed162 Mon Sep 17 00:00:00 2001 From: Paulo Reis Date: Fri, 31 Aug 2018 15:45:33 +0100 Subject: [PATCH 04/11] Forcefully set trackchanges textareas background to white. --- services/web/public/stylesheets/app/editor/review-panel.less | 1 + 1 file changed, 1 insertion(+) diff --git a/services/web/public/stylesheets/app/editor/review-panel.less b/services/web/public/stylesheets/app/editor/review-panel.less index c1bf6d59d7..875edf53a2 100644 --- a/services/web/public/stylesheets/app/editor/review-panel.less +++ b/services/web/public/stylesheets/app/editor/review-panel.less @@ -571,6 +571,7 @@ border: solid 1px @rp-border-grey; resize: vertical; color: @rp-type-darkgrey; + background-color: #FFF; margin-top: 3px; overflow-x: hidden; min-height: 3em; From f88a3815c66cbf4e65db20192d622d48a3ddb614 Mon Sep 17 00:00:00 2001 From: Paulo Reis Date: Fri, 31 Aug 2018 16:14:20 +0100 Subject: [PATCH 05/11] Add loading spinner when cloning a project. --- services/web/app/views/project/list/item.pug | 79 ++++++++++--------- .../main/project-list/project-list.coffee | 3 + 2 files changed, 46 insertions(+), 36 deletions(-) diff --git a/services/web/app/views/project/list/item.pug b/services/web/app/views/project/list/item.pug index 5a9cb2138d..2b1cb59090 100644 --- a/services/web/app/views/project/list/item.pug +++ b/services/web/app/views/project/list/item.pug @@ -49,41 +49,48 @@ div(class=lastUpdatedClasses) if settings.overleaf .hidden-xs.col-sm-3.col-md-2.action-btn-row - button.btn.btn-link.action-btn( - tooltip=translate('copy'), - tooltip-placement="top", - tooltip-append-to-body="true", - ng-click="clone($event)" + div( + ng-if="!project.isTableActionInflight" ) - i.icon.fa.fa-files-o - button.btn.btn-link.action-btn( - tooltip=translate('download'), - tooltip-placement="top", - tooltip-append-to-body="true", - ng-click="download($event)" + button.btn.btn-link.action-btn( + 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( + 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( + ng-if="!project.archived && isOwner()" + tooltip=translate('archive'), + tooltip-placement="top", + tooltip-append-to-body="true", + ng-click="archiveOrLeave($event)" + ) + i.icon.fa.fa-inbox + button.btn.btn-link.action-btn( + ng-if="!project.archived && !isOwner()" + tooltip=translate('leave'), + tooltip-placement="top", + tooltip-append-to-body="true", + ng-click="archiveOrLeave($event)" + ) + i.icon.fa.fa-sign-out + 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 + div( + ng-if="project.isTableActionInflight" ) - i.icon.fa.fa-cloud-download - button.btn.btn-link.action-btn( - ng-if="!project.archived && isOwner()" - tooltip=translate('archive'), - tooltip-placement="top", - tooltip-append-to-body="true", - ng-click="archiveOrLeave($event)" - ) - i.icon.fa.fa-inbox - button.btn.btn-link.action-btn( - ng-if="!project.archived && !isOwner()" - tooltip=translate('leave'), - tooltip-placement="top", - tooltip-append-to-body="true", - ng-click="archiveOrLeave($event)" - ) - i.icon.fa.fa-sign-out - 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 + i.fa.fa-spinner.fa-spin \ 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 3e7136111c..6bc0ac1771 100644 --- a/services/web/public/coffee/main/project-list/project-list.coffee +++ b/services/web/public/coffee/main/project-list/project-list.coffee @@ -502,7 +502,10 @@ define [ $scope.clone = (e) -> e.stopPropagation() + $scope.project.isTableActionInflight = true $scope.cloneProject($scope.project, "#{$scope.project.name} (Copy)") + .then () -> $scope.project.isTableActionInflight = false + .catch () -> $scope.project.isTableActionInflight = false $scope.download = (e) -> e.stopPropagation() From b8f14873d2bb946252fe17cc5f2b7b8a86ce4cea Mon Sep 17 00:00:00 2001 From: Paulo Reis Date: Fri, 31 Aug 2018 16:29:49 +0100 Subject: [PATCH 06/11] Style buttons inside alerts (previously had the same colours for backgrounds). --- services/web/public/stylesheets/components/alerts.less | 3 +++ services/web/public/stylesheets/core/mixins.less | 8 ++++++++ 2 files changed, 11 insertions(+) diff --git a/services/web/public/stylesheets/components/alerts.less b/services/web/public/stylesheets/components/alerts.less index ecdcba07a8..049aa6652b 100755 --- a/services/web/public/stylesheets/components/alerts.less +++ b/services/web/public/stylesheets/components/alerts.less @@ -71,4 +71,7 @@ color: white; text-decoration: underline; } + .btn { + text-decoration: none; + } } \ No newline at end of file diff --git a/services/web/public/stylesheets/core/mixins.less b/services/web/public/stylesheets/core/mixins.less index 866f081292..fa2bf76e40 100755 --- a/services/web/public/stylesheets/core/mixins.less +++ b/services/web/public/stylesheets/core/mixins.less @@ -438,6 +438,7 @@ .alert-link-as-btn when (@is-overleaf = true) { display: inline-block; font-weight: bold; + text-decoration: none; .button-variant(#FFF, shade(@background, 20%), transparent); .button-size(@padding-xs-vertical; @padding-small-horizontal; @font-size-small; @line-height-small; @btn-border-radius-small); &:hover { @@ -511,6 +512,10 @@ background-color: @background; border-color: @border; + .alert & when (@is-overleaf = true) { + background-color: darken(@background, 16%); + } + &:hover, &:focus, &:active, @@ -520,6 +525,9 @@ color: @color; background-color: darken(@background, 8%); border-color: darken(@border, 12%); + .alert & when (@is-overleaf = true) { + background-color: darken(@background, 24%); + } } &:active, &.active, From 4ff741039148eb3e17195b64bd5b2628b5e35318 Mon Sep 17 00:00:00 2001 From: Paulo Reis Date: Fri, 31 Aug 2018 17:10:15 +0100 Subject: [PATCH 07/11] Disable the review button when history is open. --- services/web/app/views/project/editor/header.pug | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/services/web/app/views/project/editor/header.pug b/services/web/app/views/project/editor/header.pug index 233b2a77b7..835192f298 100644 --- a/services/web/app/views/project/editor/header.pug +++ b/services/web/app/views/project/editor/header.pug @@ -93,7 +93,8 @@ header.toolbar.toolbar-header.toolbar-with-labels( a.btn.btn-full-height( href, ng-if="project.features.trackChangesVisible", - ng-class="{ active: ui.reviewPanelOpen }" + ng-class="{ active: ui.reviewPanelOpen && ui.view !== 'history' }" + ng-disabled="ui.view === 'history'" ng-click="toggleReviewPanel()" ) i.review-icon From fbf98d89f296a1cd184e339db9764d1627ff1573 Mon Sep 17 00:00:00 2001 From: Paulo Reis Date: Sat, 1 Sep 2018 15:36:02 +0100 Subject: [PATCH 08/11] Improve the collapsing behaviour of 'change' entries in track-changes. --- .../app/views/project/editor/review-panel.pug | 19 ++++++++++----- .../directives/aggregateChangeEntry.coffee | 24 +++++++++++++------ 2 files changed, 30 insertions(+), 13 deletions(-) diff --git a/services/web/app/views/project/editor/review-panel.pug b/services/web/app/views/project/editor/review-panel.pug index 8328d313e5..17c17f90b5 100644 --- a/services/web/app/views/project/editor/review-panel.pug +++ b/services/web/app/views/project/editor/review-panel.pug @@ -306,14 +306,21 @@ script(type='text/ng-template', id='aggregateChangeEntryTemplate') .rp-entry-details .rp-entry-description | #{translate("aggregate_changed")} - del.rp-content-highlight {{ entry.metadata.replaced_content }} - | #{translate("aggregate_to")} - ins.rp-content-highlight {{ entry.content }} + del.rp-content-highlight + | {{ entry.metadata.replaced_content | limitTo:(isDeletionCollapsed ? contentLimit : entry.metadata.replaced_contentlength) }} a.rp-collapse-toggle( href - ng-if="needsCollapsing" - ng-click="toggleCollapse();" - ) {{ isCollapsed ? '... (#{translate("show_all")})' : ' (#{translate("show_less")})' }} + ng-if="deletionNeedsCollapsing" + ng-click="toggleDeletionCollapse();" + ) {{ isDeletionCollapsed ? '... (#{translate("show_all")})' : ' (#{translate("show_less")})' }} + | #{translate("aggregate_to")} + ins.rp-content-highlight + | {{ entry.content | limitTo:(isInsertionCollapsed ? contentLimit : entry.contentlength) }} + a.rp-collapse-toggle( + href + ng-if="insertionNeedsCollapsing" + ng-click="toggleInsertionCollapse();" + ) {{ isInsertionCollapsed ? '... (#{translate("show_all")})' : ' (#{translate("show_less")})' }} .rp-entry-metadata | {{ entry.metadata.ts | date : 'MMM d, y h:mm a' }} •  span.rp-entry-user(style="color: hsl({{ user.hue }}, 70%, 40%);") {{ user.name }} diff --git a/services/web/public/coffee/ide/review-panel/directives/aggregateChangeEntry.coffee b/services/web/public/coffee/ide/review-panel/directives/aggregateChangeEntry.coffee index 46689193b2..cc2b8dc27c 100644 --- a/services/web/public/coffee/ide/review-panel/directives/aggregateChangeEntry.coffee +++ b/services/web/public/coffee/ide/review-panel/directives/aggregateChangeEntry.coffee @@ -13,18 +13,28 @@ define [ onIndicatorClick: "&" onBodyClick: "&" link: (scope, element, attrs) -> - scope.contentLimit = 35 - scope.isCollapsed = true - scope.needsCollapsing = false + scope.contentLimit = 17 + scope.isDeletionCollapsed = true + scope.isInsertionCollapsed = true + scope.deletionNeedsCollapsing = false + scope.insertionNeedsCollapsing = false element.on "click", (e) -> if $(e.target).is('.rp-entry, .rp-entry-description, .rp-entry-body, .rp-entry-action-icon i') scope.onBodyClick() - scope.toggleCollapse = () -> - scope.isCollapsed = !scope.isCollapsed + scope.toggleDeletionCollapse = () -> + scope.isDeletionCollapsed = !scope.isDeletionCollapsed $timeout () -> scope.$emit "review-panel:layout" - scope.$watch "entry.content.length + entry.metadata.agg_op.content.length", (contentLength) -> - scope.needsCollapsing = contentLength > scope.contentLimit \ No newline at end of file + scope.toggleInsertionCollapse = () -> + scope.isInsertionCollapsed = !scope.isInsertionCollapsed + $timeout () -> + scope.$emit "review-panel:layout" + + scope.$watch "entry.metadata.replaced_content.length", (deletionContentLength) -> + scope.deletionNeedsCollapsing = deletionContentLength > scope.contentLimit + + scope.$watch "entry.content.length", (insertionContentLength) -> + scope.insertionNeedsCollapsing = insertionContentLength > scope.contentLimit \ No newline at end of file From af4094a88cddb10a954a6234883a5d25b3132f0e Mon Sep 17 00:00:00 2001 From: Paulo Reis Date: Sun, 2 Sep 2018 14:44:15 +0100 Subject: [PATCH 09/11] Use CSS hashed paths when hot-swapping themes. --- services/web/app/coffee/infrastructure/ExpressLocals.coffee | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/services/web/app/coffee/infrastructure/ExpressLocals.coffee b/services/web/app/coffee/infrastructure/ExpressLocals.coffee index 0dbf56ff51..8062763923 100644 --- a/services/web/app/coffee/infrastructure/ExpressLocals.coffee +++ b/services/web/app/coffee/infrastructure/ExpressLocals.coffee @@ -346,8 +346,8 @@ module.exports = (app, webRouter, privateApiRouter, publicApiRouter)-> webRouter.use (req, res, next) -> if Settings.overleaf? res.locals.overallThemes = [ - { name: "Default", val: "", path: res.locals.buildCssPath(res.locals.buildCssFileName()) } - { name: "Light", val: "light-", path: res.locals.buildCssPath(res.locals.buildCssFileName("light-")) } + { name: "Default", val: "", path: res.locals.buildCssPath(res.locals.buildCssFileName(), {hashedPath:true}) } + { name: "Light", val: "light-", path: res.locals.buildCssPath(res.locals.buildCssFileName("light-"), {hashedPath:true}) } ] next() From 60cbc989e20e9d6a77d5daca4fc2860b81770958 Mon Sep 17 00:00:00 2001 From: Paulo Reis Date: Sun, 2 Sep 2018 15:14:45 +0100 Subject: [PATCH 10/11] Add delete as an inline table action (only when viewing archived projects). --- services/web/app/views/project/list/item.pug | 8 ++++++ .../main/project-list/project-list.coffee | 27 ++++++++++++++++++- 2 files changed, 34 insertions(+), 1 deletion(-) diff --git a/services/web/app/views/project/list/item.pug b/services/web/app/views/project/list/item.pug index 2b1cb59090..deb9863d04 100644 --- a/services/web/app/views/project/list/item.pug +++ b/services/web/app/views/project/list/item.pug @@ -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" ) 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 6bc0ac1771..9a8d7f7a73 100644 --- a/services/web/public/coffee/main/project-list/project-list.coffee +++ b/services/web/public/coffee/main/project-list/project-list.coffee @@ -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 From 07f884df70e5449f4c35ef3af5a05c1e2effce3a Mon Sep 17 00:00:00 2001 From: Paulo Reis Date: Mon, 3 Sep 2018 09:42:37 +0100 Subject: [PATCH 11/11] Fix spell-checker menu going offscreen. --- .../coffee/ide/editor/components/spellMenu.coffee | 3 ++- .../coffee/ide/editor/directives/aceEditor.coffee | 1 + .../aceEditor/spell-check/SpellCheckAdapter.coffee | 6 ++++++ .../aceEditor/spell-check/SpellCheckManager.coffee | 2 ++ services/web/public/stylesheets/app/editor.less | 13 +++++++++++++ 5 files changed, 24 insertions(+), 1 deletion(-) diff --git a/services/web/public/coffee/ide/editor/components/spellMenu.coffee b/services/web/public/coffee/ide/editor/components/spellMenu.coffee index ff3462e03e..12923ed5f2 100644 --- a/services/web/public/coffee/ide/editor/components/spellMenu.coffee +++ b/services/web/public/coffee/ide/editor/components/spellMenu.coffee @@ -4,6 +4,7 @@ define ["base"], (App) -> open: "<" top: "<" left: "<" + layoutFromBottom: "<" highlight: "<" replaceWord: "&" learnWord: "&" @@ -13,7 +14,7 @@ define ["base"], (App) -> class="dropdown context-menu spell-check-menu" ng-show="$ctrl.open" ng-style="{top: $ctrl.top, left: $ctrl.left}" - ng-class="{open: $ctrl.open}" + ng-class="{open: $ctrl.open, 'spell-check-menu-from-bottom': $ctrl.layoutFromBottom}" >