From badc4ecb7a8f140a8dc4dc81b8ead3c3464880c9 Mon Sep 17 00:00:00 2001 From: Paulo Reis Date: Tue, 14 Feb 2017 14:40:21 +0000 Subject: [PATCH 1/6] Show add comment tooltip to the left when appropriate. --- services/web/app/views/project/editor/review-panel.pug | 3 ++- .../coffee/ide/review-panel/directives/addCommentEntry.coffee | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/services/web/app/views/project/editor/review-panel.pug b/services/web/app/views/project/editor/review-panel.pug index 8b33be8ef6..1f4fd45a4e 100644 --- a/services/web/app/views/project/editor/review-panel.pug +++ b/services/web/app/views/project/editor/review-panel.pug @@ -79,6 +79,7 @@ on-submit="submitNewComment(content);" on-cancel="cancelNewComment();" on-indicator-click="toggleReviewPanel();" + layout-to-left="reviewPanel.layoutToLeft" ) .rp-entry-list( @@ -310,7 +311,7 @@ script(type='text/ng-template', id='addCommentEntryTemplate') ng-if="!commentState.adding" ng-click="startNewComment(); onIndicatorClick();" tooltip="Add a comment" - tooltip-placement="right" + tooltip-placement="{{ layoutToLeft ? 'left' : 'right' }}" tooltip-append-to-body="true" ) i.fa.fa-commenting diff --git a/services/web/public/coffee/ide/review-panel/directives/addCommentEntry.coffee b/services/web/public/coffee/ide/review-panel/directives/addCommentEntry.coffee index c23c37b674..c30eaadd0f 100644 --- a/services/web/public/coffee/ide/review-panel/directives/addCommentEntry.coffee +++ b/services/web/public/coffee/ide/review-panel/directives/addCommentEntry.coffee @@ -9,6 +9,7 @@ define [ onSubmit: "&" onCancel: "&" onIndicatorClick: "&" + layoutToLeft: "=" link: (scope, element, attrs) -> scope.state = isAdding: false From 36e5ac74dc7d8da69e4e0b9a9aad372108c06359 Mon Sep 17 00:00:00 2001 From: Paulo Reis Date: Wed, 15 Feb 2017 15:11:01 +0000 Subject: [PATCH 2/6] Give the scrollbar a background-color, so that Safari knows that it should paint it. --- services/web/public/stylesheets/app/editor.less | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/services/web/public/stylesheets/app/editor.less b/services/web/public/stylesheets/app/editor.less index 250269a7a2..fdf18d7b38 100644 --- a/services/web/public/stylesheets/app/editor.less +++ b/services/web/public/stylesheets/app/editor.less @@ -181,6 +181,19 @@ } } +// Hack to solve an issue where scrollbars aren't visible in Safari. +// Safari seems to clip part of the scrollbar element. By giving the +// element a background, we're telling Safari that it *really* needs to +// paint the whole area. See https://github.com/ajaxorg/ace/issues/2872 +.ace_scrollbar-inner { + background-color: #FFF; + opacity: 0.01; + + .ace_dark & { + background-color: #000; + } +} + .ui-layout-resizer { width: 6px; background-color: #f4f4f4; From c8a6555cb1fcbe120be68dd86875d6f587a8110d Mon Sep 17 00:00:00 2001 From: James Allen Date: Thu, 16 Feb 2017 17:07:56 +0100 Subject: [PATCH 3/6] Update RangesTracker --- .../ide/review-panel/RangesTracker.coffee | 24 ++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) diff --git a/services/web/public/coffee/ide/review-panel/RangesTracker.coffee b/services/web/public/coffee/ide/review-panel/RangesTracker.coffee index e31b84f051..0430ea2945 100644 --- a/services/web/public/coffee/ide/review-panel/RangesTracker.coffee +++ b/services/web/public/coffee/ide/review-panel/RangesTracker.coffee @@ -105,6 +105,7 @@ load = (EventEmitter) -> throw new Error("unknown op type") addComment: (op, metadata) -> + # TODO: Don't allow overlapping comments? @comments.push comment = { id: op.t or @newId() op: # Copy because we'll modify in place @@ -167,12 +168,14 @@ load = (EventEmitter) -> op_length = op.i.length op_end = op.p + op_length + already_merged = false previous_change = null moved_changes = [] remove_changes = [] new_changes = [] - for change in @changes + + for change, i in @changes change_start = change.op.p if change.op.d? @@ -200,6 +203,16 @@ load = (EventEmitter) -> # Only merge inserts if they are from the same user is_same_user = metadata.user_id == change.metadata.user_id + # If this is an insert op at the end of an existing insert with a delete following, and it cancels out the following + # delete then we shouldn't append it to this insert, but instead only cancel the following delete. + # E.g. + # foo|<--- about to insert 'b' here + # inserted 'foo' --^ ^-- deleted 'bar' + # should become just 'foo' not 'foob' (with the delete marker becoming just 'ar'), . + next_change = @changes[i+1] + is_op_adjacent_to_next_delete = next_change? and next_change.op.d? and op.p == change_end and next_change.op.p == op.p + will_op_cancel_next_delete = is_op_adjacent_to_next_delete and next_change.op.d.slice(0, op.i.length) == op.i + # If there is a delete at the start of the insert, and we're inserting # at the start, we SHOULDN'T merge since the delete acts as a partition. # The previous op will be the delete, but it's already been shifted by this insert @@ -222,7 +235,8 @@ load = (EventEmitter) -> if @track_changes and is_change_overlapping and !is_insert_blocked_by_delete and - !already_merged and + !already_merged and + !will_op_cancel_next_delete and is_same_user offset = op_start - change_start change.op.i = change.op.i.slice(0, offset) + op.i + change.op.i.slice(offset) @@ -396,9 +410,13 @@ load = (EventEmitter) -> @emit "changes:moved", moved_changes _addOp: (op, metadata) -> + # Don't take a reference to the existing op since we'll modify this in place with future changes + clone_op = {} + for k,v of op + clone_op[k] = v change = { id: @newId() - op: op + op: clone_op metadata: metadata } @changes.push change From 31ae2e71241fb86783bd8ecc5e279bc9997b6d6a Mon Sep 17 00:00:00 2001 From: James Allen Date: Fri, 17 Feb 2017 09:24:25 +0100 Subject: [PATCH 4/6] Update RangesTracker --- .../coffee/ide/review-panel/RangesTracker.coffee | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/services/web/public/coffee/ide/review-panel/RangesTracker.coffee b/services/web/public/coffee/ide/review-panel/RangesTracker.coffee index 0430ea2945..865ecf4ef6 100644 --- a/services/web/public/coffee/ide/review-panel/RangesTracker.coffee +++ b/services/web/public/coffee/ide/review-panel/RangesTracker.coffee @@ -410,14 +410,10 @@ load = (EventEmitter) -> @emit "changes:moved", moved_changes _addOp: (op, metadata) -> - # Don't take a reference to the existing op since we'll modify this in place with future changes - clone_op = {} - for k,v of op - clone_op[k] = v change = { id: @newId() - op: clone_op - metadata: metadata + op: @_clone(op) # Don't take a reference to the existing op since we'll modify this in place with future changes + metadata: @_clone(metadata) } @changes.push change @@ -489,6 +485,11 @@ load = (EventEmitter) -> else # Only update to the current change if we haven't removed it. previous_change = change return { moved_changes, remove_changes } + + _clone: (object) -> + clone = {} + (clone[k] = v for k,v of object) + return clone if define? define ["utils/EventEmitter"], load From debe78030a7b3c217d39552667acd37edca74ec6 Mon Sep 17 00:00:00 2001 From: Henry Oswald Date: Fri, 17 Feb 2017 11:05:17 +0000 Subject: [PATCH 5/6] use html from jade as strings now fully html escaped --- services/web/app/views/project/editor/pdf.pug | 2 +- services/web/app/views/user/sessions.pug | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/services/web/app/views/project/editor/pdf.pug b/services/web/app/views/project/editor/pdf.pug index ba03f068a6..e75a2919b7 100644 --- a/services/web/app/views/project/editor/pdf.pug +++ b/services/web/app/views/project/editor/pdf.pug @@ -302,7 +302,7 @@ div.full-size.pdf(ng-controller="PdfController") .alert.alert-danger(ng-show="pdf.validation.conflictedPaths") div strong #{translate("conflicting_paths_found")} - div #{translate("following_paths_conflict")} + div !{translate("following_paths_conflict")} div li(ng-repeat="entry in pdf.validation.conflictedPaths") {{ '/'+entry['path'] }} diff --git a/services/web/app/views/user/sessions.pug b/services/web/app/views/user/sessions.pug index 948ed2d94f..c952daea03 100644 --- a/services/web/app/views/user/sessions.pug +++ b/services/web/app/views/user/sessions.pug @@ -17,7 +17,7 @@ block content div p.small - | #{translate("clear_sessions_description")} + | !{translate("clear_sessions_description")} div div(ng-if="state.otherSessions.length == 0") From 58c7dda945c20d4b11245c5bf0939452974e3e9c Mon Sep 17 00:00:00 2001 From: Henry Oswald Date: Fri, 17 Feb 2017 11:05:27 +0000 Subject: [PATCH 6/6] fix couple of bad translations --- services/web/app/views/subscriptions/group/successful_join.pug | 2 +- services/web/app/views/user/settings.pug | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/services/web/app/views/subscriptions/group/successful_join.pug b/services/web/app/views/subscriptions/group/successful_join.pug index 6de282aa36..9e748f4c38 100644 --- a/services/web/app/views/subscriptions/group/successful_join.pug +++ b/services/web/app/views/subscriptions/group/successful_join.pug @@ -20,6 +20,6 @@ block content .col-md-12   .row .span-md-12 - a.btn.btn-success(href="/project") #{translate("Done")} + a.btn.btn-success(href="/project") #{translate("done")} diff --git a/services/web/app/views/user/settings.pug b/services/web/app/views/user/settings.pug index a4217d8ca4..c358909110 100644 --- a/services/web/app/views/user/settings.pug +++ b/services/web/app/views/user/settings.pug @@ -107,7 +107,7 @@ block content span.small.text-primary(ng-show="changePasswordForm.newPassword2.$error.areEqual && changePasswordForm.newPassword2.$dirty") | #{translate("doesnt_match")} span.small.text-primary(ng-show="!changePasswordForm.newPassword2.$error.areEqual && changePasswordForm.newPassword2.$invalid && changePasswordForm.newPassword2.$dirty") - | #{translate("Invalid Password")} + | #{translate("invalid_password")} .actions button.btn.btn-primary( type='submit',