From 42585085c08659cfa305b04947a010d18568dd6a Mon Sep 17 00:00:00 2001 From: Paulo Reis Date: Fri, 6 Jan 2017 12:00:17 +0000 Subject: [PATCH] Integrate new directive, plumb data into it. More styling. --- .../views/project/editor/review-panel.jade | 54 +++++++++++++------ .../review-panel/ReviewPanelManager.coffee | 1 + .../resolvedCommentsDropdown.coffee | 17 +++--- .../stylesheets/app/editor/review-panel.less | 26 ++++++++- 4 files changed, 76 insertions(+), 22 deletions(-) diff --git a/services/web/app/views/project/editor/review-panel.jade b/services/web/app/views/project/editor/review-panel.jade index a2f8d01efd..3e4962f676 100644 --- a/services/web/app/views/project/editor/review-panel.jade +++ b/services/web/app/views/project/editor/review-panel.jade @@ -3,6 +3,7 @@ resolved-comments-dropdown( entries="reviewPanel.entries" threads="reviewPanel.commentThreads" + docs="docs" ) span.review-panel-toolbar-label(ng-click="editor.wantTrackChanges = true;", ng-if="editor.wantTrackChanges === false") Track Changes is strong off @@ -162,11 +163,6 @@ script(type='text/ng-template', id='commentEntryTemplate') stop-propagation="click" placeholder="{{ 'Hit \"Enter\" to reply' + (entry.resolved ? ' and re-open' : '') }}" ) - //- .rp-comment-resolved-description(ng-if="threads[entry.thread_id].resolved && !entry.showWhenResolved") - //- div - //- | Comment resolved by - //- span(style="color: hsl({{ threads[entry.thread_id].resolved_by_user.hue }}, 70%, 40%);") {{ threads[entry.thread_id].resolved_by_user.name }} - //- div {{ threads[entry.thread_id].resolved_at | date : 'MMM d, y h:mm a' }} .rp-entry-actions a.rp-entry-button(href, ng-click="onResolve();") i.fa.fa-inbox @@ -174,15 +170,31 @@ script(type='text/ng-template', id='commentEntryTemplate') a.rp-entry-button(href, ng-click="onReply();") i.fa.fa-reply |  Reply - //- a.rp-entry-button(href, ng-click="onShowThread();", ng-if="threads[entry.thread_id].resolved && !entry.showWhenResolved") - //- |  Show - //- a.rp-entry-button(href, ng-click="onHideThread();", ng-if="threads[entry.thread_id].resolved && entry.showWhenResolved") - //- |  Hide - //- a.rp-entry-button(href, ng-click="onUnresolve();", ng-if="threads[entry.thread_id].resolved") - //- |  Re-open - //- a.rp-entry-button(href, ng-click="onDelete();", ng-if="threads[entry.thread_id].resolved") - //- |  Delete - + +script(type='text/ng-template', id='resolvedCommentEntryTemplate') + .rp-entry.rp-entry-comment + div + .rp-comment-context + | Quoted text on  + .rp-comment-context-file {{ doc.doc.name }} + .rp-comment-context-quote {{ thread.content }} + .rp-comment( + ng-repeat="comment in thread.messages track by comment.id" + ) + p.rp-comment-content + span.rp-entry-user( + style="color: hsl({{ comment.user.hue }}, 70%, 40%);" + ng-if="$first || comment.user.id !== thread.messages[$index - 1].user.id" + ) {{ comment.user.name }}:  + | {{ comment.content }} + .rp-entry-metadata + | {{ comment.timestamp | date : 'MMM d, y h:mm a' }} + .rp-entry-actions + a.rp-entry-button(href, ng-click="onUnresolve();") + |  Re-open + a.rp-entry-button(href, ng-click="onDelete();") + |  Delete + script(type='text/ng-template', id='addCommentEntryTemplate') div @@ -222,6 +234,10 @@ script(type='text/ng-template', id='addCommentEntryTemplate') script(type='text/ng-template', id='resolvedCommentsDropdownTemplate') .resolved-comments + .resolved-comments-backdrop( + ng-class="{ 'resolved-comments-backdrop-visible' : state.isOpen }" + ng-click="state.isOpen = !state.isOpen" + ) a.resolved-comments-toggle( href ng-click="state.isOpen = !state.isOpen" @@ -230,4 +246,12 @@ script(type='text/ng-template', id='resolvedCommentsDropdownTemplate') .resolved-comments-dropdown( ng-class="{ 'resolved-comments-dropdown-open' : state.isOpen }" ) - div wut + div( + ng-repeat="doc in docs" + ) + resolved-comment-entry( + ng-repeat="thread in resolvedCommentsPerFile[doc.doc.id]" + thread="thread" + doc="doc" + ) + diff --git a/services/web/public/coffee/ide/review-panel/ReviewPanelManager.coffee b/services/web/public/coffee/ide/review-panel/ReviewPanelManager.coffee index 51358f8bc7..2ad425b737 100644 --- a/services/web/public/coffee/ide/review-panel/ReviewPanelManager.coffee +++ b/services/web/public/coffee/ide/review-panel/ReviewPanelManager.coffee @@ -5,6 +5,7 @@ define [ "ide/review-panel/directives/changeEntry" "ide/review-panel/directives/commentEntry" "ide/review-panel/directives/addCommentEntry" + "ide/review-panel/directives/resolvedCommentEntry" "ide/review-panel/directives/resolvedCommentsDropdown" "ide/review-panel/filters/notEmpty" "ide/review-panel/filters/orderOverviewEntries" diff --git a/services/web/public/coffee/ide/review-panel/directives/resolvedCommentsDropdown.coffee b/services/web/public/coffee/ide/review-panel/directives/resolvedCommentsDropdown.coffee index 61a187be5b..5bdd85e71e 100644 --- a/services/web/public/coffee/ide/review-panel/directives/resolvedCommentsDropdown.coffee +++ b/services/web/public/coffee/ide/review-panel/directives/resolvedCommentsDropdown.coffee @@ -5,22 +5,27 @@ define [ restrict: "E" templateUrl: "resolvedCommentsDropdownTemplate" scope: - entries: "=" - threads: "=" + entries : "=" + threads : "=" + docs : "=" link: (scope, element, attrs) -> scope.state = isOpen: false - scope.resolvedComments = {} + scope.resolvedCommentsPerFile = {} filterResolvedComments = () -> - scope.resolvedComments = {} + scope.resolvedCommentsPerFile = {} for fileId, fileEntries of scope.entries - scope.resolvedComments[fileId] = {} + scope.resolvedCommentsPerFile[fileId] = {} for entryId, entry of fileEntries if entry.type == "comment" and scope.threads[entry.thread_id].resolved? - scope.resolvedComments[fileId][entryId] = scope.threads[entry.thread_id] + scope.resolvedCommentsPerFile[fileId][entryId] = angular.copy scope.threads[entry.thread_id] + scope.resolvedCommentsPerFile[fileId][entryId].content = entry.content + + console.log scope.resolvedCommentsPerFile + scope.$watchCollection "entries", filterResolvedComments scope.$watchCollection "threads", filterResolvedComments diff --git a/services/web/public/stylesheets/app/editor/review-panel.less b/services/web/public/stylesheets/app/editor/review-panel.less index fc6193deb7..48c37e0159 100644 --- a/services/web/public/stylesheets/app/editor/review-panel.less +++ b/services/web/public/stylesheets/app/editor/review-panel.less @@ -230,6 +230,10 @@ border-bottom: solid 1px @rp-border-grey; cursor: pointer; } + .resolved-comments-dropdown & { + position: static; + margin-bottom: 5px; + } border-left: solid @rp-entry-ribbon-width transparent; border-radius: 3px; @@ -649,9 +653,29 @@ } } +.resolved-comments-backdrop { + display: none; + position: fixed; + top: 0; + right: 0; + bottom: 0; + left: 0; + background-color: rgba(0, 0, 0, .5); + + &-visible { + display: block; + } +} + .resolved-comments-dropdown { display: none; - + position: absolute; + width: 300px; + background-color: @rp-bg-blue; + text-align: left; + padding: 5px; + border-radius: 3px; + &-open { display: block; }